2

I would like to be able to use multicolumn inside an align environment, much like we can do in a tabular environment

MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    a &= e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} \\
    e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} &= a
\end{align}
\end{document}

In this case I would like to be able to put the & inside the exponent on the lhs of the second line, i.e. e^{a+b+c+d+e+ & f+g+h+i+j+k+l+m+n+o+p} but of course this is not allowed. I tried using multicolumn but this gave errors as well.

Of course I could align both equations to the left, but where I need it the situation is much more involving. Until now, I would put the ampersand in the second equation fully to the left, and manually adjust using negative spaces… But I wonder if there exists a better solution.

The most ideal situation would be something that allows me to put the & wherever I want, even inside brackets, but I would be happy with a multicolumn solution as well.

EDIT

What I try to achieve is something like

enter image description here

Werner
  • 603,163

4 Answers4

3

if i have understood correctly what you have described, this will give that result:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    a &= e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} \\
    \rlap{$e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p}$}\phantom{e^{a+b+c+d+e+{}}} &= a
\end{align}
\end{document}

output of example code

but somehow, i don't think it's what you really want ...

3

You can use the optional argument of the\MoveEqLeft command, from mathtools to obtain experimetally what you want. In the equation where it's used, it replaces the ampersand and moves the equation a number of ems equal to the optional argument (2 by default).

\documentclass[12pt]{article}

\usepackage{mathtools, amssymb, graphicx}

\begin{document}

\begin{align}
    a &= e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} \\
\MoveEqLeft[4.5] e^{a+b+c+d+e+ f+g+h+i+j+k+l+m+n+o+p} = a
\end{align}

\end{document} 

enter image description here

Bernard
  • 271,350
  • So this is exactly the same as writing &\hspace*{-4.5em} e^{…}, right? Because that's how I've always done it. It is the trial and error part that I try to avoid.. – freddieknets Sep 08 '14 at 19:35
  • It's the same, except you don't have to write the ampersand. I'm afraid what you want can't be done in a simple way – Bernard Sep 08 '14 at 20:12
3

You should provide the spacing in a \phantom way:

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    &\phantom{e^{a+b+c+d+{}}}a = e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} \\
    &e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} = a
\end{align}
\end{document}
Werner
  • 603,163
0

can be written as

Code

\documentclass[12pt]{article}

\usepackage{mathtools, amssymb, graphicx}

\begin{document}

\begin{align}
    a &= e^{a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p} \\ 
 ~{}\quad e^{a+b+c+d+e+ f+g+h+i+j+k+l+m+n+o+p} 
 &= a
\end{align}

\end{document} 

alignedeq

egreg
  • 1,121,712
murugan
  • 1,669