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

  • 2
    Why to use multicolumn and not alignat or aligned? – Aradnix Sep 8 '14 at 17:34
  • Or use eqnarray? edit I just saw this, so better use the aligned-commands (and I'll revise my documents). – Hackbard_C Sep 8 '14 at 17:36
  • I would not use alignment in this case, use gather and loose the &'s – daleif Sep 8 '14 at 17:47
  • 1
    Could we have an idea of the real equations, and what has to be aligned withwhat? – Bernard Sep 8 '14 at 17:57
  • @Hackbard_C I remember that eqnarray is deprecated in favour of environments more flexible such as the amsmath or another packages for maths. – Aradnix Sep 8 '14 at 18:11
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}
| improve this answer | |
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 ...

| improve this answer | |
  • No indeed, I would like to move the full second line.. – freddieknets Sep 8 '14 at 18:49
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

| improve this answer | |
  • 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 8 '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 8 '14 at 20:12
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

| improve this answer | |

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.