# amsmath messing up labels inside tikzpicture

Here is my code.

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


Compiling it shows:

If I comment out amsmath I get:

For some reason, having amsmath messes up my labeling inside tikzpicture. I need a way of resolving this issue as I use both packages extensively together. Thanks!

• Looks like the behavior is triggered by the enclosing $ and $, if you leave them out you're back at the desired behavior. Perhaps that's the simplest way to go. – user121799 Jul 20 '18 at 15:27
• Ah. Strange. Thank you! I replaced them with \begin{center}, \end{center} and now it works perfectly. – Chung Ren Khoo Jul 20 '18 at 15:32

$...$

\begin{center} ... \end{center}