[Tex/LaTex] Numbering equation using eqnarray*

math-mode

I am using eqnarray to write long equations. However when I use it instead of equation environment the equations are not numbered. Can anyone help me to solve this.

This is the syntax that I am using.

\begin{eqnarray*} 
f_{lin}(z) & = &  f(z_{0}) + 
\frac{\partial f(z)}{\partial \ddot{\theta}}\bigg|_{z = z_{0}}\ddot{\theta} + 
\frac{\partial f(z)}{\partial \ddot{\alpha}}\bigg |_{z = z_{0}}\ddot{\alpha} + 
\frac{\partial f(z)}{\partial \dot{\theta}}\bigg |_{z = z_{0}}\dot{\theta} \\
& &  + \frac{\partial f(z)}{\partial \dot{\alpha}}\bigg |_{z = z_{0}}\dot{\alpha} + 
\frac{\partial f(z)}{\partial \theta}\bigg |_{z = z_{0}}\theta + 
\frac{\partial f(z)}{\partial \alpha}\bigg |_{z = z_{0}}\alpha
\end{eqnarray*}

Best Answer

In addition to recommending that you use the align environment (provided by the amsmath package) instead of the eqnarray* environment, I would also suggest you make each line's first + symbol the alignment point, rather than the = symbol; that way, the structure of the equation should become very readily apparent. And, since the string \bigg|_{z = z_{0}} occurs no fewer than six times, it's handy to create a shortcut macro for it.

enter image description here

\documentclass{article}
\usepackage{amsmath} % provides the "align" environment
\newcommand\atz{\bigg\vert_{z=z_0}\!} % a shortcut macro
\begin{document}
\begin{align} 
f_{\textit{lin}}(z) =  f(z_{0}) 
&+ 
\frac{\partial f(z)}{\partial \ddot{\theta}}\atz \ddot{\theta} + 
\frac{\partial f(z)}{\partial \ddot{\alpha}}\atz \ddot{\alpha} + 
\frac{\partial f(z)}{\partial \dot{\theta}}\atz \dot{\theta} \notag \\ 
&+ \frac{\partial f(z)}{\partial \dot{\alpha}}\atz \dot{\alpha} + 
\frac{\partial f(z)}{\partial \theta}\atz \theta + 
\frac{\partial f(z)}{\partial \alpha}\atz \alpha
\end{align}
\end{document}

If you don't want to use the align environment, you could use a split environment inside an equation environment; the main difference is that there's a single equation number that's centered vertically across the rows of the equation:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand\atz{\bigg\vert_{z=z_0}\!} % a shortcut macro
\begin{document}
\begin{equation}
\begin{split} 
f_{\textit{lin}}(z) =  f(z_{0}) 
&+ 
\frac{\partial f(z)}{\partial \ddot{\theta}}\atz \ddot{\theta} + 
\frac{\partial f(z)}{\partial \ddot{\alpha}}\atz \ddot{\alpha} + 
\frac{\partial f(z)}{\partial \dot{\theta}}\atz \dot{\theta} \\[1ex] % some additional vertical separation
&+ \frac{\partial f(z)}{\partial \dot{\alpha}}\atz \dot{\alpha} + 
\frac{\partial f(z)}{\partial \theta}\atz \theta + 
\frac{\partial f(z)}{\partial \alpha}\atz \alpha
\end{split}
\end{equation}
\end{document}
Related Question