The solution outlined for each of the following two posts appears to conflict with the hyperref package.
- How to skip an \item in sub-enumerate level
- nested enumerated lists numbered for mathematical proofs
Here is a MWE. The desired output for the example is
1. Outer
2.1. This is line 2.1, in block 2.
2.2. Inner again
3. Outer again
4. Let’s end here
This output is indeed produced by the LaTeX source below, but if I uncomment the \usepackage{hyperref} line in the header, LaTeX gives me an error just after the \skipitem command, as described in the inline comment below:
\documentclass{article}
% \usepackage{hyperref}
% if we uncomment the above line, we get an error as described below
\usepackage{enumitem}
\newlist{steps}{enumerate}{9}
\setlist[steps]{itemindent=0pt}
\setlist[steps,1]{label=\arabic*.,ref=\arabic*}
\setlist[steps,2]{label=\arabic{stepsi}.\arabic*.,ref=\arabic{stepsi}.\arabic*}
\makeatletter
\newcommand{\skipitem}{\refstepcounter{\@enumctr}}
\makeatother
\begin{document}
\begin{steps}
\item Outer
\skipitem
% If we uncomment the \usepackage{hyperref} line in the header,
% we get the following error after the \skipitem above
%
% ./tmp.tex:20: Missing number, treated as zero.
% <to be read again>
% \c@0.0ptxcii
% l.20 \skipitem
% \item[] \label{blockA}
\label{blockA}\item[]
\begin{steps}
\item\label{lineB} This is line~\ref{lineB}, in block~\ref{blockA}.
\item Inner again
\end{steps}
\item Outer again
\item Let's end here
\end{steps}
\end{document}
Can someone help me work around this conflict, so I can use hyperref with this use of enumitems and refstepcounter? Thanks.
(Note: smaller working examples are possible, but they give different error messages. I'm hoping to get the current example working.)
hyperref
last. NOT beforeenumitem
.