15

Normally the \sqrt{x} symbol automatically scales according to x, so that it usually seems to be the right size.

But is there any way to manually increase the size of one instance of the \sqrt symbol?

This issue came up in the following MWE:

\documentclass{article}
\newcommand{\blank}[1]{\hfil\penalty1000\hfilneg\rule[-3pt]{#1}{0.4pt}} % nice blank underscores
\begin{document}
Fill in the blank for the following equation:
\[ 3 = \sqrt{\blank{1cm}} \]
\end{document}
  • 5
    have you looked at the \phantom command? – cmhughes Mar 13 '12 at 20:00
  • I tried \sqrt{\phantom{\sum} \blank{1cm}}, which scales the root symbol to the right size, but still leaves an awkward space before the blank line. – jamaicanworm Mar 13 '12 at 20:07
  • 2
    If DavidCarlisle's \strut solution is not what you want, try \vphatom{} instead of \phantom{}. – Peter Grill Mar 13 '12 at 20:31
14

Perhaps a strut is what you are looking for:

\documentclass{article}
\newcommand{\blank}[1]{\hfil\penalty1000\hfilneg\rule[-3pt]{#1}{0.4pt}} % nice blank underscores
\begin{document}
Fill in the blank for the following equation:
\[ 3 = \sqrt{\blank{1cm}} \]
\[ 3 = \sqrt{\strut\blank{1cm}} \]
\end{document}

A strut is a zero width rule the height of a bracket in the current font, TeX formats tend to insert them in various places like table rows to ensure that things get an even spacing. More exactly LaTeX defines strut as

\def\strut{\relax\ifmmode\copy\strutbox\else\unhcopy\strutbox\fi}

Where \strutbox is (re)defined whever there is a size-changing command by the following code:

\setbox\strutbox\hbox{%
  \vrule\@height.7\baselineskip
        \@depth.3\baselineskip
        \@width\z@}%

\z@ means 0pt.

  • That's great! How does it work? – jamaicanworm Mar 13 '12 at 20:30
  • 2
    a strut is a zero width rule the height of a bracket in the current font, TeX formats tend to insert them in various places like table rows to ensure that things get an even spacing. – David Carlisle Mar 13 '12 at 20:34
  • 1
    @doncherry strut description expanded and added – David Carlisle Mar 13 '12 at 20:57
  • 1
    @DavidCarlisle: Great, thanks! I added a bit of information about \z@ since these macros with an @ in them always tend to scare me a bit. Hope you don't mind. – doncherry Mar 13 '12 at 21:03
10

The \phantom{<stuff>} command places a box of horizontal width and vertical height equivalent to the contents <stuff>. It has two smaller equivalents \hphantom and \vphantom that are respectively the horizontal and vertical components of the contents only:

enter image description here

\documentclass{article}
\newcommand{\blank}[1]{\hfil\penalty1000\hfilneg\rule[-3pt]{#1}{0.4pt}} % nice blank underscores
\begin{document}
Fill in the blank for the following equation:
\[ 3 = \sqrt{\blank{1cm}} \]
\[ 3 = \sqrt{\vphantom{\sum}\blank{1cm}} \]
\end{document}

Of course, another alternative would be to place a zero-width rule \rule{0pt}{<height>} of arbitrary height, which acts just like \vphantom, and just like a \strut.

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.