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.

What's the difference between \strut, \mathstrut and \vphantom? When would I prefer one of them to the others, and why?

share|improve this question
This answer provides some info. –  Peter Grill Jan 15 '12 at 21:24
For once \vphantom takes some content and produces the same vertical size, while \strut always inserts a font-size specific but otherwise fixed amount. –  Martin Scharrer Jan 15 '12 at 21:33

2 Answers 2

up vote 17 down vote accepted

Each are defined as follows in the default document classes (article, book and report):



with \strutbox defined as




Using \mathstrut would be equivalent to using \vphantom(, with \strut sets a zero-width rule (\@width\z@) with depth .3\baselineskip (\@depth.3\baselineskip) and height .7\baselineskip (\@height.7\baselineskip). Note that the latter is font-dependent, since it uses \baselineskip. That is, it is modified with font change selections using \fontsize{..}{..}\selectfont, including the use font switches like \small, \large, etc.

I would use \strut within text or math, and use \vphantom if there is anything else I want a specific height of without the horizontal displacement. For example, when breaking two lines of math with different heights but still wanting to use extensible delimiters \left and \right. \mathstrut is specific to the size of ( and (quoting barbarabeeton), "\mathstrut is often better in math than \strut. Which one is better depends on the local context."

Loading the amsmath redefines these boxes somewhat, although their interpretation remains the same.

share|improve this answer
You should note that \strut is updated by every font size changing command (\large, \small and so on). What you say about "font dependency" is not very clear, IMO. –  egreg Jan 15 '12 at 21:56
@Werner -- \mathstrut is often better in math than \strut. which one is better depends on the local context. –  barbara beeton Jan 15 '12 at 22:16
@barbarabeeton: True. I'll include your comment in my answer. –  Werner Jan 15 '12 at 22:23
And it is worth mentioning that the height of boxes in \fbox{\strut g}\fbox{\strut \"A} are not equal because \strut does not automatically detect the highest and deepest characters in the active character set. –  stalking isn't tolerated Mar 31 '13 at 3:12

The \strut and \mathstrut commands just define a box with a zero width and a convenient fixed height and depth. The last command is for math mode.

The \vphantom commands lets you create a box with a zero width and the same depth and height as the material that's in the argument of the command. The \vphantom command is ideal for scaling left and right delimiters, as is explained in the following example, which is from LaTeX and Friends. The example requires amsmath. The other commands aren't as flexible.

f & = g\left( 3^{3^{3}} + \text{\textrm{\ldots}}\right.\\
  & \qquad \left.+ 3\vphantom{3^{3^{3}}} \right)\,.
share|improve this answer

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.