a, b, The parent 3D inorganic structures with relevant slices highlighted (a) and their dimensionally reduced progeny (b). Note dimensionally reduced (001) slices of PbX2 have not be isolated outside of the layered heterostructures reported here. Structure directing alkylammonium groups are highlighted in blue and substitution sites for the coordinating ether and sulfide groups in the heterostructures are highlighted in yellow. c, The location of these same templating groups and substitution sites are highlighted in the templated layered heterostructures (PbBr2)2(AMTP)2PbBr4 and (Pb2Cl2)(CYS)2PbCl4. Pb, Cl, Br, C, N, O and S atoms are coloured light-blue, green, orange, grey, blue, red and yellow, respectively. H atoms are omitted for clarity.