2

I would like to achieve the following alignment:

enter image description here

with equal sign aligned and the term ar aligned, as well as the text and left-aligned on the second row of the equations.

I tried using flalign but there is a weird space before the term ar.

enter image description here

My MWE:

\begin{flalign*} 
            &&  s_n     &= a +  && ar + ar^2 + \dotsb + ar^{n-1} &\\ 
\text{and}  &&  rs_n    &=      && ar + ar^2 + \dotsb + ar^{n-1} + ar^n &
\end{flalign*}
1
  • I take it \intertext and \shortintertext (mathtools) are unacceptable? Commented Nov 27, 2019 at 16:54

3 Answers 3

5

With a simple \hphantom:

\documentclass{article}
\usepackage{mathtools}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\begin{document}

\begin{flalign*}
  & & s_n &= a + ar + ar^2 + \dotsb + ar^{n-1} &\\
 & \text{and} & rs_n &= \phantom{a +{}} ar + ar^2 + \dotsb + ar^{n-1} + ar^n &
\end{flalign*}

\end{document}

enter image description here

Another possibility, to control the space between the text and at the margin, and the equations themselves, with the fleqn environment from nccmath combined with alignat with three columns:

\usepackage{nccmath}
...........
\begin{fleqn}
\begin{alignat*}{3}
        & & s_n &={} & a + ar &+ ar^2 + \dotsb + ar^{n-1} \\
      & \text{and} &\hspace{3em} rs_n &= &ar & + ar^2 + \dotsb + ar^{n-1} + ar^n
\end{alignat*}
\end{fleqn}

Note: if you load mathtools, nccmath has to be loaded first. enter image description here

1
  • 1
    Oh! yes. How could I overlook it? Thanks so much for pointing it, @Mico!
    – Bernard
    Commented Nov 27, 2019 at 9:52
2

With the help of \phantom:

enter image description here

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{flalign*} 
            &&  s_n     &= a + ar + ar^2 + \dotsb + ar^{n-1} &\\ 
\text{and}  &&  rs_n    &= \phantom{ar + } ar + ar^2 + \dotsb + ar^{n-1} + ar^n &
\end{flalign*}

\end{document}
3
  • What's the difference with my first solution?
    – Bernard
    Commented Nov 26, 2019 at 23:28
  • To be honest, there is no difference. When I posted my answer I didn't soo that there was already an answer, let alone an identical. Our posts must have overlapped with you brine a few seconds faster. I honestly hope this didn't come across as stealing your answer.
    – leandriis
    Commented Nov 27, 2019 at 6:18
  • 1
    No, I never thought so.
    – Bernard
    Commented Nov 27, 2019 at 9:39
1

No need for flalign*: A simple align* environment, with a single & alignment point per row, along with a suitable \phantom statement gets the job done.

Aside: I don't think it's helpful to place the word "and" very far away from its associated equation. If you believe that a \quad distance doesn't create enough separation, try \qquad.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'align*' env.
\begin{document}
\begin{align*} 
 s_n &=           a + ar + ar^2 + \dotsb + ar^{n-1} \\ 
\text{and}\quad 
rs_n &= \phantom{a+{}}ar + ar^2 + \dotsb + ar^{n-1} + ar^n 
\end{align*}
\end{document}

You must log in to answer this question.

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