Solid-state topochemical polymerization (SSTP) is a promising method to construct functional crystalline polymeric materials, but in contrast to various reactions that happen in solution, only very limited types of SSTP reactions are reported. Diels-Alder (DA) and dehydro-DA (DDA) reactions are textbook reactions for preparing six-membered rings in solution but are scarcely seen in solid-state synthesis. Here, using multiple cutting-edge techniques, we demonstrate that the solid 1,4-diphenylbutadiyne (DPB) undergoes a DDA reaction under 10-20 GPa with the phenyl as the dienophile. The crystal structure at the critical pressure shows that this reaction is "distance-selected". The distance of 3.2 Å between the phenyl and the phenylethynyl facilitates the DDA reaction, while the distances for other DDA and 1,4-addition reactions are too large to allow the bonding. The obtained products are crystalline armchair graphitic nanoribbons, and hence our studies open a new route to construct the crystalline carbon materials with atomic-scale control.