3

I have an equation that I want to look something like

a = b
  = c
  = 1/n[a_1 +
        a_2 +
        a_3 +
        ... +
        a_n]

That is, I'd like the = signs to be aligned, and I'd like to align the a_ns as well. I suspect that the alignat environment is what I'd want to use here. What's throwing me off is that there's just blank space before each a_i, so there's not the "grid alignment" present here that alignat and align are built for. I'd really appreciate any help, and I hope my question is clear. Thanks very much.

  • If you check all the related questions to the right, this almost qualifies as a FAQ. – John Kormylo Apr 6 at 15:04
4

You wrote

I'd like the = signs to be aligned, and I'd like to align the a_ns as well.

Here's a solution that nests an aligned environment in an align* environment.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
a &= b\\
  &= c\\
  &= 1/n[\begin{aligned}[t]
           &a_1 +{} \\
           &a_2 +{} \\
           &a_3 +{} \\
           &{\dotsb}+{} \\
           &a_n]
         \end{aligned}
\end{align*}
\end{document}
| improve this answer | |
  • 1
    Thanks so much, this is exactly what I was looking for! – recursive recursion Apr 6 at 17:22
4

It seems to work well with alignat.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{4}
a & = b                     \\
  & = c                     \\
  & = 1/n [ & a_1 & + {}    \\
  &         & a_2 & + {}    \\
  &         & a_3 & + {}    \\
  &         & \hdots & + {} \\
  &         & a_n &]
\end{alignat*}
\end{document}

| improve this answer | |
  • You may consider to replace \hdots with \dotsm. (+1) – Zarko Apr 6 at 15:31

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.