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

6
  • 2
    Why to use multicolumn and not alignat or aligned?
    – Aradnix
    Commented Sep 8, 2014 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
    Commented Sep 8, 2014 at 17:36
  • I would not use alignment in this case, use gather and loose the &'s
    – daleif
    Commented Sep 8, 2014 at 17:47
  • 1
    Could we have an idea of the real equations, and what has to be aligned withwhat?
    – Bernard
    Commented Sep 8, 2014 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
    Commented Sep 8, 2014 at 18:11

4 Answers 4

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}
0
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 ...

1
  • No indeed, I would like to move the full second line.. Commented Sep 8, 2014 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

2
  • 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.. Commented Sep 8, 2014 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
    Commented Sep 8, 2014 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .