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 ...

0

2 Answers 2

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

3
  • 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. Apr 25, 2013 at 18:46
  • This also looks very helpful ... thanks a lot again ... Apr 25, 2013 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?. Apr 25, 2013 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}
2
  • 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. Apr 25, 2013 at 18:44
  • @abhilashsukumari see the update :)
    – cmhughes
    Apr 25, 2013 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .