The title compound, C6H12N4. C9H16O4, undergoes several thermotropic phase transitions. The crystalline structure is layered, with sheets of azelaic acid linked to sheets of hexamethylenetetramine by hydrogen bonds. In the room-temperature phase, the azelaic acid molecules are disordered. By lowering the temperature, this disorder partially disappears. The ordering is clearly observed in reciprocal space where on the rods of diffuse scattering, present in the room-temperature phase, a series of superstructure reflections emerges. This phase transition leads to twin-lattice quasisymmetry (TLQS) twinning. The structure of this twinned phase is explored in this paper. There are two orientational domains linked by a mirror plane which relates disordered orientations of the acid molecules above the phase transition. A single domain has space group P2(1)/c. The structure has been solved and refined on the complete set of data to R-1 = 0.0469. The chains remain partially disordered, showing two acid groups with unequal population: the major form corresponding to a carboxylic acid and the minor to a carboxylate. The ordering of the structure, when going through the phase transition, is interpreted in terms of stabilization by C-H ... O hydrogen bonding. A least-squares estimator of the twinning volume ratio is developed that gives an expression for the twinning ratio in terms of the intensities of nonoverlapping reflections. The twinning ratio obtained in the structure refinement compares very well with that obtained from this estimator. [References: 23]