6

I recently installed math professional II font (mtpro2 lite). It works fine except that the SQRT with root index sucks.

\[ \sqrt[100]{1000000} = 1000 \quad \sqrt[3]{1000000} = 100 \]

\[ \SQRT[100]{1000000} = 1000 \quad \SQRT[3]{1000000}= 100 \]

Output

mtpro2sqrt

Is this a problem of the lite version (intended or not)? Does the complete version have this problem too? How can I define a new command to handle the situation automatically?

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Jul 29 '15 at 8:35
  • 1
    I can confirm that the full mtpro2 package suffers the same problem. My system runs MacOSX 10.10.4, and I use the version of pdfLaTeX that comes with MacTeX2015. – Mico Jul 29 '15 at 11:04
  • Yup, same here. – JPi Jul 30 '15 at 2:44
4

Don't know exactly why this fixes the problem, but it seems to. ;-)

\documentclass{article}


\usepackage{mtpro2}
\usepackage{mathtools}

\newcommand{\SQRTFIX}[2][ ]{{\hphantom{\scriptscriptstyle{#1}}}\SQRT[\mathllap{#1}]{#2}}


\begin{document}

\[ \sqrt[100]{1000000} = 1000 \quad \sqrt[3]{1000000} = 100 \]

\[
 \SQRT[100]{1000000}  = 1000  \quad \SQRT[3]{1000000} = 100 
\]

\[
 \SQRTFIX[100]{1000000} =1000 \quad \SQRTFIX[3]{1000000} = 100 
 \]
\end{document}

enter image description here

The second image simply shows in the yellow box what the original $\SQRT$ does and in the blue box what $\SQRTFIX$ does.

enter image description here

  • 1
    Good eyesight! Thanks to you, I was able to track down the bug in the mtpro2 package. – Ruixi Zhang Mar 13 at 3:04
5

Thanks to @JPi’s amazing eyesight, I was able to track down exactly the bug in the mtpro2 package. All credits goes to him/her.

@JPi’s solution suggests that the offsetting space is somehow the width of the root index. I confirm this is the case. The root index is placed inside a box called \rootbox. Here is how LaTeX defines its placement:

% From ltmath.dtx:
\def\r@@t#1#2{%
  \setbox\z@\hbox{$\m@th#1\sqrtsign{#2}$}%
  \dimen@\ht\z@ \advance\dimen@-\dp\z@
  \mkern5mu\raise.6\dimen@\copy\rootbox
  \mkern-10mu\box\z@}

which is the default, while mtpro2 does some similar things like:

% From mtpro2.dtx or mtpro2.sty
\def\R@@T#1#2{\setbox\z@\hbox{$\UPROOT@\z@\LEFTROOT@\z@\m@th#1\SQR@@T{#2}$}%
\dimen@\ht\z@\advance\dimen@-\dp\z@
\dimen@ii\dimen@
\setbox\tw@\hbox{$\m@th#1\mskip\UPROOT@ mu$}\advance\dimen@ii by1.667\wd\tw@
\setbox\tw@\hbox{$\m@th#1\mskip10mu$}%
\ifcase\SQcount@\advance\dimen@3\wd\tw@\or\advance\dimen@1.5\wd\tw@\or
\advance\dimen@\wd\tw@\fi
\mkern1mu\kern.13\dimen@\mkern-\LEFTROOT@ mu
\raise.5\dimen@ii\copy\rootbox % was .44
\mkern-1mu\kern-.13\dimen@\mkern\LEFTROOT@ mu\box\z@\kern-\wd\rootbox
\LEFTROOT\z@\UPROOT\z@}

Focusing on the overall structures, we see immediately that \R@@T has additional code of \kern-\wd\rootbox, which IMHO is utterly wrong. So here is my fix:

\documentclass{article}
\usepackage{newtxtext}
\usepackage{mtpro2}% lite or complete, does not matter here

\usepackage{etoolbox}
\makeatletter
\patchcmd\R@@T
  {\kern-\wd\rootbox} % search this within \R@@T
  {} % replace it with nothing
  {}{}
\makeatother

\begin{document}
\[ \sqrt[100]{1000000} = 1000 \quad \sqrt[3]{1000000} = 100 \]
\[ \SQRT[100]{1000000} = 1000 \quad \SQRT[3]{1000000} = 100 \]
\end{document}

sqrt

Note: \sqrt and \SQRT, by design, will produce slightly different results (as seen in the above picture). \SQRT is supposed to be used for really large formulae (hence the awkward root index placement). Please refrain from using \SQRT for small formulae.

  • Wow! Thanks for doing this! – JPi Mar 13 at 11:47
  • 1
    @JPi You are welcome! I have been investigating my complete font set for almost two months now. It all started with me trying to scale MathTime (see also Scaling the mtpro2 fonts to work with Baskerville). So far, I have found 13+ errors in the LaTeX support package… – Ruixi Zhang Mar 13 at 20:15
  • 1
    I made a list of the 13+ bugs in a developing file mtpro2-patch.tex (Warning: Repository is mostly Chinese, but this file is in English). It is, for the most part, for my personal use. So the instructions inside were telling you to modify mtpro2.sty directly for yourself. However, the fixes for \undercbrace and \overcbrace (among other things) were deemed too complicated so I provided new definitions. – Ruixi Zhang Mar 13 at 20:25

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.