2

I have an enumerate environment

\begin{enumerate}[font={\bfseries}, label={\arabic*}, wide=0pt, labelindent=1em, leftmargin=*]
    \item
\end{enumerate}

where \arabic counts in steps of 1 (1, 2, 3, 4 etc) I know, I could just put a 0 behind \arabic*, but I would like to know if there is any functionality to change the counter steps of enumerate

  • You're going to have to perform a calculation anyway, so whether you "hack it" by adding a 0, or perform the calculation, it's probably the same. – Werner Nov 23 '17 at 20:26
  • What should it start with, 10? – Werner Nov 23 '17 at 20:28
  • how can I perform the calculation in this envoronment? I got lots of errors using \multiply and couldn't find out how to use it correctly – Marcel H. Nov 23 '17 at 20:28
  • yeah start with 10 and increment by 10 for every item – Marcel H. Nov 23 '17 at 20:29
  • 1
4

Here's a way to define counter representations for any arithmetic progression.

\documentclass{article}
\usepackage{xparse,enumitem}

\ExplSyntaxOn
\cs_new:Nn \progression_evaluate:nnn
 {% #1 = start, #2 = difference, #3 = counter name
  \int_eval:n { #1 + ( #3 - 1 ) * #2 }
 }
\cs_generate_variant:Nn \progression_evaluate:nnn { nnc }

\NewDocumentCommand{\defineprogression}{mmm}
 {% #1 = macro name, #2 = start, #3 = difference
  \cs_new:cn { __progression_\cs_to_str:N #1:n }
   {
    \progression_evaluate:nnc { #2 } { #3 } { c@##1 }
   }
  \NewExpandableDocumentCommand{#1}{m}
   {
    \use:c { __progression_\cs_to_str:N #1:n } { ##1 }
   }
  \exp_args:NNc \AddEnumerateCounter #1 { __progression_\cs_to_str:N #1:n } { 0 }
 }
\ExplSyntaxOff

\defineprogression{\bytens}{10}{10}
\defineprogression{\foo}{1}{5}

\newlist{tens}{enumerate}{1}
\setlist[tens,1]{
  label=\bytens*.,ref=\bytens*,
  font=\bfseries,
  wide=0pt,
  labelindent=1em,
  leftmargin=*
}

\begin{document}

This is numbered by tens
\begin{tens}
\item A
\item B
\item\label{C} C
\end{tens}

This is numbered like foo
\begin{enumerate}[label=\foo*.,ref=\foo*]
\item AA
\item BB
\item\label{CC} CC
\end{enumerate}

References: \ref{C} and \ref{CC}

\end{document}

enter image description here

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.