I have to type a lot of questions, but only every 4th (4,8,12,...), so I was wondering if I can get Latex to number the items automatically. I know I can change each item numbering manually, but I'd like the counter to increase by 4s automatically.

I have no idea where to start, a google search just showed the properties I was already familiar with (arabic, add a label, alph), but nothing referring to a step size. It might be called something different, so I don't know which parameter to set (if any).

up vote 8 down vote accepted

You can create a new command that does the trick with everything you know about counters ;)

\documentclass{article}

\newcommand{\myitem}{\addtocounter{enumi}{3}\item}

\begin{document}
\begin{enumerate}
  \myitem One
  \myitem Two
  \myitem \dots
\end{enumerate}
\end{document}

result

You could create a new command with a step size as argument as well:

\newcommand{\myitem}[1]{\addtocounter{enumi}{\numexpr#1-1\relax}\item}

Or "set a step size" in the beginning:

\documentclass{article}

\let\olditem\item
\newcommand{\myitem}[1]{\addtocounter{enumi}{\numexpr#1-1\relax}\olditem}
\newcommand{\setenumstep}[1]{%
  \renewcommand{\item}{\myitem#1}
}

\begin{document}
\begin{enumerate}
  \myitem4 One
  \myitem4 Two
  \myitem4 \dots
\end{enumerate}

\begin{enumerate}
  \setenumstep{4}
  \item One
  \item Two
  \item \dots
\end{enumerate}
\end{document}

These enumerations both result in the same as the first one posted.

Probably you know it already, but might be helpful anyway: If you want to tweak single items, you can do it manually with

\item[4.] One
\item[8.] Two

If you're not concerned about \labeling the \items, you can use the following setup:

enter image description here

\documentclass{article}

\usepackage{enumitem,etoolbox,xfp}

\newlist{fourenumerate}{enumerate}{4}
\setlist[fourenumerate]{label = {\mulfour{\value*}.}}

\newrobustcmd{\mulfour}[1]{\inteval{#1 * 4}}

\begin{document}

\begin{enumerate}
  \item One
  \item Two
  \item \ldots
\end{enumerate}

\begin{fourenumerate}
  \item One
  \item Two
  \item \ldots
\end{fourenumerate}

\end{document}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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