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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several \stackrel's in my document. See the e.g.:

  • How can I adjust the horizontal spaces between each \stackrel such that the longest items from each stackrel are spaced as if they are from the same word (i.e. "sand wich" will appear exactly the same as a typeset "sandwich")?
  • How can I adjust the vertical spaces between each layer of the \stackrel's line up (i.e. A, C, rain, cloud, J, and L all appear on the same line)?


  • (With the above) how can I ensure that lower-case letters with descenders, "q", "y", "p", and "j" still descend properly?
share|improve this question
up vote 4 down vote accepted

In this specific case, the following answers both your concerns:

  • Use % at the end of each \stackrel to avoid a spurious space inserted by the new line (or carriage return) from your editor (you may only want to insert these between the entries you want to "keep together");
  • Use \strut in each element to raise the contents to a common level. Note that \strut, defines as \rule[-.3\baselineskip]{0pt}{\baselineskip}, accommodates for regular character descenders by virtue of a large enough depth and height.

enter image description here

\usepackage{stackrel}% http://ctan.org/pkg/stackrel

An alternative, instead of using \stackrel, could just be to insert the contents in a tabular via a macro. Then the (vertical) alignment should be established by default. Here's a minimal example showing how that can be achieved:

enter image description here


You'll notice that this provides the \stackrel functionality in a more convenient form since the order of the specified items follow the sequence they're displayed (left-to-right -> top-down). Also, it doesn't require the mathmode-textmode switching.

If you're interested in a more spread out display, that is easily obtainable by using, for example,


which stretches out the rows by a factor of 2.

share|improve this answer
The first (\stackrel) solution presents a new problem: if there are many \stackrel's, the document does not know when to break the line, so they run off the edge of the page. The second (tabular) solution will probably introduce too many other problems into my document. – Village Nov 16 '11 at 6:53
Inconvenience aside, is there any reason I should avoid mathmod-textmode switching? Does this create does anomalies within typography? – Village Nov 16 '11 at 6:53
What kind of "other problems" would the tabular approach introduce? Switching to/from math/text is not necessary in this case, and removes from your code readability. It seems like you're using the stackrel package just because it provides the stacking functionality while other, more suitable, alternatives exist. – Werner Nov 16 '11 at 7:26
Yes, I use stackrel only because it allows 3 levels of text. The stacks sometimes appear within the table of contents and inside \section titles and sometimes contain \footnote's, \glossary entries, cross-references of various kinds, etc. – Village Nov 16 '11 at 7:38
I discovered a problem with strut used together with stackrel: if the word at the top has a lower-case "y", "p", "g", or "j" (which normally hang down below the line), then these words are pushed up. In other words, the bottom of "j" in "jump" will appear at the same hieght as the bottom of "z" in "zebra". – Village Nov 22 '11 at 0:00

Your Answer


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.