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.

How can I skip every even item in the enumerate environment without having to continually type \setcounter{enumi}{5}? I am still learning to program macros, so I spologize if this is a ridiculously easy question.

Just to be clear, I would like something like

1. *Something.* 3. *Somthing else.* 5. *A third something.* ...As opposed to

1. Something. 2. A second something. 3. A tertiary Something.

share|improve this question

2 Answers 2

up vote 14 down vote accepted

This is for first level enumerations; other levels can be added in a similar way.

\documentclass{article}
\usepackage{enumitem}

\newlist{oddenumerate}{enumerate}{1}
\setlist[oddenumerate]{start=0,label=\theoddenumeratei.}
\makeatletter
\renewcommand\theoddenumeratei{\@arabic{\numexpr2*\value{oddenumeratei}+1}}
\makeatother

\begin{document}
\begin{oddenumerate}
    \item one
    \item two\label{two}
    \item three
\end{oddenumerate}

Here's a ref: \ref{two}
\end{document}

enter image description here

share|improve this answer
1  
I appreciate the scalability of this solution to include other numbering schemes. –  Qu0rk Jun 10 at 18:16

The following example defines macros \arabicodd and \arabiceven that works similar to \arabic, but using odd and even numbers respectively.

As in the other answers of cmhughes and egreg, the list is made via package enumitem.

References work in the same way as for the "normal" enumerate environment, especially, the dot is not included in the reference. The appearance of the label and reference can easily be configured options label and/or ref. The counters macros \arabicodd and \arabiceven can be used as \arabic there, because they are registered using \AddEnumerateCounter.

\documentclass{article}

\usepackage{enumitem}

\makeatletter
\newcommand*{\arabicodd}[1]{%
  \expandafter\@arabicodd\csname c@#1\endcsname
}
\newcommand*{\arabiceven}[1]{%
  \expandafter\@arabiceven\csname c@#1\endcsname
}
\newcommand*{\@arabicodd}[1]{%
  \@arabic{\numexpr(#1)*2-1\relax}%
}
\newcommand*{\@arabiceven}[1]{%
  \@arabic{\numexpr(#1)*2\relax}%
}

\AddEnumerateCounter\arabicodd\@arabicodd{0}
\AddEnumerateCounter\arabiceven\@arabiceven{0}
\makeatother

\begin{document}
  \begin{enumerate}
      \item one
      \item\label{normal:two}two
      \item three
  \end{enumerate}
  Middle label of normal numbered list: \ref{normal:two}.

  \begin{enumerate}[label=\arabicodd*.,ref=\arabicodd*]
      \item one
      \item\label{odd:two}two
      \item three
  \end{enumerate}
  Middle label of odd-numbered list: \ref{odd:two}.

  \begin{enumerate}[label=\arabiceven*.,ref=\arabiceven*]
      \item one
      \item\label{even:two}two
      \item three
  \end{enumerate}
  Middle label of even-numbered list: \ref{even:two}.
\end{document}

Result

share|improve this answer
    
This is a really useful answer- while I wish I could mark both as the answer, the above answer gives finer control with fewer lines of code. Thanks again! –  Qu0rk Jun 12 at 0:56

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.