# Bad interaction between neighbor packages - xy, polyglossia, biblatex, mtpro2

I have a small file:

\documentclass{report}

\usepackage[subscriptcorrection]{mtpro2}
\RequirePackage{polyglossia} \setmainlanguage{english}
\usepackage{biblatex}
\usepackage[all,2cell]{xy} \UseAllTwocells \SilentMatrices

\begin{document}

$\xymatrix@R=3.5pc @C=5.5pc{ A \ar[d]_{\beta_{i}} \ar[r] & B \ar[d]\\ C \ar[r] & D }$

\end{document}


that produces a wrong diagram, the beta_i is stuck with the A instead of in the middle of the arrow

... and amazingly ...

1. Commenting polyglossia fixes the label
2. Commenting biblatex also fixes the label
3. Commenting mtpro2 also fixes the label

What is incorrect on the interaction between these packages?

Processing is with xelatex from TL 2017.

• Can you check if \usepackage[subscriptcorrection]{mtpro2} is relevant to the problem? I don't have the package (I think it ships with a commercial? font). Sep 26 '17 at 16:10
• There is a free version of the fonts and the package at pctex.com. And yes, all pieces here are integral to the example. What you are seeing is an MWE. Any piece that gets cut-off will make it work. Sep 26 '17 at 16:14

If you load mtpro2 with subscriptcorrection or use \enablesubscriptcorrection, the catregory code of _ is set to 12 ('normally' it is 8).

If you load biblatex and polyglossia, biblatex executes some code (in \AtEndPreamble) to find out which languages were loaded. polyglossia sets the category code of _ to 11, so temporarily biblatex does the same, it changes the code back to 8 (the normal default) at the end.

\gdef\blx@mkautolangpoly{%
...
\catcode\_=11% polyglossia uses "_" as a letter
...
\catcode\_=8}


But in your document the catcode needs to be 12. With

\AtBeginDocument{\enablesubscriptcorrection}


things should work again.

Since biblatex should not make any assumptions about the category code of _ I have filed a bug report https://github.com/plk/biblatex/issues/629

• thanks for the clear answer. What about the other packages: polyglossia, xy and mtpro2 -- should they play in this way with the cat code of "_" ? Sep 27 '17 at 14:27
• @PauloNey If done correctly there is no harm in changing the catcode of _. It can be necessary in some situations to change the catcode of special characters to make them behave as expected. I would avoid changing catcodes if at all possible, but that is only because I'm no expect in these matters. Sep 27 '17 at 15:11