Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
enumitem package allows for this and many more options. –  percusse Jan 10 '12 at 2:58
    
How should the numbering be when using two separated enumerate environments? –  Gonzalo Medina Jan 10 '12 at 3:00
4  
Possibly a pedantic nit-pick to some, but I'll make the following point anyway: I don't think what you're trying to achieve is "fractional numbering" of list items. Instead, I believe it should be called something like a "two-level" or "subordinated" numbering of list items. After all, if you have ten items under point "1", the tenth item is going to be numbered "1.10" rather than "2.0", right? –  Mico Jan 10 '12 at 14:18
    
@Mico Indeed. Thanks for making the point. –  Isaac Kleinman Jan 10 '12 at 19:43

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
    
do you need \refstepcounter or are you ok without it? –  cmhughes Jan 10 '12 at 3:31
    
@cmhughes: No, \refstepcounter is not needed, since enumitem ensures correct referencing via the ref label. If one had used \refstepcounter, then you could label the entire list by issuing \label{<lab>} even before the first \item. However, this wasn't requested or seemed necessary. \refstepcounter would not hurt, I agree... –  Werner Jan 10 '12 at 4:15

Here's another possible solution, which may appeal to people who like to use LaTeX's built-in functionality as much as possible.

I'm actually not perfectly sure if I've understood your question fully. Here's my interpretation of what you're looking for: you want to have separate first-level and second-level numbering systems, and the numbering of the second-level items should include the first level's counter as a "prefix". That way, if you have lots of second-level items, they'll get numbered as:

..., 1.8, 1.9, 1.10, 1.11, ... 

rather than as:

..., 1.8, 1.9, 2.0, 2.1, ...

Here's the MWE:

\documentclass{article}
\renewcommand\theenumii{\theenumi.\arabic{enumii}}
\renewcommand\labelenumii{\theenumii} % LaTeX's default: "(\theenumii)"
\makeatletter
\renewcommand\p@enumii{} % eliminate the default "prefix label", \theenumi
\makeatother
\begin{document}
\begin{enumerate}
\item First first-level item
  \begin{enumerate}
  \item A second-level item
  \item Another second-level item \label{enum:x}
  \end{enumerate}
\item Second first-level item \label{enum:y}
\end{enumerate}

\noindent
Here's a cross-reference to enumerated item \ref{enum:x},\\ 
and here's one to enumerated item \ref{enum:y}.
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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