在 bookdown 目录中包含 after_body
Include after_body in toc with bookdown
我正在创建一本 pdf 书籍,并希望在目录中包含 after_body header。我使用以下 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}
如何在目录中包含 "Enclosed articles I - III"?我在 index.Rmd
文件中的 \mainmatter
之前使用 \tableofcontents
创建目录。
编辑:我还注意到 bookdown 在 \titlepage 乳胶环境之后创建了一个带有页码的空白页。这也发生在 frontpage.tex 中。有什么方法可以删除这些页面上的数字吗?
我设法通过将 \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
}
我正在创建一本 pdf 书籍,并希望在目录中包含 after_body header。我使用以下 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}
如何在目录中包含 "Enclosed articles I - III"?我在 index.Rmd
文件中的 \mainmatter
之前使用 \tableofcontents
创建目录。
编辑:我还注意到 bookdown 在 \titlepage 乳胶环境之后创建了一个带有页码的空白页。这也发生在 frontpage.tex 中。有什么方法可以删除这些页面上的数字吗?
我设法通过将 \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
}