Each are defined as follows in the default document classes (article
, book
and report
):
\strut
\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}
with \strutbox
defined as
\setbox\strutbox\hbox{%
\vrule\@height.7\baselineskip
\@depth.3\baselineskip
\@width\z@}%
\mathstrut
\def\mathstrut{\vphantom(}
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.
Best Answer
In the
\mbox
, the space will not be compressed (nor expanded, for that matter) by line-width considerations.As Manuel points out and egreg emphasizes, the construct
\mbox{$~$}
"is really useless," as it is functionally indistinguishable from and less efficient than\mbox{ }
. Nonetheless, I use it in the MWE below to most directly answer the OP's original question. Were the reader to mimic the technique, please use\mbox{ }
.To see this on a grand scale, here I use
\sloppy
to give LaTeX all the rope it needs to hang itself: