【问题标题】:Include after_body in toc with bookdown在带有 bookdown 的 toc 中包含 after_body
【发布时间】:2019-07-18 08:12:45
【问题描述】:

我正在创建一本 pdf 书,并希望在 toc 中包含 after_body 标头。我使用以下yaml:

--- 
author: "name"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
geometry: "left=4cm,right=3cm,top=3cm,bottom=3cm"
subparagraph: true
output:
  bookdown::pdf_book:
    toc: false
    citation_package: natbib
    includes:
      before_body: frontpage.tex
      after_body: after_body.tex
      in_header: preamble.tex
fontsize: 11pt
linestretch: 1.2
documentclass: book
bibliography: [packages.bib, library.bib]
biblio-style: apalike
link-citations: yes
---

after_body.tex 我有以下内容:

\backmatter

\begin{titlepage}
   \LARGE
   \textbf{Enclosed articles I - III}
\end{titlepage}

如何在目录中包含“随附文章 I - III”?我在index.Rmd 文件中的\mainmatter 之前使用\tableofcontents 创建目录。

编辑:我还注意到 bookdown 在 \titlepage 乳胶环境之后创建了一个带有页码的空页面。这也发生在frontpage.tex 中。有什么办法可以去掉这些页面上的数字?

【问题讨论】:

  • 您在寻找\addcontentsline{toc}{chapter}{whatever}吗?

标签: latex r-markdown bookdown


【解决方案1】:

我设法通过将 \textbf 更改为 \chapter 来做到这一点,并将其包含在 preamble.tex 中:

\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\headheight}{13.6pt} % as requested by fancyhdr's warning

\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\makeatletter
\renewcommand{\chaptermark}[1]{%
  \if@mainmatter
    \markboth{Chapter \thechapter{}: #1}{}%
  \else
    \markboth{#1}{}%
  \fi
}

取自this post

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-05
    • 2016-07-14
    • 2018-08-07
    • 1970-01-01
    • 2018-12-02
    • 2011-02-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多