# Calculator package and Math Times Pro 2

When I try to use the calculator the mtpro2 package at the same time I get an error message. Recently I found out that this issue has something to do with the \SQRT command.

\documentclass[a4paper,11pt]{article}
\usepackage{txfontsb}
\usepackage[lite]{mtpro2}
\usepackage{calculator}
\begin{document}
$\SQRT{x}$
\end{document}


I get these messages :

Missing number, treated as zero. $\SQRT{x}$ Illegal unit of measure (pt inserted). $\SQRT{x}$ Missing = inserted for \ifdim. $\SQRT{x}$ Missing control sequence inserted. $\SQRT{x}$ –

How can I use both packages?

• Any error message in particular or just random complaints about your failure to order adequate quantities of pizza? – cfr Jul 21 '15 at 22:58
• I get these messages : Missing number, treated as zero. $\SQRT{x}$ Illegal unit of measure (pt inserted). $\SQRT{x}$ Missing = inserted for \ifdim. $\SQRT{x}$ Missing control sequence inserted. $\SQRT{x}$ – mac Jul 21 '15 at 23:00
• You could load the calculator package first, save its version of \SRQT via an instruction such as \let\CSQRT\SQRT, and then load the mtpro2 package. In the body of the document, you'd use \SQRT if you want the mtpro2 version of the macro and \CSQRT if you want the calculator version. – Mico Jul 21 '15 at 23:19

Thanks to Manuel's comment, mtpro2 apparently also defines \SQRT. Then calculator overwrites that definition since it is loaded later. Hence, when you try to use \SQRT, it is calculator's definition which is active. So, the error you get is the same as that with the following code:

\documentclass{article}
\usepackage{calculator}
\begin{document}
$\SQRT{x}$
\end{document}


This is because the calculator tries to take the square root of x but x is not a number, so it cannot take its square root.

Just in case anybody wants a demonstration:

\documentclass{article}
\usepackage{calculator}
\begin{document}
$\sqrt{x}$
\SQRT{9}{\sol}
$\sqrt{x} = \sqrt{9} = \sol$
$\SQRT{4}{\sol}\sqrt{4} = \sol$
\end{document}


To resolve the conflict, you can rename the definition from one or other package (whichever you load first). Because I can test this, I've renamed the command from calculator:

\documentclass{article}
\usepackage{calculator}
\let\calcSQRT\SQRT
\usepackage{txfontsb}
\usepackage[lite]{mtpro2}
\begin{document}
$\sqrt{x}$
\calcSQRT{9}{\sol}
$\sqrt{x} = \sqrt{9} = \sol$
$\calcSQRT{4}{\sol}\sqrt{4} = \sol$
$\SQRT{x}$
\calcSQRT{9}{\sol}
$\SQRT{x} = \SQRT{9} = \sol$
$\calcSQRT{4}{\sol}\SQRT{4} = \sol$
\end{document}


With the relevant lines commented out, the code produces output identical to that shown in the image above.

As posted, mac has confirmed that the code allows you to continue using \SQRT from Math Time Pro 2, although I'm not able to test this myself.

• The problem is that \SQRT is also a command from mtpro2 that outputs quite large slanted roots. The question is basically how to get the two commands (of course, different names are needed, may be \calcSQRT for the calculator and \SQRT for the mtpro2 one). – Manuel Jul 21 '15 at 23:13
• @Manuel Thanks. Sigh. I guess it doesn't do any checking, then? – cfr Jul 21 '15 at 23:17
• I agree. The \SQRT command exists in both packages. For small formulas i can use the \sqrt command. But what if I have to type something like $\SQRT{\frac{\frac{12345}{1234}}{\frac{12345}{123}}}$ if I want to use the mtpro2 root symbol? Can a command wih a new name be created? – mac Jul 21 '15 at 23:19
• @mac Can you try the code above with the commented lines uncommented? They can't work for me as I don't have the font package. The commented version works i.e. \calcSQRT works fine. But I don't know how mtpro2 defines \SQRT so a different approach may be needed if this one doesn't fly. (This assumes the easiest case.) – cfr Jul 21 '15 at 23:28
• @Manuel Do you want me to delete this so you can answer? I mean, obviously you can answer anyway, but you know what I mean. – cfr Jul 21 '15 at 23:30