1

My real problem is with a 300 pages book that worked fine in the past, but now fail to recognize hundreds of implicit links to hundreds of headers, but consider a new bookdown project named "test" where the contents pages are reduced 3 simple files:

index.Rmd
01-test.Rmd
02-test.Rmd

and the other files are untouched, except adding keep_md: yes in _output.yml to see a merged .md file after rendering.

With Build Book > bookdown::pdf_book this will produce a test.pdf but also this test.md:

--- 
title: "test"
site: bookdown::bookdown_site
documentclass: book
---

# foo
bla bla [bah] and [foo]
 
<!--chapter:end:index.Rmd-->

# bah
bla bla [baz]

<!--chapter:end:01-test.Rmd-->
    
# baz
bla bla [foo]
<!--chapter:end:02-test.Rmd-->

But in the PDF (or when exported to a html book) only the first [foo] will become a link to the chapter foo, but the other three implicit links are rendered as plain text in the PDF. That is, implicit links work only within a chapter, but not between chapters.

Then I realized that the build pane of Rstudio showed:

/usr/bin/pandoc +RTS -K512m -RTS ./index.split.md ./01-test.split.md 
./02-test.split.md  --to latex ...

And moreover, rendering test.md directly (replacing site: bookdown::bookdown_site by output: pdf_document to the YAML header and using "preview PDF") all implicit links worked, so it is clear that bookdown is merging the LaTeX output with pandoc instead of pass to pandoc the merged markdown file.

Supposedly, the default rendering approach in bookdown is "Merge and knit". I played with new_session: yes and new_session: no in _bookdown.yml to change the rendering approach, but nothing changed.

I know that using [foo](#foo) instead of [foo] will work with whatever rendering approach, but change every link in a huge already book is a pain, and export myself the merged file is annoying, so the question is:

How to force to bookdown to export again a merged markdown instead of merge the LaTeX or HTML output with pandoc?

As the problem seem related with software versions, this is my actual system and related R package versions:

Linux Mint 20
RStudio 1.3.1073
R version 3.6.3 (2020-02-29)
pandoc 2.10.1
bookdown_0.20
markdown_1.1
rmarkdown_2.3
knitr_1.29
rstudioapi_0.9.0
tinytex_0.25
yaml_2.2.1
Fran
  • 207
  • 2
  • 13
  • Have you tried the dev version of **bookdown**? `remotes::install_github('rstudio/bookdown')` – Yihui Xie Aug 24 '20 at 05:37
  • 1
    I had problems days ago to open some projects with the dev version (and/or maybe the Rstudio daily build), so I returned to the stable versions, facing this problem. But I just tried again the dev version and with `bookdown_0.20.3` all the projects open and the input of pandoc is again only `test.utf8.md`, so the problem seems solved. Thanks! – Fran Aug 24 '20 at 08:22
  • Good to know. The cause of this problem is the same as in this post https://stackoverflow.com/a/62583304/559676. – Yihui Xie Aug 26 '20 at 20:54

0 Answers0