Solution (source code)

= Solution

Let the telescope and <collimator> have <focal lengths> $f_t,f_c$, and let $w=f_t\theta$ be the physical slit width. The collimated beam diameter in the dispersion direction is $A_c=f_cD/f_t$, so $wA_c/f_c=\theta D$.

The <diffraction grating> changes both the angular width and the beam diameter. At fixed <wavelength>, differentiating the <grating equation> gives $|d\beta/d\alpha|=\cos\alpha/\cos\beta$. Thus the <anamorphic magnification of a grating> gives
$$
p=w\frac{f_{\rm cam}}{f_c}\frac{\cos\alpha}{\cos\beta}.
$$
If $W$ is the illuminated surface length, its projected beam diameters are $A_c=W\cos\alpha$ and $A_{\rm cam}=W\cos\beta$. Multiplication cancels the anamorphic factors:
$$
\frac{pA_{\rm cam}}{f_{\rm cam}}
=\frac{wA_c}{f_c}=\theta D.
$$
Therefore
$$
\boxed{L=R\theta D=\frac{RpA_{\rm cam}}{f_{\rm cam}}.}
$$
This is a one-dimensional optical-invariant relation: a grating cannot independently magnify the slit and shrink the corresponding beam without compensating angular changes. The calculation uses local paraxial imaging about each instrument’s chief ray and an unclipped beam.