我正在尝试插入枚举项的 PDF 书签:
我定义了一个几乎可以正常工作的自定义列表类型exercises
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage[pdfusetitle,bookmarks=true]{hyperref}
\usepackage{bookmark}
\usepackage{cleveref}
\newlist{exercises}{enumerate}{2}
\setlist[exercises,1]{left=-2\parindent .. -\parindent,label=\protect\pdfbookmark[1]{Exercise \arabic*}{ex-\arabic*}\arabic*., ref=\arabic*}
\setlist[exercises,2]{left=0pt .. \parindent,label=\protect\pdfbookmark[2]{Part \alph*}{ex-\arabic{exercisesi}-part\alph*}\alph*), ref=\arabic{exercisesi}.~\alph*)}
\crefname{exercisesi}{exercise}{exercises}
\crefname{exercisesii}{exercise}{exercises}
\creflabelformat{exercisesii}{#2#1#3}
\begin{document}
\begin{exercises}
\item \label{part:1} \begin{exercises}
\item \label{part:1a}
This is \cref{part:1a}
Second line
\item B
\newpage
\item c
\end{exercises}
\item \label{part:2} \begin{exercises}
\item \label{part:2a}
That was \cref{part:1a}
Second line
\item B
\item c
\end{exercises}
\end{exercises}
\end{document}
不幸的是,这有两个问题:
我该如何做呢?