Latex 中列表的最大嵌套级别

发布于 2024-08-15 16:21:45 字数 71 浏览 2 评论 0原文

有没有办法增加 Latex 中列表(枚举等)的最大嵌套级别?我的课程需要五个级别,但 Google 没有找到任何内容......

Is there a way to increase the maximum nesting level of lists (enumerate, etc) in Latex? I need five levels for a class, and Google isn't finding me anything...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

雨落星ぅ辰 2024-08-22 16:21:45

使用 enumitem 包的解决方案

  1. 如果您没有安装 enumitem.sty 的版本 3,则 手动下载 enumitem.sty 并将其放入项目的文件夹中。
  2. 对于逐项列出,请将以下内容添加到文档的序言中:
\usepackage{enumitem}
\setlistdepth{9}

\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\bullet$}
\setlist[itemize,3]{label=$\bullet$}
\setlist[itemize,4]{label=$\bullet$}
\setlist[itemize,5]{label=$\bullet$}
\setlist[itemize,6]{label=$\bullet$}
\setlist[itemize,7]{label=$\bullet$}
\setlist[itemize,8]{label=$\bullet$}
\setlist[itemize,9]{label=$\bullet$}

\renewlist{itemize}{itemize}{9}

对于其他列表类型,必须对此进行调整。

如果您收到“!未定义的控制序列。\setlistdepth”,则故障排除帮助

  • ,LaTeX 使用的 enumitem.sty 版本早于版本 3。
  • 如果您仍然收到“嵌套太深”错误,则 如果您收到“Package enumitem Error: Undefined label.”,则您使用的列表类型缺少 renewlist 命令。
  • ,则其中一个级别的标签未使用 \setlist[itemize,$LEVEL] 定义。 . 命令

Solution using enumitem package

  1. If you do not have the version 3 of the enumitem.sty installed, then download enumitem.sty manually and place it into your project's folder.
  2. For itemize lists, add the following to the preamble of your document:
\usepackage{enumitem}
\setlistdepth{9}

\setlist[itemize,1]{label=$\bullet$}
\setlist[itemize,2]{label=$\bullet$}
\setlist[itemize,3]{label=$\bullet$}
\setlist[itemize,4]{label=$\bullet$}
\setlist[itemize,5]{label=$\bullet$}
\setlist[itemize,6]{label=$\bullet$}
\setlist[itemize,7]{label=$\bullet$}
\setlist[itemize,8]{label=$\bullet$}
\setlist[itemize,9]{label=$\bullet$}

\renewlist{itemize}{itemize}{9}

For the other list types this has to be adapted.

Troubleshooting help

  • if you get "! Undefined control sequence. \setlistdepth", the version of enumitem.sty that LaTeX uses is older then version 3.
  • if you still get the "Too deeply nested" error, then the renewlist command is missing for the list type you use
  • if you get "Package enumitem Error: Undefined label.", then the label for one of the levels was not definied with the \setlist[itemize,$LEVEL] ... command
‖放下 2024-08-22 16:21:45

您可以使用 enumitem 包。之后你只需输入你想要的深度级别:

\usepackage{enumitem}
...
\setlistdepth{9}

你的列表最多可以有 9 个嵌套级别,很简单;-)

自 3.0 起,此功能在软件包中可用(例如 Ubuntu 安装了 2.2)。如果您有旧版本,只需将其替换为:
http://ctan.mackichan.com/macros/latex/contrib/enumitem/enumitem.sty< /a>

希望有帮助!

You can use the enumitem package. After what you just have to put the depth level you want:

\usepackage{enumitem}
...
\setlistdepth{9}

And you can have up to 9 nested levels for your lists, easy ;-)

This feature is available in the package since 3.0 (Ubuntu installed me the 2.2 for instance). In case where you have an old version just replace it by:
http://ctan.mackichan.com/macros/latex/contrib/enumitem/enumitem.sty

Hope that helps!

開玄 2024-08-22 16:21:45

您需要从文件 latex.ltx 中复制 \enumerate\itemize 的定义,并将代码从 更改为 ,

  \ifnum \@itemdepth >\thr@@\@toodeep\else

  \ifnum \@itemdepth >4\@toodeep\else

还需要定义计数器 enumv、控制序列 \labelitemv 以及其他支持深度 5 的内容。

注意,如果您想在 .sty 文件之外执行此操作,则需要围绕你的新定义

\makeatletter
....
\makeatother

总而言之,这是相当多的细节工作,但如果你习惯于破解 LaTeX,那么这相当简单。如果任务看起来太多,并且您没有时间学习,您可以尝试在此处或其他地方发布赏金:-)

You need to copy the definitions of \enumerate and \itemize from file latex.ltx and change the code from

  \ifnum \@itemdepth >\thr@@\@toodeep\else

to

  \ifnum \@itemdepth >4\@toodeep\else

and you will also need to define counters enumv, control sequence \labelitemv, and bunch of other stuff to support depth 5.

N.B. If you want to do this outside a .sty file, you'll need to surround your new definitions by

\makeatletter
....
\makeatother

In all it's a fair amount of detail work, but if you are accustomed to hacking LaTeX, it is fairly straightforward. If the task seems too much, and you don't have time to learn, you could try posting a bounty here or elsewhere :-)

作业与我同在 2024-08-22 16:21:45

您还可以在 enumerate-environment 中使用 itemize-environment

You could also just use an itemize-environment within an enumerate-environment.

小巷里的女流氓 2024-08-22 16:21:45

IIRC,限制在于默认提供的枚举计数器的数量。我从来没有这样做过,但你可能想查看 LaTeX Wikibook 获取一些提示。上次我不得不认真调整列表时,我最终回到使用基于 TeX 供不耐烦的人使用

IIRC, the limitation is in the number of enumeration counters provided by default. I've never had to do this but you might want to check the LaTeX Wikibook for some hints. The last time that I had to serious tweak lists, I ended up falling back to using straight TeX macros based on some stuff in TeX for the Impatient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文