1

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:

enter image description here

If I comment out amsmath I get:

enter image description here

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!

  • 1
    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
0

Figured it out thanks to https://tex.stackexchange.com/users/121799/marmot.

Just had to replace

\[ ... \]

with

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.