Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to display a set of inequalities to look like the code below

  this is the lower bound
≤ this is the thing to be bounded
≤ this is the upper bound

My attempt to do this is the following:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align*}
  &\phantom{\leq} \text{this is the lower bound} \\
  & \leq \text{this is the thing to be bounded} \\
  & \leq \text{this is the upper bound}
\end{align*}
\end{document}

Unfortunately, in the output, the first line is not quite aligned with the second and third lines, it starts a little bit earlier than desired.

output of code above

I have two questions:

  1. Why doesn't the \phantom command do what I think it is supposed to?
  2. How do I get the desired output?
share|improve this question
    
As I understand it, the alignment in the amsmath align (and related) environments is designed such that if you substitute \quad for \phantom{\leq}, it should give the correct alignment. –  Charles Staats Oct 16 '13 at 1:58
2  
@CharlesStaats No, you're wrong. –  egreg Oct 16 '13 at 6:33
    
@egreg: I take it, then, that the example at the top of page 2 in ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf is a bad practice? Or is this only appropriate when the line begins with a binary operator? –  Charles Staats Oct 16 '13 at 14:44
2  
@CharlesStaats That's “correct” just by chance (indeed the + is a bit at the left of the b). –  egreg Oct 16 '13 at 14:56
add comment

1 Answer 1

up vote 10 down vote accepted

To get the proper alignment using the \phantom method, you need to write \phantom{{}\leq{}} rather than just \phantom{\leq}. Providing the empty "math atoms", {}, around \leq informs TeX that it should treat \leq as an object of type mathrel ("relational operator") rather than of type mathord ("ordinary math item").

You can also get the desired alignment without a \phantom. Just (i) place the alignment symbol (&) immediately before the \text{...} instructions on all three lines and (ii) insert {} between \leq and &\text{...} on lines 2 and 3.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
  &\phantom{{}\leq{}} \text{this is the lower bound} \\
  & \leq \text{this is the thing to be bounded} \\
  & \leq \text{this is the upper bound}
\end{align*}

\begin{align*}
         &\text{this is the lower bound} \\
  \leq{} &\text{this is the thing to be bounded} \\
  \leq{} &\text{this is the upper bound}
\end{align*}
\end{document}
share|improve this answer
    
+1 for informing me of the difference between mathrel and mathord. Why does the \leq{} example work with just a single pair of curly braces? I would have thought based on the first example that {}\leq{} would be required. –  I Like to Code Oct 16 '13 at 13:18
1  
@ILiketoCode - If you look closely at the image I posted, you'll notice that the second group of three lines is placed ever so slightly to the left of the first group. (In both groups, of course, the spacing between the \leq symbols and the subsequent text is the same by design.) If you reran the MWE with \leq{} replaced by {}\leq{} in the second group, you'd find that the first and second groups were now lined up perfectly. Put differently, not putting a {} group before the \leq symbol does have an effect -- just not w.r.t. the spacing between \leq and the subsequent text. –  Mico Oct 16 '13 at 13:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.