Skip to content

EPUB output do not have figure and table identifiers while compiling bookdown-demo book #42

Closed
rstudio/bookdown
#1426
@N0rbert

Description

Steps to reproduce

  1. Have Ubuntu 18.04.2 LTS installed

  2. Install latest pandoc-2.7.2-1-amd64.deb with

    cd ~/Downloads
    wget https://github.com/jgm/pandoc/releases/download/2.7.2/pandoc-2.7.2-1-amd64.deb
    sudo apt install ./pandoc-2.7.2-1-amd64.deb
    
  3. Install R with sudo apt-get install r-base-dev

  4. Launch R console to install bookdown package:

    $ R
    install.packages('bookdown')
    
  5. Clone bookdown-demo repository

    sudo apt-get install git
    git clone https://github.com/rstudio/bookdown-demo.git
    cd bookdown-demo
    
  6. Compile the demo book to EPUB format

    Rscript -e "bookdown::render_book('index.Rmd', 'bookdown::epub_book')"
    
  7. Install epubcheck with sudo apt-get install epubcheck default-jre and launch it against the compiled epub document:

    epubcheck _book/bookdown-demo.epub
    

Expected result - the produced EPUB document is correct and do not have errors

Actual result - the produced EPUB document has errors:

Validating using EPUB version 3.0.1 rules.
WARNING(ACC-009): _book/bookdown-demo.epub/EPUB/text/ch001.xhtml(82,446): MathML should either have an 'alttext' attribute or 'annotation-xml' child element.
ERROR(RSC-005): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(87,74): Error while parsing file 'value of attribute "width" is invalid; must be an integer'.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(82,247): Fragment identifier is not defined.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(92,123): Fragment identifier is not defined.
ERROR(RSC-012): _book/bookdown-demo.epub/EPUB/text/ch002.xhtml(92,252): Fragment identifier is not defined.

Check finished with errors

epubcheck completed

and user can't click on table and image references.
The problematic lines may be determined by unzipping epub and showing its contents:

cd _book
unzip bookdown-demo.epub
pluma EPUB/text/ch002.xhtml

$ awk 'NR==82' EPUB/text/ch002.xhtml
<p>You can label chapter and section titles using <code>{#label}</code> after them, e.g., we can reference Chapter <a href="#intro">2</a>. If you do not manually label them, there will be automatic labels anyway, e.g., Chapter <a href="#methods">4</a>.</p>

$ awk 'NR==92' EPUB/text/ch002.xhtml
<p>Reference a figure by its code chunk label with the <code>fig:</code> prefix, e.g., see Figure <a href="#fig:nice-fig">2.1</a>. Similarly, you can reference tables generated from <code>knitr::kable()</code>, e.g., see Table <a href="#tab:nice-tab">2.1</a>.</p>

Notes:

  1. Issue persists with Pandoc 1.19 from the repository.
  2. I'm not sure about correct component to report bug. Should it be bookdown, rmarkdown, knitr or pandoc?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions