# LaTeX doing a really wierd equation array

I don't know what the problem is. Here is the code:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
Some text.
\begin{align}
\label{li2}
\text{Let $s \in S$ and $C \in \mathbb{R}$. Let's show $Cs \in S$:} \nonumber \\
\sum_{k=0}^n{a_k D^k(Cs)} &= \sum_{k=0}^n{Ca_k D^ks} \tag{by linearity of $D^k$} \nonumber \\
&= C\sum_{k=0}^n{a_k D^ks} = 0
\end{align}
\end{document}


• Welcome to TeX.SX! Could you please add the documentclass and required packages, so that it is compilable? Apr 17, 2018 at 4:25
• the output seems to directly match your input, your first line is in the first cell of the first row so the alignment point for the = on the next row is at the end of that text, where did you expect the alignment to be? Apr 17, 2018 at 7:00

There is no reason for making the text part of the alignment. Also, the textual explanation has no relation with the equation number that should refer to both lines.

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{lipsum}% just for the example

\begin{document}

\lipsum[3]

Let $s \in S$ and $C \in \mathbb{R}$. Let's show $Cs \in S$:
\label{li2} \begin{aligned} \sum_{k=0}^n{a_k D^k(Cs)} &= \sum_{k=0}^n{Ca_k D^ks} &&\text{(by linearity of D^k)} \\ &= C\sum_{k=0}^n{a_k D^ks} = 0 \end{aligned}
\lipsum[4]

\end{document}


If you use \begin{aligned}[b], the equation number will be aligned with the bottom line.

• Thank you for your response, but the problem is that there was a short sentence right before the text, and the succession of the two sentence seperate by a new line is wierd-looking, because both of them are hanging indented, and give the impression that they are together. The second line goes with the equation and not with the text. Apr 18, 2018 at 11:29

Welcome to TeX.SE! There were some issues. I don't think it is a good idea to make the first line part of the equation. Then align aligns stuff at some anchor(s), represented by & symbols. Having said this, I am wondering if this closer to what you want.

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
Let $s \in S$ and $C \in \mathbb{R}$. Let's show $Cs \in S$:
\begin{align}
\sum_{k=0}^n{a_k D^k(Cs)} &= \sum_{k=0}^n{Ca_k D^ks} \tag{by linearity of $D^k$} \nonumber \\
&= C\sum_{k=0}^n{a_k D^ks} = 0
\label{li2} %<- there is no point having label and \nonumber in the same line
\end{align}
\end{document}


• The problem was that the "Let s \in S..." part had not to be part of the preceding text. I've just solved it using \intertext, but the vertical-spacing isn't ideal. Moreover, I'm wondering if the \tag trick is really a good one or wether there is a more proper way to do it. Apr 17, 2018 at 4:02
• @Jean-Paul - What's wrong with \tag? Its purpose is to place material that doesn't fall into the equation number category. For sure, it's not some kind of shady "trick".
– Mico
Apr 17, 2018 at 5:10
• @Jean-Paul Why should the text Let $s\in S$... be part of the alignment? It is text and should be treated as such. Apr 17, 2018 at 8:29