【发布时间】:2018-03-30 11:38:57
【问题描述】:
我正在使用this 论文模板。它包括摘要、致谢、数字列表……在table of contents 中。根据大学的指导方针,我的 TOC 应该从第 1 章介绍开始,而不是列出摘要、致谢……。
在乳胶中,您可以只使用\section*,但在pandoc 中使用.unnumbered 会导致该部分仍被包含在内。
从 TOC 中排除介绍章节之前的部分的最简洁方法是什么?
【问题讨论】:
我正在使用this 论文模板。它包括摘要、致谢、数字列表……在table of contents 中。根据大学的指导方针,我的 TOC 应该从第 1 章介绍开始,而不是列出摘要、致谢……。
在乳胶中,您可以只使用\section*,但在pandoc 中使用.unnumbered 会导致该部分仍被包含在内。
从 TOC 中排除介绍章节之前的部分的最简洁方法是什么?
【问题讨论】:
我使用-H header.tex 作为 Pandoc 选项。
我的解决方法是追加:
\let\oldaddcontentsline\addcontentsline
直接到header.tex。
我在 GitHub 上写过同样的问题:https://github.com/chdemko/pandoc-latex-unlisted/issues/1
【讨论】:
在 pandoc 中有一个 open issue 关于这个。
要从 LaTeX TOC 中删除 {.unnumbered} 标头,您可以同时使用 pandoc-latex-unlisted filter。
$ pip install pandoc-latex-unlisted
$ pandoc --filter pandoc-latex-unlisted input.md -o output.pdf
【讨论】:
Chapter 1. ! Undefined control sequence. \addcontentsline #1#2#3->\oldaddcontentsline {#1}{#2}{#3} l.327 \chapter{Introduction}\label{introduction}} 。您知道这里可能存在什么问题吗?有关我的完整构建命令,请参阅 here。
-s -t latex...
您可以使用{.unlisted}。
通常,
# Intro{.unlisted}
# Chapter 1
编译
pandoc test.md --toc -s -o test.html会给你
与相关html位:
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#chapter-1">Chapter 1</a></li>
</ul>
</nav>
<h1 class="unlisted" id="intro">Intro</h1>
<h1 id="chapter-1">Chapter 1</h1>
</body>
【讨论】: