6

Here's my code:

$$\begin{aligned}
h_t     &= ca_t + &2c^2a_{t+1} + 3c^3&a_{t+2}+\ldots \\
h_{t+1} &=        &ca_{t+1}    + 2c^2&a_{t+2} + 3c^3a_{t+3}+\ldots \\
h_{t+2} &=        &                 c&a_{t+2} + 2c^2a_{t+3} + 3c^3a_{t+4}+\ldots
\end{aligned}$$

and the picture: enter image description here

  1. What's with the weird space between ca_t + and 2c^2a_{t+1}? How can I get rid of it?
  2. Although it looks correct, I don't understand why the picture has the a_{t+1} terms aligned when in the code I write that the 2c^2 and c should be aligned. Again, it looks right (and I should fix my code), but I'm just confused about why the picture looks the way it does.
12

I'd use an array environment, which is highly customizable.

enter image description here

\documentclass{article}
\usepackage{array} % for "\newcolumntype" directive
\newcolumntype{C}{>{{}}c<{{}}}
\newcommand\mydots{\multicolumn{1}{l}{\cdots}}

\begin{document}
\[
\setlength\arraycolsep{0pt}
\begin{array}{l*{6}{Cr}}
h_t     &=&ca_t&+&2c^2a_{t+1}&+&3c^3a_{t+2}&+&\mydots \\
h_{t+1} &=&    & &ca_{t+1}   &+&2c^2a_{t+2}&+&3c^3a_{t+3}&+&\mydots \\
h_{t+2} &=&    & &           & &   ca_{t+2}&+&2c^2a_{t+3}&+&3c^3a_{t+4}&+&\mydots 
\end{array}
\]
or, if lining up the ``$c$'' coefficients matters too,
\[
\setlength\arraycolsep{0pt}
\begin{array}{l*{6}{Cr}}
h_t     &=&c\,a_t&+&2c^2a_{t+1}&+&3c^3a_{t+2}&+&\mydots \\
h_{t+1} &=&    & &c^{\phantom{1}}a_{t+1}   &+&2c^2a_{t+2}&+&3c^3a_{t+3}&+&\mydots \\
h_{t+2} &=&    & &           & &   c^{\phantom{1}}a_{t+2}&+&2c^2a_{t+3}&+&3c^3a_{t+4}&+&\mydots 
\end{array}
\]
\end{document}
| improve this answer | |
8

Is this what you want?

You have to remember that n alignment points require 2 n – 1 &. Also, using alignat* gives you full control on the spacing of the alignment columns.

Unrelated: don't use the TeX construct $$ ... $$, use the LaTeX construct \[ ... \] (unnecessary here – use the starred version of the amsmath environments):

\documentclass[11pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{3}
h_t &= ca_t &{}+2c^2 & a_{t+1} & {}+ 3c^3&a_{t+2}+\dotsb \\
h_{t+1} &= & c \,& a_{t+1} &{} + 2c^2&a_{t+2} + 3c^3a_{t+3}+\dotsb \\
h_{t+2} &= & & & c&a_{t+2} + 2c^2a_{t+3} + 3c^3a_{t+4}+\dotsb
\end{alignat*}

\end{document} 

enter image description here

| improve this answer | |
7

A variant of Mico's answer, with more alignment points, but with easier input, taking advantage of the repetitive structure.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\begin{document}
\[
\setlength{\arraycolsep}{0pt}
\newcommand{\row}[1]{%
  &
  c^{\hphantom{1}} &
  a_{t\ifnum#1=0 \else+#1\fi} &
  + &
  2 &
  c^2 &
  a_{t+\number\numexpr#1+1} &
  + &
  3 &
  c^3 &
  a_{t+\number\numexpr#1+2} &
  + &
  \multicolumn{3}{l}{\dotsb}
}
\begin{array}{
  l % the left hand sides
  >{{}}c<{{}} % the equals sign
  *{5}{
    l % numeric coefficient
    l % power of c
    c % 'a' term
    >{{}}c<{{}} % plus
  }
  lll % final dots
}
h_t     &=& \row{0} \\[\jot]
h_{t+1} &=& &&&& \row{1} \\[\jot]
h_{t+2} &=& &&&&&&&& \row{2}
\end{array}
\]
\end{document}

enter image description here

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