Consider the following MWE:
Code: Select all
\documentclass{article}
\usepackage{mathtools}
\usepackage{xparse}
\usepackage{upgreek}
\makeatletter
\def\resetMathstrut@{%
\setbox\z@\hbox{%
\mathchardef\@tempa\mathcode`\[\relax
\def\@tempb##1"##2##3{\the\textfont"##3\char"}%
\expandafter\@tempb\meaning\@tempa \relax
}%
\ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@}
\makeatother
\begingroup
\catcode`(\active \xdef({\left\string(}
\catcode`)\active \xdef){\right\string)}
\endgroup
\mathcode`(="8000 \mathcode`)="8000
\NewDocumentCommand\test{mmgg}
{%
{\mkern -#1mu}#2%
\IfNoValueF{#3}{^}%
{\mkern -\IfNoValueTF{#3}{#1}{#3}mu \IfNoValueF{#4}{#4}}%
}
\begin{document}
\begin{equation}
\sin\test{6}{(\tfrac{3}{5}\uppi)} + k
\end{equation}
\end{document}
As can be seen, the spacing between `)' and `+' is too small. If possible, how do I fix this automatically within the \NewDocumentCommand command?
Thank you in advance!
Update:
If I add a ``{3}'' as a third argument , the spacing is more or less fine; i.e.,
Code: Select all
\sin\test{6}{(\tfrac{3}{5}\uppi)}{3} + k
Update 2:
The command
[color=#800000]\tfrac[/color]
is unnecessary. A look atCode: Select all
\sin\test{6}{(\uppi)} + k