首页 > 解决方案 > 如何将第一级部分放在不同的 HTML 页面上?

问题描述

为了制作第一级部分而不是只有章节 html 页面,我尝试更改split_byyaml.xml 中的 html 页面。

我使用了这段代码:

---
title: "new book"
author: "My name"
date: "`r Sys.Date()`"
subtitle: "subtitle"
site: bookdown::bookdown_site
output:
  bookdown::gitbook:
      split_by: chapter
      config:
        toc:
          collapse: subsection
          scroll_highlight: yes
          before: null
          after: null
        toolbar:
          position: fixed
        edit : null
        download: null
        search: yes
        fontsettings:
          theme: white
          family: sans
          size: 2
        sharing:
          facebook: yes
          twitter: yes
          google: no
          linkedin: no
          weibo: no
          instapaper: no
          vk: no
          all: ['facebook', 'google', 'twitter', 'linkedin', 'weibo', 'instapaper']         
   #bookdown::pdf_book: default
documentclass: book
---

当我将“章节”更改为“部分”时,R 会引发错误。

如何确保章节和第一级部分有单独的页面?

标签: rbookdown

解决方案


(在文档的早期阶段)有些章节没有小节。split_by: section在没有章节的章节的情况下会导致错误。


推荐阅读