Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

A symbols or parameters description is shown below, however, the = and the details of parameter are not aligned.

enter image description here

I want to make a parameters list for a equation like this, in which symbols, = and detail information are aligned in terms of vertical position.

where
   ...
   P   =   notional permeability factor
   N   =   number of waves
   Sd  =   damage level
   ...

A tabular environment will produce more spacing before and after text. So how to make the = vertical aligned?

The codes is provided:

\begin{equation}
\frac{H_s}{\Delta D_{n50} } = 1.0~ P^{0.13}~ \left(\frac{S_d}{N} \right)^{0.2} \xi_m^P~ \sqrt{\cot \alpha}
\end{equation}
where: 

$H_s$ = significant wave height, equal to the average of the highest 1/3 of the waves

$\Delta$  = relative buoyant density, equal to $\rho_r / \rho_w - 1$, where     $\rho_w$ is the water density

$D_{n50}$ = nominal  diameter defined in Equation (2)

$P$ = notional permeability factor

$S_d$ = damage level 

$N$ = number of waves

$\xi_m$ = breaker parameter based on mean wave period $T_m$

$\alpha$ = slope angle
share|improve this question
    
There is a package for that: nomencl. Actually two I know of: nomentbl. Or you could even try glossaries. It really depends on how much effort you are willing to invest (i.e. writing a book vs short paper). –  Count Zero Jan 29 '13 at 10:34
2  
I'd just use align* and \text for the stuff after the = –  daleif Jan 29 '13 at 10:34
    
@daleif, but how to align = in a fixed vertical position –  KOF Jan 29 '13 at 10:37
    
Not understood, don't you know align? &= –  daleif Jan 29 '13 at 11:13

5 Answers 5

up vote 38 down vote accepted

Define your own environment for this; here I realize it as a two column alignment; the first column is typeset in math mode, the second one in text mode; the = is added automatically, with the correct spacing.

\documentclass{article}
\usepackage{array}

\newenvironment{conditions}
  {\par\vspace{\abovedisplayskip}\noindent\begin{tabular}{>{$}l<{$} @{${}={}$} l}}
  {\end{tabular}\par\vspace{\belowdisplayskip}}

\begin{document}
An equation just to start
\begin{equation}
P+N=S_{d}
\end{equation}
where:
\begin{conditions}
 P     &  notional permeability factor \\
 N     &  number of waves \\   
 S_{d} &  damage level
\end{conditions}

\end{document}

enter image description

If your conditions are overlong, then you can use a different environment, that I call conditions*, based on tabularx:

\documentclass{article}
\usepackage{array,tabularx}

\newenvironment{conditions*}
  {\par\vspace{\abovedisplayskip}\noindent
   \tabularx{\columnwidth}{>{$}l<{$} @{${}={}$} >{\raggedright\arraybackslash}X}}
  {\endtabularx\par\vspace{\belowdisplayskip}}

\begin{document}
An equation just to start
\begin{equation}
P+N=S_{d}
\end{equation}
where:
\begin{conditions*}
 P    &  notional permeability factor and something 
          longer that needs to be taken at the next line\\
N     &  number of waves \\
S_{d} &  damage level
\end{conditions*}

\end{document}

enter image description here


Variant for variable symbols

If different symbols are needed instead of = in each line, here's how.

\documentclass{article}
\usepackage{array,tabularx}

\newenvironment{conditions}
  {\par\vspace{\abovedisplayskip}\noindent
   \begin{tabular}{>{$}l<{$} @{} >{${}}c<{{}$} @{} l}}
  {\end{tabular}\par\vspace{\belowdisplayskip}}

\newenvironment{conditions*}
  {\par\vspace{\abovedisplayskip}\noindent
   \tabularx{\columnwidth}{>{$}l<{$} @{}>{${}}c<{{}$}@{} >{\raggedright\arraybackslash}X}}
  {\endtabularx\par\vspace{\belowdisplayskip}}

\begin{document}
An equation just to start
\begin{equation}
P+N=S_{d}
\end{equation}
where:
\begin{conditions}
 P     & =       &  notional permeability factor \\
 N     & \sim    &  number of waves \\
 S_{d} & \propto & damage level
\end{conditions}

An equation just to start
\begin{equation}
P+N=S_{d}
\end{equation}
where:
\begin{conditions*}
 P     & =       & notional permeability factor and something 
                   longer that needs to be taken at the next line\\
 N     & \sim    & number of waves \\
 S_{d} & \propto & damage level
\end{conditions*}

\end{document}

enter image description here

share|improve this answer
    
