7

An align-environment allows for line-splitting and aligning as in table columns when writing math in latex:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2\\
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}

All equal-signs = will be right under one another because of &.

I need to add a remark in-between two math-lines. Something like the following:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2\\
      This is a remark before the third line.\\
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}

Essentially this extra line must merge the two "columns" that the & symbol has created on all other lines. It should act like a normal text-line and not be split or aligned. If I don't include a &, then the end of the remark is still aligned according to the other lines.

Is it possible to merge "columns" (or "ignore" the & splitting) on a specific line, without altering the others?

ShareLatex example here.

7

If this remark line is not part of the math lines, then using intertext{..} is another way for doing this.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2
      \intertext{This is a remark before the third line.}
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}

enter image description here

Another method is to use \noalign{..}. This will be similar to the \shortintertext.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2\\
      \noalign{This is a remark before the third line.}
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}

enter image description here

3

You could use TeX's multispan (inspiration here).

multispan

\documentclass{article}
\usepackage{amsmath}
\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2\\
      \multispan2{Remark before the third line\hfil}\\
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}
3

You can use shortintertext of the mathtools-package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

    \begin{align*}
      lefthandside1 &= righthandside1\\
      lefthandside2 &= righthandside2\\
      \shortintertext{\hfil This is a remark before the third line.}
      lefthandside3 &= righthandside3\\
      lefthandside4 &= righthandside4
    \end{align*}

\end{document}

enter image description here

If you leave out the \hfil the remark is flushed left.

  • I don't see why the remark should not be flushleft? – Bernard Jun 26 '17 at 18:56
  • I added a comment in the answer. – dexteritas Jun 27 '17 at 9:49

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.