3

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

enter image description here

... and amazingly ...

  1. Commenting polyglossia fixes the label
  2. Commenting biblatex also fixes the label
  3. Commenting mtpro2 also fixes the label
  4. Loading xy ahead of everything else also fixes it

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). – moewe 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. – Paulo Ney Sep 26 '17 at 16:14
4

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 "_" ? – Paulo Ney 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. – moewe Sep 27 '17 at 15:11

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.