gpt4 book ai didi

r - bookdown 将章节转换为章节

转载 作者:行者123 更新时间:2023-12-01 05:56:14 28 4
gpt4 key购买 nike

我有一本书可以很好地编译为 html,但 pdf 版本没有章节。例如,命令

# Introduction {#intro-intro}

被翻译成
\hypertarget{intro-intro}{%
\section{Introduction}\label{intro-intro}}

(gitbook 格式没有这样的问题)
<EDIT>
我有 # Preface {-}顶部 Index.Rmd\mainmatter在末尾。也许它没有脱离序言?罗马数字变回非罗马数字 # Introduction .
</EDIT>
我的 Index.Rmd
---
documentclass: krantz
classoption: numberinsequence
bibliography: [book.bib]
biblio-style: apalike
link-citations: yes
colorlinks: yes
graphics: yes
---
_bookdown.yml
new_session: yes    
output_dir: working_files
clean: [bookdown.bbl]
language:
label:
fig: "Fig. "
tab: "Table "

_output.yml
  bookdown::gitbook:
css: css/style.css
dev: svglite

bookdown::pdf_book:
includes:
in_header: latex_extras/preamble.tex
before_body: latex_extras/before_body.tex
after_body: latex_extras/after_body.tex
keep_tex: yes
dev: "cairo_pdf"
latex_engine: pdflatex
citation_package: natbib
template: null
toc_unnumbered: no
toc_appendix: yes
quote_footer: ["\\VA{", "}{}"]

最后
  > session_info()
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 3.4.3 (2017-11-30)
os macOS High Sierra 10.13.3
system x86_64, darwin15.6.0
ui X11
language (EN)
collate en_US.UTF-8
tz America/New_York
date 2018-03-09

─ Packages ───────────────────────────────────────────────────────────────────
package * version date source
backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
bookdown * 0.7 2018-02-18 CRAN (R 3.4.3)
clisymbols 1.2.0 2017-05-21 CRAN (R 3.4.0)
digest 0.6.15 2018-01-28 cran (@0.6.15)
evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0)
knitr 1.20 2018-02-20 CRAN (R 3.4.3)
magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
Rcpp 0.12.15 2018-01-20 cran (@0.12.15)
rmarkdown * 1.8 2017-11-17 CRAN (R 3.4.2)
rprojroot 1.3-2 2018-01-03 cran (@1.3-2)
sessioninfo * 1.0.0 2017-06-21 CRAN (R 3.4.1)
stringi 1.1.6 2017-11-17 CRAN (R 3.4.2)
stringr 1.3.0 2018-02-19 CRAN (R 3.4.3)
withr 2.1.1 2017-12-19 CRAN (R 3.4.3)
xfun 0.1 2018-01-22 cran (@0.1)

最佳答案

Pandoc 转换 #\section{}默认情况下(不严格为真,但请参阅 Pandoc's manual 了解详情)。要让它知道你想要章节,你必须使用参数 --top-level-division ( example here )。

关于r - bookdown 将章节转换为章节,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49198680/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com