尝试格式化没有gitbook输出的书本

时间:2019-09-02 03:43:49

标签: bookdown

回复第一个回复。

我正在尝试构建不是gitbook的书本。但是,无论我尝试通过css还是yaml包含什么,我仍然会得到相同的gitbook结果。

下面,我将显示索引文件,然后显示构建结果。一切正常,但是它是gitbook,而不是我期望的-来自更通用的html_book格式的内容。

我对所有这些都是新手,但是我是一位经验丰富的LaTeX作者,并且对CSS非常熟悉。

但是我在这里遇到了真正的麻烦-我的基本目标是渲染衬线字体!似乎是一场挣扎?!

预先感谢您的帮助...

这是简单的索引文件-现在通过jsonformatter ...

--- 
title: 'Against the Grain'
author: 'Raymond Brock'
date: '`r Sys.Date()`'
site: 'bookdown::bookdown_site'
'bookdown::html_book': null
output:
    html_document:
        theme: darkly
        highlight: espresso
        toc: true
        toc_float: true
documentclass: book
bibliography:
    - book.bib
    - packages.bib
biblio-style: apalike
link-citations: yes
github-repo: rstudio/bookdown-demo
description: 'This is an investgation of two rebels of the 16th century.'
---

然后有多个章节可以正常工作,只是看起来并不像我期望的那样。

但是,结果是生成的常规gitbook。告诉它在哪里做output_format ='bookdown :: gitbook'??

构建结果:

    ==> rmarkdown::render_site(output_format = 'bookdown::gitbook', encoding = 'UTF-8')



    processing file: against-the-grain.Rmd
      |.................................................................| 100%
       inline R code fragments


    output file: against-the-grain.knit.md

    /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS against-the-grain.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output against-the-grain.html --email-obfuscation none --wrap preserve --standalone --section-divs --table-of-contents --toc-depth 3 --template /Library/Frameworks/R.framework/Versions/3.6/Resources/library/bookdown/templates/gitbook.html --highlight-style pygments --number-sections --include-in-header /var/folders/73/fmvtgv_n4f57sjqblbh8439c0000gn/T//Rtmpwmh6tv/rmarkdown-strda8c185d45aa.html --mathjax --filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc 

    Output created: _book/index.html
    Warning message:
    In split_chapters(output, gitbook_page, number_sections, split_by,  :
      You have 7 Rmd input file(s) but only 6 first-level heading(s). Did you forget first-level headings in certain Rmd files?

Gitbook正在某个地方被调用!我也将Shell脚本更改为:

#!/bin/sh

set -ev

Rscript -e "bookdown::render_book('index.Rmd')"
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::pdf_book')"
Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book')"

1 个答案:

答案 0 :(得分:0)

根据documentation,可以使用bookdown::html_book作为输出格式,例如

--- 
title: 'Against the Grain'
author: 'Raymond Brock'
date: '`r Sys.Date()`'
site: 'bookdown::bookdown_site'
output:
    bookdown::html_book:
        theme: darkly
        highlight: espresso
        toc: true
        toc_float: true
description: 'This is an investgation of two rebels of the 16th century.'
---

(为简单起见,我已删除了与书目相关的内容。)