! tikz-cd 图中 \language@active@arg" 的参数有一个额外的 }

! tikz-cd 图中 \language@active@arg" 的参数有一个额外的 }

我正在尝试将之前在 Obsidian 中绘制的 tikz-cd 图表插入到我的 TeX 文档中。包含该图表的代码是:

\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*}

我收到以下错误:

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?

我的序言:

\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}{Определение}

在谷歌上搜索这个错误时,我遇到了一个回答建议找一些符号的替代品。但是,我不知道如何在 tikz-cd 图中"替换。"

PS 这是我第一次在 TeX 文档中使用 tikz-cd,而不是在 Obsidian 环境中,因此在使用 tikz-cd 时也可能出现错误。

答案1

您想加载 TiZ 库babel

顺便说一句,times已经过时了,而且当涉及到西里尔字母时,它实际上什么也不做。该包tempora支持 Times 式的西里尔字体;我还加载了newtxmathTimes 式的数学符号。

也是\text{id}错误的,应该是\mathrm{id}

更改包加载顺序:hyperref应为最后。无需cmapinputenc

\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}

在此处输入图片描述

相关内容