我快被这个错误搞疯了:
Bad math environment delimiter. \end{equation}
You can't use `\eqno' in restricted horizontal mode. \end{equation}
以下的MWE
:
\documentclass[border=1 pt]{standalone}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[row sep=huge, column sep=huge]
\textbf{B} \arrow[r,"M"] & \text{Y}\\
\textbf{X} \arrow[r,swap,"M"] \arrow[u,"project"] & \text{A} \arrow[u,"project", swap]
\end{tikzcd}
\begin{equation}
project \circ M = M \circ project
\end{equation}
\end{document}
答案1
解决方案在这里:如何用一个方程式制作独立文档?
解释:standalone
文档类别没有章节或结构,不知道要使用哪个公式编号。该preview
选项允许章节和公式编号。
另一种解决方案是在 tikzpicture 中使用自定义居中内联数学和自定义数字。
\documentclass[border=1pt,preview]{standalone} % <- Added "preview" option
\usepackage{amsmath} % for \text macro
\usepackage{mathrsfs}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[row sep=huge, column sep=huge]
\textbf{B} \arrow[r,"M"] & \text{Y}\\
\textbf{X} \arrow[r,swap,"M"] \arrow[u,"\text{project}"]
& \text{A} \arrow[u,"\text{project}", swap]
\end{tikzcd}
\begin{equation}
\text{project} \circ M = M \circ \text{project} \tag{5.1} %<-If you dont want "(1)"
\end{equation}
\end{document}