0

I have a customized enumerate list which defines workpackages. Everything works fine even for the first nested level. But at the next lower nested level the numbering is not continuing:

enter image description here

I have created the command \crcItem{<hook>} which serves as a hook for the workpackage to reference to. The mandatory object is only needed for referencing and is not displayed. However I would prefer \item[<hook>] but I cannot remodel the command.

This is my source code:

\documentclass{article}
\usepackage{enumitem}
\usepackage{xparse}
\usepackage{hyperref}
\usepackage[noabbrev]{cleveref}

% ==== List for Workpackages
%
\newlist{workpackages}{enumerate}{3}
\setlist[workpackages]{
  align=left,
 % leftmargin=*,
  labelindent=0em,leftmargin=*,
% font=\normalfont,
% first=\bfseries,
  topsep=3pt,
  font=\sffamily\bfseries,
 % nosep,
  label={WP\,\arabic*:},
  ref = {\bfseries WP\,\arabic*},
  resume
}

\setlist[workpackages,2]{
  ref={\bfseries\theworkpackagesi\alph*},
  align=left,
 % leftmargin=0pt,
  labelindent=*em,leftmargin=*,
% font=\normalfont,
% first=\bfseries,
  topsep=0pt,
  font=\sffamily\bfseries,
 % nosep,
  label={\theworkpackagesi\alph*:}
}


\providecommand{\mylist}{}
\newcommand{\crcWP}[1]{\ref{\mylist:#1}}
\newcommand{\crcItem}[1]{\item\label{\mylist:#1}}

\begin{document}
\def\mylist{abc}
abcdefghiklmnop
\begin{workpackages}
  \crcItem{A} some text
  \crcItem{B} some text
  \begin{workpackages}
  \crcItem{B1} some text
  \crcItem{B2} some text
  \end{workpackages}
\end{workpackages}
abcdefghiklmnop
abcdefghiklmnop
\begin{workpackages}
  \crcItem{C} some text
  \crcItem{D} some text
  \begin{workpackages}
  \crcItem{D1} some text
  \crcItem{D2} some text
  \end{workpackages}
\end{workpackages}
\crcWP{A}
\crcWP{B}
\crcWP{C}
\crcWP{D}


% ==== new section
\def\mylist{def}
\restartlist{workpackages}
abcdefghiklmnop
\begin{workpackages}
  \crcItem{A} some text
  \crcItem{B} some text
  \begin{workpackages}
  \crcItem{B1} some text
  \crcItem{B2} some text
  \end{workpackages}
\end{workpackages}
abcdefghiklmnop
abcdefghiklmnop
\begin{workpackages}
  \crcItem{C} some text
  \crcItem{D} some text
  \begin{workpackages}
  \crcItem{D1} some text
  \crcItem{D2} some text
  \end{workpackages}
\end{workpackages}
\crcWP{A}
\crcWP{B}
\crcWP{D2}
\crcWP{D1}
\end{document}

1 Answer 1

0

For lists of level greater than 1, you can use the label* key.

Here is a working code:

\documentclass{article}
\usepackage{enumitem}
\usepackage{xparse}
\usepackage{hyperref}
\usepackage[noabbrev]{cleveref}

% ==== List for Workpackages
%
\newlist{workpackages}{enumerate}{2}

\setlist[workpackages, 1]{
wide=0pt,leftmargin=*,
  topsep=3pt,
  font=\sffamily\bfseries,
 % nosep,
  label={WP\,\arabic*:},
 ref={\sffamily\bfseries WP\,\arabic*:},
}

\setlist[workpackages,2]{
 label*=\alph*:,
  wide=0pt,leftmargin=*,
  topsep=0pt,
  font=\sffamily\bfseries,
  ref={\theworkpackagesi\,\alph*: }
}
\begin{document}

\def\mylist{abc}
abcdefghiklmnop
\begin{workpackages}
  \item \label{first} some text
  \item some text
  \begin{workpackages}
  \item \label{second} some text
  \item some text
  \end{workpackages}
\end{workpackages}

abcdefghiklmnop

abcdefghiklmnop

\begin{workpackages}[resume*]
  \item some text
  \item some text
  \begin{workpackages}
  \item \label{third}some text
  \item s\label{fourth}ome text
  \end{workpackages}
\end{workpackages}\bigskip

\ref{first}, \ref{second}, \ref{third}, \ref{fourth}.

\end{document} 

enter image description here

1
  • Yes, that works. But I realised my problem was that I didnt set the 1 in \setlist[workpackages, 1]{ .... Commented Mar 12, 2022 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .