1

I am trying to insert a tikz-cd diagram which I have previously drawn in Obsidian into my TeX document. The code including the diagram is:

\begin{equation*}
    \begin{tikzcd}[scale=3]
        \mathcal{A} \otimes \mathcal{A} \otimes \mathcal{A} 
            \arrow[r, "\nabla \otimes \text{id}"] 
            \arrow[d, "\text{id} \otimes \nabla"] &
        \mathcal{A} \otimes \mathcal{A} \arrow[d, "\nabla"] \\      
        \mathcal{A} \otimes \mathcal{A} \arrow[r, "\nabla"] &
        \mathcal{A} 
    \end{tikzcd}
\end{equation*}

I get the following error:

Argument of \language@active@arg" has an extra }.
<inserted text>
\par
l.100 \end{tikzcd}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?

My preamble:

\documentclass[a4paper,12pt]{article}

\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel} \usepackage{framed} \usepackage{hyperref} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \usepackage{graphicx} \usepackage[colorinlistoftodos]{todonotes} \usepackage{wrapfig} \usepackage{lipsum} \usepackage{listings} \usepackage{color} \usepackage{indentfirst} \usepackage{times} \usepackage{textcomp} \usepackage{tikz-cd}

\definecolor{mygray}{rgb}{0.4,0.4,0.4} \definecolor{mygreen}{rgb}{0,0.8,0.6} \definecolor{myorange}{rgb}{1.0,0.4,0}

\lstdefinestyle{customc}{ belowcaptionskip=1\baselineskip, breaklines=true, frame=L, xleftmargin=\parindent, language=C, showstringspaces=false, basicstyle=\footnotesize\ttfamily, keywordstyle=\bfseries\color{green!40!black}, commentstyle=\itshape\color{purple!40!black}, identifierstyle=\color{blue}, stringstyle=\color{orange}, numbers=left, numbersep=12pt, numberstyle=\small\color{mygray}, } \lstset{escapechar=@,style=customc}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\theoremstyle{definition} \newtheorem{definition}{Определение}

Googling this error, I've come across an answer recommending finding some substitute for the " symbol. However, I have no idea how am I supposed to substitute " in a tikz-cd diagram.

P.S. This is my first time using tikz-cd in a TeX document, and not inside the Obsidian environment, so errors in my use of tikz-cd are also possible.

1 Answers1

1

You want to load the TikZ library babel.

By the way, times is obsolete and actually does nothing at all when Cyrillic is involved. The package tempora has support of a Times-like Cyrillic font; I also load newtxmath for Times-like math symbols.

Also \text{id} is wrong and should be \mathrm{id}.

Change the order of package loading: hyperref should be last. No need for either cmap or inputenc.

\documentclass[a4paper,12pt]{article}

%\usepackage{cmap} %\usepackage[utf8]{inputenc} \usepackage[english,russian]{babel} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amssymb} \usepackage{graphicx} \usepackage[colorinlistoftodos]{todonotes} \usepackage{wrapfig} \usepackage{lipsum} \usepackage{listings} \usepackage{color} \usepackage{indentfirst} \usepackage{tempora} \usepackage{newtxmath} \usepackage{textcomp} \usepackage{tikz-cd} \usetikzlibrary{babel} \usepackage{framed} \usepackage{hyperref}

\definecolor{mygray}{rgb}{0.4,0.4,0.4} \definecolor{mygreen}{rgb}{0,0.8,0.6} \definecolor{myorange}{rgb}{1.0,0.4,0}

\lstdefinestyle{customc}{ belowcaptionskip=1\baselineskip, breaklines=true, frame=L, xleftmargin=\parindent, language=C, showstringspaces=false, basicstyle=\footnotesize\ttfamily, keywordstyle=\bfseries\color{green!40!black}, commentstyle=\itshape\color{purple!40!black}, identifierstyle=\color{blue}, stringstyle=\color{orange}, numbers=left, numbersep=12pt, numberstyle=\small\color{mygray}, } \lstset{escapechar=@,style=customc}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}

\theoremstyle{definition} \newtheorem{definition}{Определение}

\begin{document}

\begin{equation} \begin{tikzcd}[scale=3] \mathcal{A} \otimes \mathcal{A} \otimes \mathcal{A} \arrow[r, "\nabla \otimes \mathrm{id}"] \arrow[d, "\mathrm{id} \otimes \nabla"] & \mathcal{A} \otimes \mathcal{A} \arrow[d, "\nabla"] \
\mathcal{A} \otimes \mathcal{A} \arrow[r, "\nabla"] & \mathcal{A} \end{tikzcd} \end{equation
}

\end{document}

enter image description here

egreg
  • 1,121,712