15

I would like something like this:

STH
= STH       REASONS Explained.
= STH       LOOOOOOOOOOOOOOOOOOONG
        REASON
= STH.

How can I do this?

3 Answers 3

21

If you use the amsmath package then this can be done using the align (or align* if you don't want the equations numbered) environment together with the \text command for the text.

\documentclass{minimal}
\usepackage{amsmath}

\begin{document}
\begin{align*}
A &= B \\
&= C && \text{Because of D} \\
&= D && \text{But beware of E} \\
&&& \text{Some more on that}
&= F
\end{align*}
\end{document}

Result (note that the actual result will be centred on the page):

aligned mathematics

To get the alignment as you have it, you would have:

&A \\
&= B \

at the start.

The amsmath package is loaded by default if you use one of the classes from the AMS, such as amsart.

2
  • My reason bits are coming out right-aligned and I don't see how to left-align them :(
    – Reb.Cabin
    Mar 26, 2016 at 13:27
  • Ok, i figured this out: "reason" bits come out right-aligned if preceded by a single "&" and left-aligned if preceded by double "&&."
    – Reb.Cabin
    Mar 26, 2016 at 13:49
7

Loop Space answer works well, however, it requires manually splitting the text. This is not very convenient.

A more convenient way is to use \parbox

Following his/her example:

\documentclass{minimal}
\usepackage{amsmath}

\begin{document}
\begin{align*}
A &= B \\
&= C && \text{Because of D} \\
&= D && \parbox[t]{5cm}{
          Some long description here that will split 
          automatically and then force a fourth line \\ 
          Another line here} \\
&= F
\end{align*}
\end{document}
0
3

As a suggestion, here is what can be done with witharrows.

\documentclass{article}
\usepackage{witharrows}

\begin{document}
\begin{DispWithArrows*}[wrap-lines]
A & = B \Arrow{because of D} \\
  & = C \Arrow{some long explanation with automatic line breaking} \\
  & = D \\
  & = F
\end{DispWithArrows*}
\end{document}

Output of the above code

2
  • Can it have forced line breaks
    – Xanlantos
    May 15 at 10:56
  • @Xanlantos: Yes, with the classical command with two backslash. May 15 at 11:37

You must log in to answer this question.

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