5

I need to make some fairly complicated commutative diagrams for a math paper, but for some reason, my installation of TeXShop is having trouble rendering even a simple diagram. Here is a minimal working example for the bad behavior:

\documentclass{gtpart}


\usepackage{tikz-cd}


\begin{document}

Examples from the \{tikzcd\} manual, section 1.2.

Example 1:

\begin{tikzcd}
A \arrow[rd] \arrow[r, "\phi"] & B \\
& C
\end{tikzcd}

Example 2: 

\begin{tikzcd}
A \arrow[r, "\phi"] \arrow[d, red]
& B \arrow[d, "\psi" red] \\
C \arrow[r, red, "\eta" blue]
& D
\end{tikzcd}

Example 4:

\begin{tikzcd}
T
\arrow[drr, bend left, "x"]
\arrow[ddr, bend right, "y"]
\arrow[dr, dotted, "{(x,y)}" description] & & \\
& X \times_Z Y \arrow[r, "p"] \arrow[d, "q"]
& X \arrow[d, "f"] \\
& Y \arrow[r, "g"]
& Z
\end{tikzcd}

\end{document}

And here is the output in the PDF document:

enter image description here

As you can see, this is hardly what I'd like to have appear in the paper, and for more complex diagrams it just gets worse! I have uninstalled all LaTeX distributions and reinstalled MacTeX twice (all 4.6GB of it), and I still get this type of rendering. I'm running a MacBook Pro on OS X 10.7.5. Anyone know what might be going on here? Let me know what else I can provide for someone to help me out! I'd really love to have tikz-cd working since it seems to be a great package for complex commutative diagrams.

NOTES: After creating the minimal working example, it appears this issue is a conflict with the tag \documentclass{gtpart}; when I use \documentclass{article}, the diagrams render properly. Here is a link to the gtpart.cls file.

Thanks to everyone who takes a look at this!

2
  • Welcome to TEX.SX! Could you provide a minimal working example (MWE), starting with \documentclass{...} and ending with \end{document}?
    – Pier Paolo
    Dec 12, 2014 at 21:21
  • @PierPaolo - Thanks, this helped to narrow down the issue! Looks like it's a conflict with the gtpart.cls document class. See notes in the body of the question.
    – Rachel
    Dec 12, 2014 at 21:44

1 Answer 1

7

The primitive TeX parameter mathsurround is almost never changed, and tikz-cd clearly isn't expecting it to change but that class sets it to .8pt Setting it back to 0 seems simplest. (You could do it locally just around the tikz-cd)

\documentclass{gtpart}


\usepackage{tikz-cd}

\setlength\mathsurround{0pt}%<<<<<<<<<<<<<<<<<<<<<<<<


\begin{document}

Examples from the \{tikzcd\} manual, section 1.2.

Example 1:

\begin{tikzcd}
A \arrow[rd] \arrow[r, "\phi"] & B \\
& C
\end{tikzcd}

Example 2: 

\begin{tikzcd}
A \arrow[r, "\phi"] \arrow[d, red]
& B \arrow[d, "\psi" red] \\
C \arrow[r, red, "\eta" blue]
& D
\end{tikzcd}

Example 4:

\begin{tikzcd}
T
\arrow[drr, bend left, "x"]
\arrow[ddr, bend right, "y"]
\arrow[dr, dotted, "{(x,y)}" description] & & \\
& X \times_Z Y \arrow[r, "p"] \arrow[d, "q"]
& X \arrow[d, "f"] \\
& Y \arrow[r, "g"]
& Z
\end{tikzcd}

\end{document}
5
  • This worked! I'll try it as a global change and use it locally if it causes problems elsewhere in the paper. Thank you!
    – Rachel
    Dec 12, 2014 at 21:58
  • @Rachel the intent of the parameter is a stylistic choice if you have inline math blalh blah let $p=2$ blah blah then the class is trying to put an extra .8pt either side of the math, Dec 12, 2014 at 22:01
  • 1
    @Rachel You should make the author of tikz-cd aware of this. Probably just adding \m@th to the start code of the tikz-cd environment suffices.
    – egreg
    Dec 12, 2014 at 22:01
  • @DavidCarlisle, I ended up having to put it around each tikzcd diagram locally, since the body of the paper really does read better with the extra padding.
    – Rachel
    Dec 13, 2014 at 14:56
  • @florêncio-neves - It looks like the {tikz-cd} package conflicts with the geometry/topology document class gtpart. Was brought to my attention that you might like to be made aware of this issue. It would be great if {tikzcd} could render nicely without locally setting {mathsurround} to zero. Thank you for a great package!
    – Rachel
    Dec 13, 2014 at 23:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .