4

I need to change the style of sqrt and should make it a little bit narrower than the standard. second picture shows what I would like to have. any help is appreciated.

this is what I already have

what I want to have

  • You could change the font of the \sqrt to something better matching your expectations. Have a look here or here – Dan H. Aug 4 '14 at 6:56
  • With a little effort you could even draw it in TikZ. – Manuel Aug 4 '14 at 12:38
  • Right. I draw the lines using TikZ but having problem about inserting the text in it. – rask Aug 4 '14 at 15:29
2

I took the following approach to solve this. If I wanted \sqrt{expression} where the surd was made narrow, I first expressed \sqrt{\phantom{\cramped{#1#1}}} and horizontally compressed it by a factor of 2. I then overlaid, in a right-aligned format, the original expression overtop this squeezed-blank sqrt.

I used the \ThisStyle{...\SavedStyle...} syntax of the scalerel package to import the current math style into the expression, so that it works in \scriptstyle and \scriptscriptstyle, as well as \displaystyle.

The MWE shows expressions using the original \sqrt, and then the same expressions with the revised \sqrt.

\documentclass{article}
\usepackage{graphicx,scalerel,mathtools}
\let\svsqrt\sqrt
\def\Sqrt#1{\ThisStyle{\ooalign{%
  \scalebox{.5}[1]{$\SavedStyle\svsqrt{\phantom{\cramped{#1#1}}}$}\cr
  \hfil$\SavedStyle\cramped{#1}$}}}
\parskip 1em
\def\testexpr{
  $\sqrt{2}\quad\sqrt{357x}\quad\scriptstyle\sqrt{12345}\quad\sqrt{\frac{x}{x+1}}$
  \[\sqrt{x^2 + y^2}\quad\sqrt{\frac{x^3}{x+1}}\]\par
}
\begin{document}
\centering
\testexpr
\let\sqrt\Sqrt
\testexpr
\end{document} 

enter image description here

If one is concerned that compressing the expression by a factor of 2 makes the line thickness of the surd too thin, then this more complex definition provides a remedy:

\newsavebox\Nsqrt
\def\Sqrt#1{\ThisStyle{%
  \savebox\Nsqrt{\scalebox{.5}[1]{$\SavedStyle\svsqrt{\phantom{\cramped{#1#1}}}$}}%
  \ooalign{\usebox{\Nsqrt}\cr\kern.2pt\usebox{\Nsqrt}\cr\hfil$\SavedStyle\cramped{#1}$}}}

enter image description here

EDITED to insure that argument uses cramped math style (requires mathtools package).

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.