5

Can I get this three column arrangement in the equation environment without using three align environments? The problem I am having is the amsmath error "erroneous nesting of equations" occurs and I want to avoid that error/warning. I also don't want to have to write out all the first lines together, then all the second lines etc. etc. because that would get confusing when editing the equations later on. The following MWC is complex on purpose. It illustrates how confusing it would get if I had to write all the lines as described above. thanks.

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

\begin{equation*}
\begin{align}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
        &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &=      
\end{align}
\begin{align}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
    &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &= \\
\end{align}
\begin{align}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
    &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &= \\
\end{align}
\begin{equation*}

\end{document}
  • Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. – jub0bs May 26 '13 at 14:37
  • You cannot nest an align environment inside an another display math environment. Use an aligned environment. – jub0bs May 26 '13 at 14:40
  • I think you must be running in non-stop mode; if I plough through the errors I get a 3-column output. If I remove the outer \begin{equation}...\end{equation} then there are not 3 columns – cmhughes May 26 '13 at 14:41
  • the answer that says to use aligned is the best advice. the "lonesome" equal signs look odd. if what you want is just extra space, you can insert additional space after a specific line by using the optional argument: \\[12pt].(since you are using amsmath, be sure not to leave a space after \` or the brackets and what's inside will be typeset.) you also shouldn't usually put \` after the last line of an align or aligned. – barbara beeton May 26 '13 at 17:06
7

You cannot nest an align environment inside an another display-math environment, such as equation*. Use the lower-level aligned environment, instead.

Also, \therefore is defined in amssymb; don't forget to load that package.

Note: I've chosen landscape orientation because your equations don't fit on an A4 page in portrait orientation with default margins.

enter image description here

\documentclass{article}

\usepackage[landscape]{geometry}
\usepackage{amsmath,amssymb}

\begin{document}
\begin{equation*}
\begin{aligned}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
        &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &=      
\end{aligned}
\begin{aligned}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
    &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &= \\
\end{aligned}
\begin{aligned}
P_{S}   &= V_{S} \times I_{1} \times cos(\phi) \\
    &=  \times  \times cos(\phi) \\
\therefore     cos(\phi)_{1A}  &= \frac{}{ \times } \\
            &=  \\
I_{S}           &= I_{1} \sqrt{1+THD^{2}} \\
\therefore \ 
THD     &= \frac{I_{S}}{I_{1}} - 1\\    
        &= \frac{}{} - 1 \\
        &=  \\
df      &= cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
        &=  \times \frac{1}{\sqrt{1+^{2}}} \\
        &= \\
\end{aligned}
\end{equation*}
\end{document}
  • Re: landscape orientation. How do I put the third column under the first to keep it looking good in portrait orientation? Thanks for your answer. – jacob May 26 '13 at 22:05
6

I think the other answer is what you want, but just for reference, here's how you can do it in one big align environment- with a bit of code tidying it doesn't look too bad

% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{align}
    P_{S}                        & = V_{S} \times I_{1} \times cos(\phi)         & P_{S}                     & = V_{S} \times I_{1} \times cos(\phi)         & P_{S}                       & = V_{S} \times I_{1} \times cos(\phi)         \\
                                 & =  \times  \times cos(\phi)                   &                           & =  \times  \times cos(\phi)                   &                             & =  \times  \times cos(\phi)                   \\
    \therefore \  cos(\phi)_{1A} & = \frac{}{ \times }                           & \therefore cos(\phi)_{1A} & = \frac{}{ \times }                           & \therefore \ cos(\phi)_{1A} & = \frac{}{ \times }                           \\
                                 & =                                             &                           & =                                             &                             & =                                             \\
    I_{S}                        & = I_{1} \sqrt{1+THD^{2}}                      & I_{S}                     & = I_{1} \sqrt{1+THD^{2}}                      & I_{S}                       & = I_{1} \sqrt{1+THD^{2}}                      \\
    \therefore \  THD            & = \frac{I_{S}}{I_{1}} - 1                     & \therefore  THD           & = \frac{I_{S}}{I_{1}} - 1                     & \therefore \ THD            & = \frac{I_{S}}{I_{1}} - 1                     \\    
                                 & = \frac{}{} - 1                               &                           & = \frac{}{} - 1                               &                             & = \frac{}{} - 1                               \\
                                 & =                                             &                           & =                                             &                             & =                                             \\
    df                           & = cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} & df                        & = cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} & df                          & = cos(\phi) \times \frac{1}{\sqrt{1+THD^{2}}} \\               
                                 & =  \times \frac{1}{\sqrt{1+^{2}}}             &                           & =  \times \frac{1}{\sqrt{1+^{2}}}             &                             & =  \times \frac{1}{\sqrt{1+^{2}}}             \\
                                 & =                                             &                           & =                                             &                             & =                                             \\
\end{align}
\end{document}

enter image description here

  • +1 for indent ;-) -- I think the rule should be part of the arara bundle. In this case the user don't need to modify araraconfig.yaml. – Marco Daniel May 26 '13 at 15:21
  • @MarcoDaniel thanks! I forgot to upload indent.yaml to ctan- I will happily send it to you or Paulo if you'd prefer :) – cmhughes May 26 '13 at 15:22
  • See: github.com/cereda/arara/blob/master/rules/indent.yaml -- Now the rule is part of arara 4.0 – Marco Daniel May 26 '13 at 15:26

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.