3

I have a question about text which is within an aligned equation. I am happy with the way my equations are aligned, I would like to make some of the text not italicized. In the code, I would like to have "where" unitalicized. Also, I would like to align the 2nd equals signs with each other, but I'll tackle that later.

(MWE provided by sebastiano)

\documentclass[a4paper]{article}
\usepackage{mathtools}
\begin{document}
Aligning equal signs. Example.
\begin{equation}
\begin{split}
y_{destr} &  = nL\lambda/2d, \text{where}\,\, n= \pm 1, \pm 3, \pm 5, \ldots \\
y_{constr} & = nL\lambda/d, \text{where}\,\, n = 0, \pm1, \pm2, \pm3, \ldots\\
\end{split}
\end{equation}
\end{document}

enter image description here

1
  • 3
    Load the amsmath package and use the \text{un-italized text} command – Dr. Manuel Kuehner Jan 22 '17 at 22:45
4

As mentioned the \text macro is the tool for that. I think you will also want to use \mathrm (or \text) for the subscripts of the ys. And use \dots instead of ....

For the alignment, the alignat environment can help you align at both equals sign.

Further, are the (1) and (2) intended to be equation numbers? If so, don't write them out manually, just use the math environment without a * at the end, they are numbered automatically.

Finally, don't end the last line of align (or similar) with \\, that will give you unwanted vertical space after the math display (and an extra number for numbered equations).

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{2}
y_{\mathrm{destr}} &= nL\lambda/2d, \text{ where } & n &= \pm 1, \pm 3, \pm 5, \dots \\
y_{\mathrm{constr}} &= nL\lambda/d, \text{ where} & n &= 0, \pm1, \pm2, \pm3, \dots 
\end{alignat}
\end{document}

As Sam Carter suggested, it might be better to align at where instead of the second =. Alternatively, if the second n was a wider symbol/longer expression than the first n, then you can align at both where and =. It wont make a difference in this case though.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Align at where:
\begin{alignat}{2}
y_{\mathrm{destr}} &= nL\lambda/2d, &&\text{ where }  n = \pm 1, \pm 3, \pm 5, \dots \\
y_{\mathrm{constr}} &= nL\lambda/d, &&\text{ where }  n = 0, \pm1, \pm2, \pm3, \dots 
\end{alignat}
Align at where and =:
\begin{alignat}{3}
y_{\mathrm{destr}} &= nL\lambda/2d, &&\text{ where } & n &= \pm 1, \pm 3, \pm 5, \dots \\
y_{\mathrm{constr}} &= nL\lambda/d, &&\text{ where } & n &= 0, \pm1, \pm2, \pm3, \dots 
\end{alignat}

\end{document}

enter image description here

5
  • May I suggest a second version with the "where" aligned? (You bet my by 20 seconds :) – samcarter_is_at_topanswers.xyz Jan 23 '17 at 15:38
  • @samcarter Working on it. – Torbjørn T. Jan 23 '17 at 15:38
  • @TorbjørnT. Mine is less detailed, and I thought it went well as well. I vote your answer obviously. – Sebastiano Jan 23 '17 at 15:44
  • Just a minor addition: I don't see why one should, at least in most cases, use \mathrm over \text. I think the fact that spaces are ignoted is for beginners rather irritating or confusing. In addition, if you have a sans serif surrounding text, then \text will recognize this. But I am not a pro like you guys. – Dr. Manuel Kuehner Jan 23 '17 at 19:31
  • 1
    @Dr.ManuelKuehner I'm certainly not a pro, so I wont be arguing firmly on finer points of typesetting. I did only use \mathrm for the subscript though. – Torbjørn T. Jan 23 '17 at 20:31

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.