6

I have a main equation that should be numbered and now I want to define the variables of the equations which may contain another set of equations. For example please have a look;

code:

\begin{align}
\label{eq:2.1}
&\frac{J_1(a k s)}{\sqrt{\pi } s}
\end{align}
\begin{align*}
\text{where} ~& \text{\textsl{a} is lens radius}\\
& \textsl{k}=\frac{2 \pi }{\lambda }\\
& \textsl{s}=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{align*}

Result:

Result

As we can see there is more than 2 line spacing (white space ) between the Eqn 2.1 and the variable definitions ... is there any other efficient way to define variables of equations without numbering them ... Or sub equation them as 2.1.1 , 2.1.2 etc ...

7

Option 1:

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}

\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\intertext{where $a$ is lens radius}
\begin{aligned}
k &=\frac{2 \pi }{\lambda }\\
s &=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}

Option 2:

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}

\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\begin{aligned}
\text{where } &a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}

Option 3:

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}

\begin{document}
\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\intertext{where}
\begin{aligned}
&a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}
\end{document}

Option 4:

Using \shortintertext (Peter Grill's idea):

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage{mathtools}

\begin{document}

\begin{gather}\label{eq:2.1}
\frac{J_1(a k s)}{\sqrt{\pi } s}\\
\shortintertext{where}
\begin{aligned}
&a \text{ is lens radius}\\
&k =\frac{2 \pi }{\lambda }\\
&s =\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right){}^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right){}^2}
\end{aligned}\notag
\end{gather}

\end{document}

The difference between \intertext and \shortintertext:

enter image description here

  • yeah the same issue, what if we want the text : a is lens radius and the other two variables K and S to be aligned one below the other. So that it looks neat and all the variables aligned one below the other in uniformity. – Rene Duchamp Apr 25 '13 at 18:46
  • This also looks very helpful ... thanks a lot again ... – Rene Duchamp Apr 25 '13 at 18:57
  • There is also \shortintertext from the mathtools package which has less vertical spacing, an example of which is in How to subtract two equations?. – Peter Grill Apr 25 '13 at 19:08
7

As detailed in align vs equation there are some occasions when the equation environment is more appropriate

enter image description here

I have moved your \text{...} into text mode in between the equation and align environment.

% arara: pdflatex
% !arara: indent: {overwrite: true, trace: true}
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}\label{eq:2.1}
    \frac{J_1(a k s)}{\sqrt{\pi } s}
\end{equation}
where $a$ is lens radius
\begin{align*}
      & k=\frac{2 \pi }{\lambda }                                                                      \\
      & s=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right)^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right)^2} 
\end{align*}                

or else (following the comment)

screenshot

where 
\begin{align*}
      & a\text{ is lens radius}                                                                        \\
      & k=\frac{2 \pi }{\lambda }                                                                      \\
      & s=\sqrt{\left(\frac{u}{z_2}+\frac{x}{z_1}\right)^2+\left(\frac{v}{z_2}+\frac{y}{z_1}\right)^2} 
\end{align*}                

\end{document}
  • That looks nice, but what if we want the text : a is lens radius and the other two variables K and S to be aligned one below the other. – Rene Duchamp Apr 25 '13 at 18:44
  • @abhilashsukumari see the update :) – cmhughes Apr 25 '13 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.