在处理以下不那么简单的示例时,我注意到在更改枚举标签的外观时交叉引用无法正常工作。我必须进行哪些更改才能使其正常工作?
enumitem.sty
由于与不兼容,我不使用beamer.cls
。
[抱歉,由于我们的安全政策,我无法上传任何内容。最后一行的结果see 2
应该是see b
。]
\documentclass{scrartcl}
\makeatletter
\renewcommand{\labelenumi}{\alph{enumi})}
\newenvironment{Enumerate}[1][0]{%
\advance\@enumdepth\@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\expandafter
\begin{list}{\csname label\@enumctr\endcsname}{\usecounter\@enumctr\def\makelabel##1{{##1}}%
\setlength{\rightmargin}{\z@}%
\setlength{\itemindent}{\z@}%
\settowidth{\labelwidth}{99.}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{1.25\labelwidth}%
\setlength{\labelsep}{0.25\labelwidth}}}
{\end{list}}
\makeatother
\begin{document}
A
\begin{Enumerate}
\item a
\item b\label{B}
\item c
\end{Enumerate}
See \ref{B}.
\end{document}
答案1
标签存储为\theenumi
。这是您应该重新定义的命令。\labelenumi
还不够-
\documentclass{scrartcl}
\makeatletter
\renewcommand{\labelenumi}{\theenumi)}
\renewcommand\theenumi{\alph{enumi}}
\newenvironment{Enumerate}[1][0]{%
\advance\@enumdepth\@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
\begin{list}{\csname label\@enumctr\endcsname}{\usecounter\@enumctr\def\makelabel##1{{##1}}%
\setlength{\rightmargin}{\z@}%
\setlength{\itemindent}{\z@}%
\settowidth{\labelwidth}{99.}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{1.25\labelwidth}%
\setlength{\labelsep}{0.25\labelwidth}}}
{\end{list}}
\makeatother
\begin{document}
A
\begin{Enumerate}
\item a
\item b\label{B}
\item c
\end{Enumerate}
See \ref{B}.
\end{document}