如何在前言,确认等方面获得罗马数字,并在R Bookdown第一章的第一页重启阿拉伯语编号为1.
我想在bookdown中呈现为pdf,但是没有找到关于如何更改页面编号的任何好信息
谢谢
Ral*_*ner 12
请查看@maxheld的答案.它更简单,并且对于许多用例来说足够了.另一个不需要编辑模板的简单解决方案是:
---
title: Page Numbering in R Bookdown
documentclass: book
output:
bookdown::pdf_book: default
header-includes:
- \AtBeginDocument{\frontmatter}
---
\mainmatter
# Header 1
Some text
\backmatter
# Appendix 1
Some text
Run Code Online (Sandbox Code Playgroud)
这插入\frontmatter
,\mainmatter
并\backmatter
在正确的位置.
使用book
文档类使用LaTeX生成PDF输出.在这个类中,你可以使用\frontmatter
,\mainmatter
而\backmatter
这本书的不同"部分"分开.为了使用它,bookdown
我做了以下事情:
<R-library-path>/rmarkdown/rmd/latex/default-1.17.0.2.tex
作为book.tex
工作目录book.tex
以包括\frontmatter
,\mainmatter
和\backmatter
(下面DIFF)_output.yml
以引用book.tex
为template
(下面的差异)通过这些更改,PDF格式bookdown
为ToC使用了使用的(低苛子酶)罗马数字,并重新启动了实际正文的阿拉伯数字.差异:
diff --git a/_output.yml b/_output.yml
index 112cf5b..b211ba7 100644
--- a/_output.yml
+++ b/_output.yml
@@ -13,5 +13,6 @@ bookdown::pdf_book:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
+ template: book.tex
bookdown::epub_book:
stylesheet: style.css
diff --git a/book.tex b/book.tex
index 0f9979d..3d03540 100644
--- a/book.tex
+++ b/book.tex
@@ -235,6 +235,9 @@ $header-includes$
$endfor$
\begin{document}
+$if(book-class)$
+\frontmatter
+$endif$
$if(title)$
\maketitle
$endif$
@@ -263,8 +266,14 @@ $endif$
$if(lof)$
\listoffigures
$endif$
+$if(book-class)$
+\mainmatter
+$endif$
$body$
+$if(book-class)$
+\backmatter
+$endif$
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
Run Code Online (Sandbox Code Playgroud)
我认为可能更容易按照自己的小册子krantz
示例中使用的@yihui 示例:
添加以下文件,可能在/latex
子文件夹中:
preamble.tex
最后用乳胶\frontmatter
命令,after_body.tex
用乳胶\backmatter
命令,然后,在您的第一个实际主体之前,只需将\mainmatter
命令(仅在乳胶中)添加到您的index.Rmd
(无论您的*.Rmd
s是第一个,按常规index.Rmd
).
然后,修改你的_output.yml
喜欢:
bookdown::pdf_book:
includes:
in_header: latex/preamble.tex
after_body: latex/after_body.tex
Run Code Online (Sandbox Code Playgroud)
这点缀正确的\frontmatter
,\mainmatter
并\backmatter
命令到你的pandoc-ED乳胶书.它将受到大多数样式文件的尊重,以确保阿拉伯语编号仅在主要内容中开始.
这也记录在bookdown书的出版章节中.