12

I'm often finding I need to lay out an equation in a manner resembling the following source:

\begin{align*}
    x = y + z
\end{align*}
where $y = $ the value of $y$;
      $z = $ the value of $z$.

Of course, that precise code puts all the "where" definitions on the one line, as parts of the same paragraph. What would be the best way to specify that list, such that it appears similarly to that above source, i.e., like this?

      x = y + z
where y = the value of y;
      z = the value of z.

Preferably, the equals signs in the list would be aligned with the one in the actual equation.

  • I've added mathtools's \shortintertext as a slightly condensed alternative. – Werner Feb 27 '12 at 18:39
12

You can use amsmath's \intertext macro to intersperse regular paragraph-aligned text within an align environment:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
From this, it is easy to see that
\begin{align*}
    x &= y + z \\
\intertext{where}
    y &= \text{the value of $y$}; \\
    z &= \text{the value of $z$}.
\end{align*}
\end{document}

This maintains the original align alignment and doesn't require any fiddling with boxes (another way of making sure the alignment remains the same).


mathtools provides some extensions to amsmath functionality, including \shortintertext, yielding a slightly condensed display:

enter image description here

\documentclass{article}
% Automatically loaded by mathtools
%\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\begin{document}
From this, it is easy to see that
\begin{align*}
    x &= y + z \\
\shortintertext{where}
    y &= \text{the value of $y$}; \\
    z &= \text{the value of $z$}.
\end{align*}
\end{document}
  • 2
    There is also \shortintertext with the \mathtools package which produces tighter spacing. – Peter Grill Feb 27 '12 at 16:49
  • @PeterGrill: Thanks - I've added a visual of the difference. – Werner Feb 27 '12 at 18:38

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.