2

I am trying to use custom counters in the titles of several sections, but I am not talking about the numbering system Latex uses for sections, that's ok. I just want to use a counter in the title.

Better explained with an example:

2.1.2. Title 1
2.1.3. Title 2
2.1.4. Title 3

I just want those 1, 2 and 3 after Title to be a variable I can increment. I have tried using \newcounter and \stepcounter but I must have been using them wrong because they did nothing.

This is what I tried:

\newcounter{ntitle}
\subsection{Title \value{ntitle}}

\stepcounter{ntitle}
...
dabadaba
  • 263

1 Answers1

2

\value{<cntr>} is an internal presentation of a counter and typically used in calculations, not presentation. For that, you may want to use \the<cntr> or redefine \the<cntr> to suit your needs (using \alph, \Alph, \roman, \Roman, ...).

Here's an example:

enter image description here

\documentclass{article}

\newcounter{ntitle}% Counter
\renewcommand{\thentitle}{\alph{ntitle}}% Counter representation

\begin{document}

\tableofcontents

\setcounter{ntitle}{3}% Start value

\section{Title \thentitle}

\stepcounter{ntitle}% Next value

\section{Title \thentitle}

\stepcounter{ntitle}% Next value

\section{Title \thentitle}

\end{document}
Werner
  • 603,163