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'm experimenting with enumitem version 3.4 (released Aug 2011) a little but facing a problem in customizing the ref.

What I'm trying to reach is simple: Have list label in the form 1.1.3. for example. This is easy using the label* key. However, I don't want the references to take the same form as the label. This is because the dot (.) at the end is inconvenient to appear in the middle of a sentence.

So I defined the list as follows:

\newlist{procedureflow}{enumerate}{2}
\setlist[procedureflow,1]{label*=\color{blue!80!black}\arabic*.,ref=\arabic*}
\setlist[procedureflow,2]{label*=\color{green!80!black}\arabic*.,ref=\arabic{enumi}.\arabic*}

The problem with the above code is that the part ref=\arabic{enumi}.\arabic* evaluates using the current value of enumi which of course has nothing to do with the list that is yet to come later in the source file :(

Here is the code in which the list is created:

\begin{procedureflow}
    \item First
    \item Second
    \begin{procedureflow}
         \item First First
         \item Second Second\label{mylabel}
    \end{procedureflow}
\end{procedureflow}
Here is a cross reference: \ref{mylabel}

There are similar examples in the user guide of enumitem (chapter 5, page 9), so I wonder how could I use the ref key to have the reference displayed as 1.1.3 (i.e. without a dot at the end)? (I feel something is not right in enumitem in that regard! At least the example seems not useful to me)

share|improve this question
    
The problem might be different from what I thought; it seems that enumi is not used in my list (procedureflow). Probably I need to define a corresponding counter? Rechecking user guide... –  John Kirollos Aug 27 '11 at 19:21
    
YES! The "enumi" counter is not used in my newly defined procedureflow! So how to customize its ref?? –  John Kirollos Aug 27 '11 at 19:55
add comment

2 Answers

up vote 6 down vote accepted

I build a minimal example with your code fragment.

\listfiles
\listfiles
\documentclass[12pt,]{article}
\usepackage{xcolor}
\usepackage{enumitem}
\newlist{procedureflow}{enumerate}{2}
\setlist[procedureflow,1]{label*=\color{blue!80!black}\arabic*.,ref=\arabic*}
\setlist[procedureflow,2]{label*=\color{green!80!black}\arabic*.,ref=\arabic{procedureflowi}.\arabic*}
\begin{document}
\begin{procedureflow}
    \item First
    \item Second
    \begin{procedureflow}
         \item First First
         \item Second Second\label{mylabel}
    \end{procedureflow}
\end{procedureflow}
Here is a cross reference: \ref{mylabel}
\end{document}
Here is a cross reference: \ref{mylabel}
\end{document}

With this version

enumitem.sty 2011/08/06 v3.4 Customized lists

You have to use the correct counter: procedureflowi

share|improve this answer
    
Thanks Marco! I didn't find it clear in the user guide though, but it works anyway :) –  John Kirollos Aug 27 '11 at 20:00
    
I wouldn't say it's not clear, but rather it's not--period :-). I'll explain it in a next release. –  Javier Bezos Aug 28 '11 at 11:28
add comment

try this:

\newlist{procedureflow}{enumerate}{3}
    
\setlist[procedureflow]{label*={\color{blue!60!red}\arabic*.},ref=\arabic*}
    
\setlist[procedureflow,2]{label*={\color{green!80!black}\arabic*.}}
    
share|improve this answer
    
But using your code the references will also have colors and this could not be desirable. –  Gonzalo Medina Aug 27 '11 at 20:14
add comment

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.