这是我的代码。
\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usepackage{enumitem}
\usepackage{amsmath}
\newcounter{theorem}[section]
\renewcommand\thetheorem{\thesection.\arabic{theorem}}
\newcommand\theorem{\refstepcounter{theorem}Theorem \thetheorem}
\newcounter{proof}[theorem]
\renewcommand\theproof{\arabic{proof} (\thetheorem)}
\newcommand\proof{\refstepcounter{proof}Proof \theproof}
\newcounter{figurec}[section]
\renewcommand\thefigurec{\thesection.\arabic{figurec}}
\newcommand\figurec{\refstepcounter{figurec}Figure \thefigurec}
\begin{document}
\section{New Section}
\begin{enumerate}[label=,leftmargin=0cm]
\item \theorem
Stuff ...
\item \proof
\[ \begin{tikzpicture}
\node at (2.25,-1.5){\figurec\label{lab2}};
\end{tikzpicture} \]
Stuff ... Figure \ref{lab2}.
\end{enumerate}
\end{document}
编译后显示:
如果我注释掉 amsmath 我会得到:
由于某种原因,amsmath 弄乱了我在 tikzpicture 中的标签。我需要一种方法来解决这个问题,因为我经常同时使用这两个软件包。谢谢!
答案1
感谢https://tex.stackexchange.com/users/121799/marmot。
只需更换
\[ ... \]
和
\begin{center} ... \end{center}