2

I am using the enumerate environment, and I want to have my lists start on 1.1. instead of 1., and 2.1. instead of 2. How can I hide the first level?

  • Typically the first number denotes the first level; the second number denotes the second level; and so on. So you want to reverse this. In your example, what does the 1 in 2.1 represent? Chapter number? Section number? Or just some fixed value? – Werner Mar 3 '16 at 15:32
  • I want to answer the questions in a tutorial. There are two questions with a number of sub-questions each. I want the first thing that appears after the title to just be "1.1." instead of "1." So, I still want the "1." to be there in the code, I just want to hide it. – ahorn Mar 3 '16 at 15:42
  • \savebox can be used to hide things and (globally) increment counters. – John Kormylo Mar 3 '16 at 15:44
  • @John How do I use savebox? By putting \savebox\item when I want to hide that point? – ahorn Mar 3 '16 at 16:06
  • \newsavebox{\myname} in the preamble and \savebox{\myname}{...}. I would leave the \begin{enumerate} outside and only put individual \items inside. (BTW, I haven't actually tested this on \items.) – John Kormylo Mar 3 '16 at 16:15
1

You can either add the numbering locally by using the optional argument to \item[..], or use a global change using enumitem's label=<key>.

enter image description here

\documentclass{article}

\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label={\arabic*.1.}]
  \item First
  \item Second
  \item Third

  % Done with the 1. suffix; revert back to regular enumerate labelling
  \renewcommand{\labelenumi}{\arabic{enumi}.}
  \item Last
\end{enumerate}

\begin{enumerate}
  \item[1.1.] First

  \stepcounter{enumi}
  \item Second

  \item[2.2.] Third

  \item Last
\end{enumerate}

\end{document}

\item-level changes are also possible, like in the first example above, where the labelling mechanism can be changed mid-enumerate to drop (say) the 1. suffix.

Note that using the optional argument to \item doesn't step the level counter enumi.

1

This uses a mix with manipulation the enumeration depth counter and enumitem and sets the higher level counter enumi accordingly.

\documentclass{article}

\usepackage{etoolbox}
\usepackage{enumitem}

\begin{document}


\makeatletter
\AtEndEnvironment{enumerate}{%
  \global\@enumdepth 0
}

\newcommand{\incenumdepth}[1][1]{%
  \advance \@enumdepth \@ne%
  \setcounter{enum\@roman{\@enumdepth}}{#1}%
}
\makeatother


\incenumdepth[1]
\begin{enumerate}[label*={\arabic*.}]
\item One
\item Two
\item Three
\item Four
\item Five
\end{enumerate}

\incenumdepth[3]
\begin{enumerate}[label*={\arabic*.}]
\item One \makeatletter \the\@enumdepth\makeatother
\item Two
\item Three
\item Four
\item Five
\end{enumerate}


\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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