# misdirected xymatrix arrow heads with certain fonts

I'd like to use $\mathsf{C}$ rather than $\mathcal{C}$ for categories. However, when I use the former in the first displayed equation, the top arrowhead (the arrow labelled L) points northwest, rather than southwest, as you'd expect. In the second displayed equation, with the wrong font, this arrow points in the correct direction. If I unload all the packages except xy, the problem disappears.

Any idea what's going on?

\documentclass{amsbook}
\usepackage{amsfonts, amsmath, amssymb}
\usepackage{stmaryrd}
\usepackage{txfonts}
\usepackage{comment}
\usepackage{enumitem}
\usepackage{epigraph}
\usepackage{dialogue}
\usepackage{xcolor}
\usepackage{graphicx}

\usepackage{amsmidx}%for the index
\makeindex{idx}
\makeindex{nidx}%index of notation
\makeindex{cidx}%index of categories
\newcommand{\idx}{\index{idx}}
\newcommand{\nidx}{\index{nidx}}
\newcommand{\cidx}{\index{cidx}}

\usepackage[all,pdftex]{xy}
\newdir{ >}{{}*!/-10pt/@{>}}

\begin{document}

$$\xymatrix{ \mathsf{C} \ar[r]|U & \mathsf{D} \ar@{->}@/_3ex/[l]_L^\perp \ar@/^3ex/[l]^R_{\perp} }$$
$$\xymatrix{ \mathcal{C} \ar[r]|U & \mathsf{D} \ar@{->}@/_3ex/[l]_L^\perp \ar@/^3ex/[l]^R_{\perp} }$$

\end{document}
• Strange issue. It seems caused by txfonts, but it doesn't show if you use \usepackage{newtxtext,newtxmath} instead of \usepackage{txfonts}. Note that the packages I recommend fix the numerous misfeatures of txfonts and are actively maintained. Nov 19, 2015 at 20:48
• @egreg: when I replace txfonts with newtxtext and newtxmath, the problem switches: the arrow is in the wrong direction for \mathcal C but correct for \mathsf C. Do you know why that might happen? Nov 19, 2015 at 21:23
• @ArunDebray I can't reproduce the issue. Nov 19, 2015 at 21:25
• That's very strange; in any case, the problem goes away if I switch to a different font's \mathcal, e.g. by calling \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}, or by adding a small amount of space (about 0.5ex) after the \mathcal C. Nov 19, 2015 at 21:36

I can reproduce the issue with this minimal example:

\documentclass{amsbook}
\usepackage{txfonts}
\usepackage[all]{xy}
\newdir{ >}{{}*!/-10pt/@{>}}

\begin{document}

$\xymatrix{ \mathsf{C} \ar[r]|U & \mathsf{D} \ar@{->}@/_3ex/[l]_L^\perp \ar@/^3ex/[l]^R_{\perp} }$

$\xymatrix{ \mathcal{C} \ar[r]|U & \mathcal{D} \ar@{->}@/_3ex/[l]_L^\perp \ar@/^3ex/[l]^R_{\perp} }$

\end{document}

Note that you shouldn't pass the pdftex option (but it's not relevant to the issue).

If I change \usepackage{txfonts} into \usepackage{newtxtext,newtxmath}, the problem disappears:

The NewTX fonts are an edited version of TXfonts, fixing the (many) misfeatures of the latter, especially with regards to spacing.

You might want to look at tikz-cd (it works also with txfonts, but I don't recommend it).

\documentclass{amsbook}
\usepackage{newtxtext,newtxmath}
\usepackage{tikz-cd}

\begin{document}

$\begin{tikzcd}[column sep=3em] \mathsf{C} \arrow[r,"U" description] & \mathsf{D} \arrow[l,bend right=50,"\perp","L" swap] \arrow[l,bend left=50,"R","\perp" swap] \end{tikzcd}$

\end{document}

• Wonderful! The {newtxtext,newtxmath} packages, which I hadn't heard of, fix my problem. Thank you! Nov 19, 2015 at 22:59