Insert Text in the align Environment by \intertext and \shortintertext in LaTeX

May. 18, 2025 • Updated May. 23, 2025

In LaTeX, we can use commands \intertext or \shortintertext to insert text in the align environment, and the benefit of which ways is that these two commands won’t break the equation alignments created by the align environment1:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{align}
x^2 + 2x &= -1
\intertext{after moving $-1$ from the right side to the left side, we have:}
x^2 + 2x + 1 &= 0
\end{align}

\begin{align}
x^2 + 2x &= -1
\shortintertext{after moving $-1$ from the right side to the left side, we have:}
x^2 + 2x + 1 &= 0
\end{align}

\end{document}

image-20250519094623936

As can be seen, the line spacing between two equations is smaller when using \shortintertext command. And note that, the \shortintertext command is from the mathtools package, so we should import it in the preamble in advance.

By the way, these two commands don’t work as above in the split environment although they won’t incur errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{equation}
\begin{split}
x^2 + 2x &= -1
\intertext{after moving $-1$ from the right side to the left side, we have:}
x^2 + 2x + 1 &= 0
\end{split}
\end{equation}

\begin{equation}
\begin{split}
x^2 + 2x &= -1
\shortintertext{after moving $-1$ from the right side to the left side, we have:}
x^2 + 2x + 1 &= 0
\end{split}
\end{equation}

\end{document}

image-20250519095236635


References

  1. LaTeX入门, 刘海洋编著, p. 266. ˄