r - 如何控制bookdown书的起始页

标签 r pandoc epub bookdown

我的电子书中有章节和章节。第 1 节有一个概述页面,然后是第 1 章。当我从 Amazon 下载我的书时,它从第 1 章的开头开始,因此用户错过了前言和章节文本。

在 Amazon Kindle 发布指南 (https://kindlegen.s3.amazonaws.com/AmazonKindlePublishingGuidelines.pdf) 的第 5.3 节中

它说“指南项是 EPUB 格式的可选功能,但强烈推荐。Kindle 提供对封面、TOC 和开始阅读位置(“转到开头”)指南项的支持。

我想指定“开始阅读”位置,但找不到如何执行此操作的示例。

这是怎么做的?

最佳答案

EPUB 图书只是一个 ZIP 文件,因此您可以解压缩它并查看里面的文件。我使用 bookdown 创建的示例 EPUB包含一个文件 content.opf有了这个 <guide>元素:

  <guide>
    <reference type="toc" title="A Minimal Book Example" href="nav.xhtml" />
  </guide>

根据 https://ebookflightdeck.com/handbook/guide covertext指南看起来像这样,其中 text对应于“开始阅读位置”:
<guide>
    <reference type="cover" title="Cover Image" href="cover.xhtml"></reference>
    <reference type="toc" title="Table of Contents" href="toc.xhtml"></reference>
    <reference type="text" title="Startup Page" href="chapter1.xhtml"></reference>
</guide>

当然,显式href必须根据 EPUB 中的内容进行调整。

或者,您可以使用 EPUB3 规则并添加 landmark项目到nav.xhtml ,参见https://ebookflightdeck.com/handbook/landmarks .这里bodymatter可能是需要的。这可能更合适,因为 bookdown默认使用 EPUB3。在我使用 pandoc 2.2.1 生成的 EPUB 示例中,我再次获得了目录,但没有其他内容:
<nav epub:type="landmarks" hidden="hidden">
  <ol>
    <li>
      <a href="#toc" epub:type="toc">Table of contents</a>
    </li>
  </ol>
</nav>

为了让它工作,我必须使用:
bookdown::epub_book:
  toc: yes
pandoc >= 2.3 支持更好地支持指定电子书的不同部分 using the epub:type attribute .

不过,鉴于上述链接发布指南中的引用,我不确定这与 Kindle 产品的相关性:

Publishers do not need to define a start reading location because Amazon does this during the upload process.

关于r - 如何控制bookdown书的起始页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52321963/

相关文章:

iphone - 如何在 iPhone 中检测网页 View 页面是否已到达

r - 在维恩图的每个圆圈内显示元素,而不仅仅是计数?

从字符串中删除最后一个尾随下划线

r - 不属于同一组的点到该点的最近邻距离

xhtml - 链接到XHTML/EPUB中的音频

python - 使用 Python 从 epub 中提取文本

r - 添加新的回归线,但保留 R 中先前运行的回归线

docker : Can a container A call an executable located on an other container B?

r - 如何在 “Rpres” rmarkdown演示文稿中添加引文和引用书目?

python - pypandoc + pandoc-citeproc 将 bib 转换为 rst