Skip to content

The compile order of the Rmd files in subdirectories #736

@Yutong-Dai

Description

@Yutong-Dai

Behavior:

When I specify the rmd_subdir metadata in the _bookdown.yml, I would expect the all Rmd files be compiled in order. However, it compiles the files according to alphabetic order of the name of sub-directories.

minimal reproducible example:

Start a default bookdown project using Rstudio.
Assume the directory structure is like the following.

.... (some necessary files)
- index.Rmd
- part1
   -- 01-pre.Rmd (Remark: In this file, I only created a one-line content `# Part I: foo {-}`)
   -- 02-foo.Rmd
   -- 03-bar.Rmd
- appendix
   -- 01-appendix-pre.Rmd (Remark: In this file, I only created a one-line content `# Part II: foo {-}`)
   -- 02-appendix-a.Rmd
   -- 03-appendix-b.Rmd

And I specify the red_subdir like this.

rmd_subdir: ['part1/','appendix/']

According to guide in the usage of rmd_files, I expect the all Rmd files in the subdir part1 would be compiled first. But it turns out that the appendix is compiled first. So the final order is like

01-appendix-pre.Rmd
02-appendix-a.Rmd
03-appendix-b.Rmd
01-pre.Rmd
02-foo.Rmd
03-bar.Rmd

My current workaround is to name the subdirectories like 0part1 and 1appendix. Then each file is rendered in desired order.

output of xfun::session_info('bookdown'):

R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6, RStudio 1.1.423

Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8

Package version:
  base64enc_0.1.3 bookdown_0.11   digest_0.6.18   evaluate_0.14   glue_1.3.0     
  graphics_3.4.1  grDevices_3.4.1 highr_0.6       htmltools_0.3.6 jsonlite_1.6   
  knitr_1.23      magrittr_1.5    markdown_0.8    methods_3.4.1   mime_0.6       
  Rcpp_1.0.0      rmarkdown_1.13  stats_3.4.1     stringi_1.2.4   stringr_1.3.1  
  tinytex_0.14    tools_3.4.1     utils_3.4.1     xfun_0.8        yaml_2.2.0  

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.name/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('bookdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/bookdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions