1

The following code

\documentclass[a4paper]{report}

\usepackage[english, russian]{babel} % if I comment this line, the snippet works

\usepackage{tikz-cd}
\usetikzlibrary{babel}

\newcommand{\bullets}[1]{\begin{itemize}#1\end{itemize}}

\begin{document}
    \bullets{
        \item
        \[\begin{tikzcd}[ampersand replacement=\&]
              A \& B \\
              \arrow["\phi", from=1-1, to=1-2]
        \end{tikzcd}\]
    }
\end{document}

produces strange error Package xcolor Error: Undefined color `"\phi {\@@par }'., Argument of \@secondoffive has an extra }., Paragraph ended before \@secondoffive was complete. and so on.

However, it has to do something with macros bullets, and/or with \usepackage[english, russian]{babel} — if I comment that line, it works fine. The following snippet also compiles correctly — in case the tikzcd isn't placed inside macros, or the arrow isn't named:

\documentclass[a4paper]{report}

\usepackage[english, russian]{babel}

\usepackage{tikz-cd}
\usetikzlibrary{babel}

\newcommand{\bullets}[1]{\begin{itemize}#1\end{itemize}}

\begin{document}
    \bullets{
        \item
        \[\begin{tikzcd}[ampersand replacement=\&]
              A \& B \\
              \arrow[from=1-1, to=1-2]
        \end{tikzcd}\]
    }
    \[\begin{tikzcd}[ampersand replacement=\&]
          A \& B \\
          \arrow["\phi", from=1-1, to=1-2]
    \end{tikzcd}\]
\end{document}

I understand that I can replace everywhere bullets with begin{itemize}...\end{itemize} and not to use tikzcd in any type of macros, but I am kinda got used to them, so is there a way to make the first code version to compile?

I use pdfLaTex and Tex Live on Ubuntu.

2
  • I suppose that this is relevant. Apr 23, 2023 at 12:38
  • @JoséCarlosSantos, thank you! I believe it answers my question, so I marked it as a duplicate. Apr 23, 2023 at 12:58

0

Browse other questions tagged .