[Tex/LaTex] Fractional increment for enumerate

#enumeratelists

I am looking to create a numbered list such that the numbers of the list items be incremented by fractional amounts as in 1.1, 1.2, 1.3… etc.

Can this be done by manipulating the enumerate counter?

Best Answer

Depending on the usage, enumitem allows to specify a label (and ref) option to enumerate. Here is a minimal example that steps some counter (mycount) at the start of every enumerate, and prints that counter in "fractional amounts":

enter image description here

\documentclass{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\newcounter{mycount} \renewcommand{\themycount}{\arabic{mycount}}%
\AtBeginEnvironment{enumerate}{\stepcounter{mycount}}% Increment mycount at \begin{enumerate}
\setlist[enumerate]{label=\themycount.\arabic*,ref=\themycount.\arabic*}
\begin{document}
\noindent Here is some text.
\begin{enumerate}
  \item An item
  \item Another item
  \item Yet another item
\end{enumerate}
Here is some more text.
\begin{enumerate}
  \item An item
  \item Another item
  \item Yet another item
\end{enumerate}
\end{document}

etoolbox provides the means to "tap into" the start of enumerate and update the mycount counter and every instance.

label refers to how the enumeration label will be typeset, while ref refers to how it will be referenced from within the document (if you're using \label and \ref). The settings for enumerate are made global (via \setlist[enumerate]{...}), although it could also be localized to a particular enumerate environment via an option argument:

\begin{enumerate}[label=.., ...]

If you're interested in labelling lists via some other counter (like section, or subsection, for instance), this is easily modifiable.

Related Question