Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder references and appendices #27

Closed
jangaijap opened this issue Jul 13, 2021 · 9 comments
Closed

Reorder references and appendices #27

jangaijap opened this issue Jul 13, 2021 · 9 comments

Comments

@jangaijap
Copy link

I am having a hard time reordering references and appendices sections. Since the citation format my discipline uses is APA, the bibliography/references section needs to appear between main chapters and the appendices, rather than after the appendices as in the original Oxford thesis template. The appendices seem to be linked to the "body" Rmd files and thus immediately follow the main chapters in appearance. So I tried to delink appendices from the "body" by changing the file name to "_appendices.Rmd." The pdf built after this tweak does place the appendices after bibliography but as subsections of bibliography (and takes on line spacing format of front/back matter) rather than as a separate section. Is there a way to make the appendices appear after bibliography but in the same format as the body chapters? Any help is appreciated.

@ulyngs
Copy link
Owner

ulyngs commented Jul 13, 2021

So one easy, albeit slightly hacky, way to achieve this:

  1. Remove the bibliography section from the ordinary template.

Go to templates/template.tex and delete or comment out this section at the end of the file, which inserts the bibliography section:

%%%%% REFERENCES
$if(use-biblatex)$
\setlength{\baselineskip}{0pt} % JEM: Single-space References

% we are setting the title for the references section in front-and-back-matter/99-references_heading.Rmd
{\renewcommand*\MakeUppercase[1]{#1}%
\printbibliography[heading=none]}

$endif$

$if(use-natbib)$
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
$endif$
  1. Insert the bibliography section by the end of the last chapter

Go to the .Rmd file that has your last chapter (e.g. 07-conclusion.Rmd). If you are using biblatex for references (the default), add this at the end of the file:

```{=latex}
\setlength{\baselineskip}{0pt}
\renewcommand*\MakeUppercase[1]{#1}
\printbibliography[heading=bibintoc,title={References}]
```

Alternatively, if you are using natbib for references, add this:

```{=latex}
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
```

This will place the reference section after the last chapter:

Screenshot 2021-07-13 at 15 32 49

@tomislavmedak
Copy link

Hey Ulrik, again me -- submitting in ten days, so it will be less of me soon, but apologies for the time being :-) Is there another way to do this? Per your instruction for biblatex, I get the following error:

! Undefined control sequence. l.1705 \printbibliography [heading=bibintoc,title={\bibtitle}]

I've tried to knit with a minimal biblatex file, a single reference that seemed properly structured, and I get the same result. Is there another way to go about it?

As I use pandoc and zotero, I'm not sure if natbib is an option at all.

Thanks

@ulyngs
Copy link
Owner

ulyngs commented Jun 5, 2022

Can you clarify what citation package you are using? i.e. in index.Rmd do you have citation_package: natbib, citation_package: biblatex or nothing?

If you've got nothing, i.e. citations are inserted as CSL references, then this stack overflow answer should work: https://stackoverflow.com/questions/16427637/pandoc-insert-appendix-after-bibliography

@tomislavmedak
Copy link

I had neither selected, then did as instructed for biblatex and again I get the same error:

! Undefined control sequence. <argument> \bibtitle
However, I have looked into that stackoverflow thread and this seems to work:

::: {#refs} :::

I can add this bit of code to the last chapter .Rmd and it will generate the bibliography in that chapter or I can add it as a separate .Rmd chapter file. The only problem is that it's numbered as a separate chapter -- is there a way to suppress a chapter from being numbered? Using that route, the front and back matter file for references heading should be deleted.

@ulyngs
Copy link
Owner

ulyngs commented Jun 8, 2022

The bibtitle error you get is because I changed the way in which the reference section heading is inserted, after I provided the guidance above. (In the current version, the reference heading is generated by front-and-back-matter/99-references_heading.Rmd instead of via a bibtitle parameter in the LaTeX template.)

I just updated the instructions -- can you try if they work now?

@tomislavmedak
Copy link

When following instructions, adding the code-chunk at the end of the last chapter, allowing use-biblatex in index.Rmd and commenting out REFERENCES section in template.tex, it works as per usual. Appendices are generated before references.

@ulyngs
Copy link
Owner

ulyngs commented Sep 18, 2022

The pandoc ref-placement div (https://pandoc.org/MANUAL.html) is now included in front-and-back-matter/99-references_heading.Rmd, so in order to reorder the appendices and references, just reorder those two files (by default, the files are put together in alphabetical order, so you can simply rename to 98-references_heading.Rmd and 99-appendices.Rmd)

@tomislavmedak
Copy link

tomislavmedak commented Sep 25, 2022 via email

@JohannesNE
Copy link
Contributor

The pandoc ref-placement div (https://pandoc.org/MANUAL.html) is now included in front-and-back-matter/99-references_heading.Rmd, so in order to reorder the appendices and references, just reorder those two files (by default, the files are put together in alphabetical order, so you can simply rename to 98-references_heading.Rmd and 99-appendices.Rmd)

This worked for me. Thanks

@ulyngs ulyngs closed this as completed Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants