ulyngs / oxforddown

Template for writing an Oxford University thesis in R Markdown; uses the OxThesis LaTeX template and was inspired by thesisdown.
https://ulyngs.github.io/oxforddown/
MIT License
220 stars 81 forks source link

PDF references not formatting with single chapter template #66

Closed mari-lynne closed 1 year ago

mari-lynne commented 1 year ago

Hiya,

Unfortunately when knitting to PDF and using brief_template.tex I get several errors shown below, and the references don't knit.

I double checked my .bib file which works fine in the HTML output. I have also tried modifying the order of several packages as suggested, updated my R packages, but still with no luck. I'm using TinyTeX as my latex distribution.

Thanks for any insight - I'm new to latex so apologies if I'm missing something obvious.

Warnings

Warning: LaTeX Warning: Command \@parboxrestore  has changed.
Warning:                Check if current package is valid.
Warning: Package fvextra Warning: csquotes should be loaded after fvextra, to avoid a warning from the lineno package on input line 37.
Warning: Package biblatex Warning: Language 'latin' not supported.
Warning: (biblatex)                Using dummy definitions on input line 161.
Warning: LaTeX Warning: Citation 'Jin2017' on page 1 undefined on input line 185.
Warning: Package biblatex Warning: Please (re)run Biber on the file:
Warning: (biblatex)                03-vaccination-adnob
Warning: (biblatex)                and rerun LaTeX afterwards

Fixes Here is what I've added so far to brief_templates.tex at line 23, but with no improvement.

%%% MJ UPDATES Oct3 2022 %%%
% MJ read fvextra before csquotes
\usepackage{fvextra}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}

% MJ - explicitly loading cs quotes after fvextra
\usepackage{csquotes}

% MJ - \@parboxrestore has changed - use lineno package
\usepackage{lineno}

Session Info:

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS
Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8   
 [6] LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] tinytex_0.42
loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1    xfun_0.33 
ulyngs commented 1 year ago

Did you specify a bibliography for the chapter? (When you knit a single chapter, then it is knitted based on the YAML header in this chapter -- does it have one, and does it include a bibliography?)

I believe it's commented out by default (you want the bibliography to be commend out for the individual chapters when you knit the entire thesis)

I.e. change this in the heading of your doc

#bibliography: bibliography/your-references.bib

to

bibliography: bibliography/your-references.bib
mari-lynne commented 1 year ago

Hello - yes I have included it in the YAML header as such. It works with HTML and word, which makes me think it's a PDF-latex problem

ulyngs commented 1 year ago

I've fixed it now -- this occurred because I forgot to update the brief latex template when I revised the way the full template toggles between different citation packages.. doh! Thanks for flagging this.

See if it works if you replace your brief latex template with the content in the one I just pushed to gh

mari-lynne commented 1 year ago

No problem - thanks for checking :) Unfortunately, it's still not rendering in PDF mode, I get the error ! Package biblatex Error: Nested citation command. warnings() gives In normalizePath("~") : path[1]="/sbuild-nonexistent": No such file or directory

ulyngs commented 1 year ago

What does the YAML header in the chapter you're trying to knit look like?

Try just using pandoc for citations, i.e. remove citation_package: biblatex in your header

ulyngs commented 1 year ago

Ok, I was prompted by this to make the fix that I was too lazy to do until now:

there is now only one single template.tex, which works with both single chapters and the full thesis -- can you see if it works now with the latest templates/template.tex that I've pushed?

mari-lynne commented 1 year ago

Thank you so so much! Both deleting the biblatex line in the brief version, and the updated main version work a treat :)