The \noindent is a little bit right aligned, when using \indent it has more spacing compared to the original \indent value. –  KOF Jan 29 '13 at 13:54
    
I did it on purpose; if you want to have the same indentation, add @{\hspace{\parindent}} at the start of the argument to tabular (or tabularx): \begin{tabular}{@{\hspace{\parindent}>{$}l...} –  egreg Jan 29 '13 at 14:17
    
Besides, how to make the line spacing same as the text line spacing? –  KOF Jan 29 '13 at 15:14
    
@KOF It is the same line spacing as in the text. –  egreg Jan 29 '13 at 15:17
    
I forgot I have defined \renewcommand{\arraystretch}{1.3} for Table entries, so how to make it as default in this cae, 'cause I dont wanna change it. –  KOF Jan 29 '13 at 15:19

As daleif suggested you could use the align* environment. You get the alignment just like in tables with '&'. Here is an example:

\documentclass{article}
\usepackage[fleqn]{amsmath}
\begin{document}

\begin{align*}
    H_s &= \text{significant wave height, equal to the average of the highest 1/3 of
    the waves}\\
    \Delta &= \text{relative buoyant density, equal to }\rho_r\text{ / }\rho_w - 
    1\text{, where }\rho_w\text{ is the water density}\\
    D_{n50} &= \text{nominal  diameter defined in Equation \eqref{eq:dn50g50}}\\
    P &= \text{notional permeability factor}\\
    S_d &= \text{damage level}\\
    N &= \text{number of waves}\\
    \xi_m &= \text{breaker parameter based on mean wave period }T_m\\
    \alpha &= \text{slope angle}
\end{align*}
\end{document}

This should work for you. This is the output: Output

If you don't want all equations to be aligned left, you can use the flalign* environment, like suggested here.

share|improve this answer
    
thanks Dave, the symbols should be \flushleft though –  KOF Jan 29 '13 at 11:30

Another option is to use the tabbing environmnent:

\begin{equation}
\frac{H_s}{\Delta D_{n50} } = 1.0~ P^{0.13}~ \left(  \frac{S_d}{N} \right)^{0.2}  \xi_m^P~ \sqrt{\cot \alpha}
\end{equation}
where: 
\begin{tabbing}
\phantom{$D_{n50}\ $}\= \kill
$H_s$\> = significant wave height, equal to the average of the highest 1/3 of the waves\\
$\Delta$\> = relative buoyant density, equal to $\rho_r / \rho_w - 1$, where     $\rho_w$ is the water density\\
$D_{n50}$\> = nominal  diameter defined in Equation \eqref{eq:dn50g50}\\
$P$\> = notional permeability factor\\
$S_d$\> = damage level\\
$N$\> = number of waves\\
$\xi_m$\> = breaker parameter based on mean wave period $T_m$\\
$\alpha$\> = slope angle\\
\end{tabbing}

The first line in the tabbing environment will set the spacing (i.e. tabstop). The \kill command suppresses the line it precedes, otherwise you would have an extra space between 'where:' and the first definition.

Alternatively, instead of \phantom{$D_{n50}\ $} (the longest item on your list), you can use a fixed width: \hspace{3cm}.

share|improve this answer
    
thanks, that's great. –  KOF Jan 29 '13 at 11:33

I think you can try fairly easy to use alignat environment:

\documentclass{minimal}
\usepackage{amsmath}
\begin{document}

    \begin{alignat*}{3}
      &A   &= &e^{\pi}  \\
      &AB  &= &\sqrt{x} \\
      &ABC &= & \text{An equation with three letters on the left!}
    \end{alignat*}

\end{document}

Resulting in

enter image description here

share|improve this answer
2  
Note that the spaces around the = sign are much too small. –  Hendrik Vogt Jan 29 '13 at 11:25
    
@HendrikVogt, You are right! I noticed and searched for the reason. Based on this answer, alignat doesn't add space between the columns. –  Pouya Jan 29 '13 at 11:33
    
Just write &{}={}& instead af &=& each time to fix the spacing. –  Andrew Swann Feb 6 '13 at 11:03

In this case where their are lots of text on the right, tabular with symbol separation would have been sufficient (and simpler) :

\begin{tabular}{l @{ $=$ } l}
$P$ & notional permeability factor\\
$N$ & number of waves\\
$S_d$ & damage level \\
$f(x,y,z)$ & distribution
\end{tabular}

Resulting in

enter image description here

It should be possible to replace @{ $=$ } with !{=} since the ! add space before and after the separator but I can't get it work.

Ps: thanks to siteduzero.com

share|improve this answer
1  
Isn't this basically the same as @egreg's solution? –  cgnieder Aug 6 '13 at 13:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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