1

The following example gives me an error

\documentclass[12pt,oneside]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage[a4paper,
            inner=10mm,
            outer=60mm,
            top=20mm,
            bottom=25mm,
            marginparsep=10mm,
            marginparwidth=40mm]{geometry}

\usepackage{tikz}
\usepackage{tikz-cd}

\begin{document}

foo
\marginpar{
\begin{tikzcd}
    E 
        \arrow[bend right=50]{rr}[,label=below:\scriptsize $g\circ f$]{}
        \arrow[r]{}[,label=above:\scriptsize $f$]{}
    & F
        \arrow[r]{}[,label=above:\scriptsize $g$]{}
    & G
\end{tikzcd}
}
bar

\end{document}

while the commutative diagramm is compiling correctly when it's not in the margin.

Error is :

! Undefined control sequence. \pgf@matrix@last@nextcell@options ! Package pgf Error: Single ampersand used with wrong catcode.

2

This is a wellknown issue, when it is dealing with & used inside an argument, things go wrong (presumably catcodes). Solution use this:

\marginpar{
\begin{tikzcd}[ampersand replacement=\&]
    E 
        \arrow[bend right=50]{rr}[,label=below:\scriptsize $g\circ f$]{}
        \arrow[r]{}[,label=above:\scriptsize $f$]{}
    \& F
        \arrow[r]{}[,label=above:\scriptsize $g$]{}
    \& G
\end{tikzcd}
}

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.