如何在 LaTeX 中自定义对子列表的引用?
我的 LaTeX 文档中有一个列表/子列表结构。 默认情况下,子列表是用字母分隔的,因此您最终会得到以下结果:
1. Item
(a) sub item
(b) sub item
在我的文档中,我有超过 26 个子项目,因此我遇到了计数器溢出错误,我通过重写子项目标签来修复该错误,这样它们现在看起来像这样,
1. Item
1.1 sub item
1.2 sub item
我在其中一个项目上贴了标签,以便我稍后可以参考具体步骤。 问题在于,当呈现引用时,它是使用字母呈现的,而不是子项的编号。
这是显示问题的示例文档。
\documentclass[11pt]{report}
\begin{document}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}}
\begin{enumerate}
\item Item
\begin{enumerate}
\item \label{lbl} Label here
\end{enumerate}
\end{enumerate}
Ref: \ref{lbl}
\end{document}
它的渲染方式如下:
1. Item
1.1 Label here
Ref: 1a
因此,它不是说“Ref: 1.1”,而是使用“Ref: 1.a”。 有没有办法让 \ref 使用源枚举的编号? 如果没有,是否有办法生成对超过 26 个项目的子列表中的项目的正确引用?
I have a list/sublist structure in my LaTeX document. By default, the sublist is delimited with letters, so you end up with this:
1. Item
(a) sub item
(b) sub item
In my document, I've got more than 26 sub items, so I was running into a Counter overflow error, which I fixed by rewriting the sub item label, so that they now look like this
1. Item
1.1 sub item
1.2 sub item
I've put a label on one of the items so that I can reference the specific step later on. The problem is that when the reference is rendered, it's rendered using a letter, not the number of the sub item.
Here's a sample doc that shows the problem.
\documentclass[11pt]{report}
\begin{document}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}}
\begin{enumerate}
\item Item
\begin{enumerate}
\item \label{lbl} Label here
\end{enumerate}
\end{enumerate}
Ref: \ref{lbl}
\end{document}
This gets rendered like this:
1. Item
1.1 Label here
Ref: 1a
So instead of saying "Ref: 1.1", it's using "Ref: 1.a". Is there a way to make the \ref use the numbering of the source enumeration? If not, is there anyway to generate correct references to items in a sublist with more than 26 items?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我正在查看我的《The LaTeX Companion》副本,第 129 页,根据我所看到的内容,我会提出如下建议:
不过,我目前无法访问工作的 LaTeX 环境来测试它。
I'm looking at my copy of The LaTeX Companion, p.129, and from what I'm seeing I would suggest something like the following:
I don't have access to a working LaTeX environment to test this at the moment, though.
因此,对于 2 个嵌套列表,应该按以下方式完成:
我花了太多时间来理解它。
我希望这会有所帮助,因为该线程对我有帮助。
谢谢。
So for 2 nested lists it should be done in the following way:
It has taken to me too much time to understand it.
I hope this helps as this thread helped me.
Thanks.