Skip to content

placing references before appendix does not work with natbib #1403

@eyayaw

Description

@eyayaw

I have followed the cookbook suggestion for putting appendix after bibliography. However, that does not seem to work with natbib as a citation package.

What is in _output.yml?

bookdown::gitbook:
  css: style.css
  config:
    toc:
      before: |
        <li><a href="./">A Minimal Book Example</a></li>
      after: |
        <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    edit: https://github.com/USERNAME/REPO/edit/BRANCH/%s
    download: ["pdf", "epub"]
bookdown::pdf_book:
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

All files are populated by the bookdown-demo, see below for a snapshot. I have not done anything other than adding an appendix chapter and adding a div with id refs. Here is what I have done:

  1. created a bookdown project in rstudio
  2. created 08-appendix.Rmd and added the following lines
# Appendix {.unnumbered}

# (APPENDIX) Appendix {.unnumbered}
  1. added to 07-references.Rmd <div id="refs"></div>
`r if (knitr::is_html_output()) ' # References {-} '`

<div id="refs"></div>
  1. Build Book: bookdown::pdf_book

Bibliography chapter comes after Appendix

  1. commented out the citation_package: natbib in the _output.yml file
    Now, the Bibliography chapter comes before Appendix, as intended.

What should I do to get the appendix after the references with natbib as a citation package?

Additional info

snapshot

Session info

xfun::session_info('bookdown')
R version 4.2.2 (2022-10-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.2, RStudio 2022.12.0.353

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.32        bslib_0.4.2.9000    
  cachem_1.0.6.9000    cli_3.6.0.9000       digest_0.6.31       
  ellipsis_0.3.2.9000  evaluate_0.20.1      fastmap_1.1.0.9000  
  fs_1.6.0.9000        glue_1.6.2           graphics_4.2.2      
  grDevices_4.2.2      highr_0.10           htmltools_0.5.4.9000
  jquerylib_0.1.4      jsonlite_1.8.4       knitr_1.42          
  lifecycle_1.0.3.9000 magrittr_2.0.3       memoise_2.0.1.9000  
  methods_4.2.2        mime_0.12            R6_2.5.1.9000       
  rappdirs_0.3.3.9000  rlang_1.0.6.9000     rmarkdown_2.20      
  sass_0.4.5.9000      stats_4.2.2          stringi_1.7.12      
  stringr_1.5.0        tinytex_0.44.1       tools_4.2.2         
  utils_4.2.2          vctrs_0.5.2.9000     xfun_0.37           
  yaml_2.3.7          

Checklist

When filing a bug report, please check the boxes below to confirm that you have provided us with the information we need. Have you:

  • formatted your issue so it is easier for us to read?

  • included a minimal, self-contained, and reproducible example?

  • pasted the output from xfun::session_info('bookdown') in your issue?

  • upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?

  • installed and tested your bug with the development version of the bookdown package using remotes::install_github("rstudio/bookdown") ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions