Solution (source code)

= Solution

Let $u=\lambda_2-\Omega_2$ be the outer body's argument of latitude in the nearly circular limit and let $\Delta=\lambda_2-\lambda_1$ be its azimuth in the frame rotating with $M_1$. At the $q=2$ libration centre,
$$
\boxed{p\Delta+2u=\pi}.
$$
Viewed along the star--$M_1$ line, the projected coordinates therefore have the schematic form
$$
y\simeq r_2\sin\Delta,
\qquad
z\simeq r_2\sin I_2\sin u,
\qquad
\Delta=\frac{\pi-2u}{p}.
$$
This relation is the general sketch prescription. For the simplest $p=1$ resonance it is a figure-eight-like curve, with conjunctions on the vertical axis at maximum positive or negative height and node crossings in the reference plane. More generally the curve repeats with the $p$ vertical oscillations and two relative azimuthal circuits required by the $(p+2):p$ commensurability.