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.

I am trying to align a multiline equation using array within the equation but it turns out it doesn't do very well. The code I am using is as follows:

\begin{equation}\
\begin{array}{lcl}
\mathcal{L}^{-1}\left\{f(d)\right\} &= \mathcal{L}^{-1}\left\{f_1(\delta).f_2(\delta)\right\} \\
& = exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} exp(-l^2/{4t})\right\} \\
& = F_1 * F_2
\end{array}
\end{equation}

Can anyone suggest better way to deal with it ?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

array is not designed for aligning equations, it is designed for arrays and matrices. The amsmath package has a host of alignment environments, I give a couple of examples:

enter image description here

\documentclass{article}

\usepackage{amsmath}


\begin{document}

\begin{align}
\mathcal{L}^{-1}\left\{f(d)\right\} &= \mathcal{L}^{-1}\left\{f_1(\delta).f_2(\delta)\right\} \\
& = \exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} \exp(-l^2/{4t})\right\} \\
& = F_1 * F_2
\end{align}

or

\begin{equation}
\begin{aligned}
\mathcal{L}^{-1}\left\{f(d)\right\} &= \mathcal{L}^{-1}\left\{f_1(\delta).f_2(\delta)\right\} \\
& = \exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} exp(-l^2/{4t})\right\} \\
& = F_1 * F_2
\end{aligned}
\end{equation}

\end{document}

note that exp is a multi-letter identifier so shouldn't be set in math italic.

share|improve this answer
    
@ David: That was very quick and works perfect. Thank you so much for your time and effort. I found this post and tried to follow that kogler.wordpress.com/2008/03/21/… –  Jdbaba Mar 27 '13 at 23:00
    
The second example works better in this case. If I use \begin{align} then it would put three equations on three lines. I just want only one. –  Jdbaba Mar 27 '13 at 23:02
    
@Jdbaba yes you can suppress two of the three numbers in aligned (\notag) sometimes things are clearly one long equation that you need to wrap, for chained = you can think of it as lots of equations or one long one, anyway it's your document you can get to choose (there are other choices such as gathered and split as well...) –  David Carlisle Mar 27 '13 at 23:08
    
The following equation do not align using aligned. Is there any reason ? \begin{equation} \begin{aligned} F_1 \star F_2 = \int_0^t e^{m(t-\tau)} \frac{l}{2\sqrt{\pi t^3}} e^{\frac{-l^2}{4t}} \& = \frac{l e^{mt}}{2\pi^{1/2}}\int_0^t \frac{e^{(-(m\tau+l^2/{4t}))}}{\tau ^{3/2}} \end{aligned} \end{equation} –  Jdbaba Mar 27 '13 at 23:12
    
don't you want a & before the first = ? –  David Carlisle Mar 27 '13 at 23:14

David's solution is the correct way to go for this case, but you can use array for this and sometimes it does come in handy:

enter image description here

So, the changes required are:

  • Your second column should have been left aligned, not right aligned.
  • You need to eliminate the inter column spacing using @{}, and use &{}= to get the proper math spacing around the equal signs.
  • You should use \exp instead of exp as that is an operator and not a variable.
  • Perhaps use \cdot instead of . (unless the lower dot notation is something I am not familiar with).

As David Carlisle commented, this formulas are displayed in the cramped \textstyle. If you desire the \displaystyle you need to add \displaystyle where it is needed (in this case the second line) to obtain:

enter image description here

Or, if you include the array pacakge then you can include the >{\displaystyle} style to the column specification (as illustrated in last part of MWE).


Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}\noindent
Without \verb|\displaystyle|:
\begin{equation}
\begin{array}{l@{}l}
\mathcal{L}^{-1}\left\{f(d)\right\} 
    &{}= \mathcal{L}^{-1}\left\{f_1(\delta) \cdot f_2(\delta)\right\} \\
    &{}= \exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} \exp(-l^2/{4t})\right\} \\
    &{}= F_1 * F_2
\end{array}
\end{equation}
With \verb|\displaystyle|:
\begin{equation}
\begin{array}{l@{}l}
\mathcal{L}^{-1}\left\{f(d)\right\} 
    &{}= \mathcal{L}^{-1}\left\{f_1(\delta) \cdot f_2(\delta)\right\} \\
    &{}= \displaystyle\exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} \exp(-l^2/{4t})\right\} \\
    &{}= F_1 * F_2
\end{array}
\end{equation}
With \verb|\displaystyle| and \verb|array| package:
\begin{equation}
\begin{array}{l@{}>{\displaystyle}l}
\mathcal{L}^{-1}\left\{f(d)\right\} 
    &{}= \mathcal{L}^{-1}\left\{f_1(\delta) \cdot f_2(\delta)\right\} \\
    &{}= \exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} \exp(-l^2/{4t})\right\} \\
    &{}= F_1 * F_2
\end{array}
\end{equation}
\end{document}

You can eliminate the need for using &{}= by burying that in the array column spec:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
\begin{array}{l@{{}={}}l}
\mathcal{L}^{-1}\left\{f(d)\right\} 
    & \mathcal{L}^{-1}\left\{f_1(\delta).f_2(\delta)\right\} \\
    & \exp(mt) \star \left\{\frac{l}{2\sqrt{\pi t^3}} \exp(-l^2/{4t})\right\} \\
    & F_1 * F_2
\end{array}
\end{equation}
\end{document}
share|improve this answer
1  
Note that this will set the equation in \textstyle not \displaystyle –  David Carlisle Mar 27 '13 at 23:13
    
@DavidCarlisle: Wow, can't believe I have never noticed that yet. I got me some checking to do in my docs. :-) –  Peter Grill Mar 27 '13 at 23:16
1  
You can use array package and >{\displaystyle}l... –  David Carlisle Mar 27 '13 at 23:17

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.