14

In what's below, the equation numbering is annoying and forcing it to move up would be a solution. Anyway what are your suggestions to fix this without modifying the equations?

\documentclass[11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\lipsum[4]
\begin{equation}\begin{aligned}
ac_1 &= a_1c_1 \\
a^2c_2 &= a_1c_2 + a_2c_1^2 \\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) + a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5 \end{aligned}
\end{equation}
\lipsum[4]
\end{document} 

5 Answers 5

14

This way does not push the equations left (does not change the spacing at all, only the tag position):

\documentclass[11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\lipsum[4]
\begin{gather}\begin{aligned}
ac_1 &= a_1c_1 \\
a^2c_2 &= a_1c_2 + a_2c_1^2 \\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) + a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5 \end{aligned}\raisetag{3\baselineskip}
\end{gather}
\lipsum[4]
\end{document} 
2
  • nice but how do you handle 4 equations ? \raisetag{2.5\baselineskip} ?
    – pluton
    Sep 29, 2010 at 16:27
  • @pluton: of course
    – Lev Bishop
    Sep 29, 2010 at 16:36
2

The problem is with the last equation that is almost too big to fit in a line. Another possible solution is to use a small hack with \hspace and make LaTeX think that the length of the equation is actually a bit shorter.

\begin{equation}\begin{aligned}
ac_1 &= a_1c_1 \\
a^2c_2 &= a_1c_2 + a_2c_1^2 \\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) + a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5\hspace{-10pt}\end{aligned}
\end{equation}
1
  • quick and smart but still moving the whole set of equations
    – pluton
    Sep 29, 2010 at 16:10
2

I have another option, using Alexander R. Perlis's mathclap and friends:

\documentclass[11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}


\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\def\mathllap{\mathpalette\mathllapinternal}
\def\mathrlap{\mathpalette\mathrlapinternal}
\def\mathclap{\mathpalette\mathclapinternal}
\def\mathllapinternal#1#2{%
\llap{$\mathsurround=0pt#1{#2}$}}
\def\mathrlapinternal#1#2{%
\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mathclapinternal#1#2{%
\clap{$\mathsurround=0pt#1{#2}$}}

\begin{document}
\begin{equation}\begin{aligned}
ac_1 &= a_1c_1 \\
a^2c_2 &= a_1c_2 + a_2c_1^2 \\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) +\mathrlap{a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5}
\end{aligned}
\end{equation}\end{document} 
4
  • Well, you don't actually need the friends, but I included them in case this will help someone in a different case.... Sep 29, 2010 at 15:21
  • This version has the equations stick out into the margin, which isn't great...
    – Lev Bishop
    Sep 29, 2010 at 15:31
  • 2
    \mathclap and friends are available in the excellent mathtools package. There's no need to reimplement them.
    – TH.
    Sep 29, 2010 at 15:47
  • \mathrlap seems to be interesting \mathrlap{c_1^5} with the last term only. Anyway, it also moves the whole set of equations similarly to others proposed approaches but seems relevant in this situation.
    – pluton
    Sep 29, 2010 at 16:13
1

How about using align?

\documentclass[11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\begin{align}
ac_1 &= a_1c_1 \notag\\
a^2c_2 &= a_1c_2 + a_2c_1^2 \notag\\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \notag\\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) + a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5 \notag
\end{align}
\end{document} 
1
  • possible but not working well with 4 equations only.
    – pluton
    Sep 29, 2010 at 16:15
0

Does this produce something like what you want? I've just replaced the aligned environment with split.

\documentclass[11pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3.6cm,right=3.6cm]{geometry}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\lipsum[4]
\begin{equation}\begin{split}
ac_1 &= a_1c_1 \\
a^2c_2 &= a_1c_2 + a_2c_1^2 \\
a^3c_3 &= a_1c_3 + 2a_2c_1c_2 + a_3c_1^3 \\
a^4c_4 &= a_1c_4 + a_2(c_2^2+2c_1c_3) + 3a_3c_1^2c_2 + a_4c_1^4 \\
a^5c_5 &= a_1c_5 + a_2(2c_1c_4+2c_2c_3) + a_3(3c_1^2c_3+3c_1
c_2^2) + a_4(c_1^3c_2+3c_1^2c_2) + a_5c_1^5 \end{split}
\end{equation}
\lipsum[4]
\end{document} 
1
  • yes, almost but your solution pushes the set of equations to the left. I would be happy to get a solution similar to yours without this "drawback". Thanks
    – pluton
    Sep 29, 2010 at 14:35

You must log in to answer this question.

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