Search code examples
latexfigure

How to get \counterwithout in Latex to work?


I am trying to have my figures numbered with 1, 2, 3 and so on. But LaTeX is only numerating them with the section numbers (e.g 1.1 , 1.2 and so on) even though I used \counterwithout{figure}{section}. There is no error message. What could be the issue?

\usepackage{chngcntr}
\counterwithout{figure}{section}
\usepackage[pdfborder={0 0 0}]{hyperref}

\begin{document}

\input{chapter/01_introduction}
%the figure is in a subsection as part of the introduction

\end{document}

This is what the 01_introduction file looks like:

% !TEX root = ../root.tex
\section{Introduction}
\subsectiction{Title of the subsection}

\begin{figure}[htbp]
\begin{center}
\includegraphics[width=\textwidth]{chapter/figures/fig_bsp.png}
\captionof{figure}{caption of the figure}
\label{fig:1}
\end{center}
\end{figure}

Solution

  • While making the minimal working example I figured out my mistake: I used a template which contained: '\renewcommand{\thefigure}{\thesection.\arabic{figure}}' which prevented my numeration from beeing 1, 2, 3. Thank you for your help!