Bad neighbours: amscd and mtpro2
The problem clearly is in the subscript: mtpro2
makes _
math active and its expansion throws in a redefinition of the scratch macro \next
, which CD
expects not to change.
Whose fault is it? This question has no answer, I'm afraid. Possibly the most culpable is CD
, where \next
is used in a dubious way, assuming its meaning will not change for a long span of time. However, it's quite late for changing it.
A simple workaround would be protecting the entry by braces.
\begin{CD}
{H_{R}(U)} @>d >> B
\end{CD}
The issue can also be fixed on the mtpro2
side using a different command name than \next
in a crucial macro.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amscd}
\usepackage[subscriptcorrection,lite]{mtpro2}
\makeatletter
\begingroup\lccode`~=`_
\lowercase{\endgroup\def~}{\futurelet\next@@@\s@@b}
\def\s@@b{\ifcat\relax\noexpand\next@@@\expandafter\sb\else
\expandafter\s@@b@\fi}
\makeatother
\begin{document}
\[
\begin{CD}
H_{A}(U) @>d >> B
\end{CD}
\]
\[
\disablesubscriptcorrection
\begin{CD}
H_{A}(U) @>d >> B
\end{CD}
\]
\end{document}
I added the version with \disablesubscriptcorrection
to show that the correction is indeed done as expected in the first diagram.
There are much better packages for diagrams, which won't suffer from this problem.
Just by way of example, here's a diagram impossible to draw with CD
; it sports the subscript correction and also arrow matching those of mtpro2
.
\documentclass{article}
\usepackage{amsmath}
\usepackage[subscriptcorrection,lite]{mtpro2}
\usepackage{tikz-cd}
\tikzcdset{arrow style=math font}
\begin{document}
\[
\begin{tikzcd}
H_{A}(U) \arrow[r,"d"] \arrow[dr,"\varphi"] &
B \arrow[d]
\\
& C
\end{tikzcd}
\]
\end{document}