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
221 stars 81 forks source link

Instructions on using TinyTeX #20

Closed yihui closed 3 years ago

yihui commented 3 years ago

Following #4, I tried to build this project with TinyTeX, and below is what I found, which could be used to update the LaTeX requirements in readme: https://github.com/ulyngs/oxforddown#requirements

First install the base TinyTeX:

remotes::install_github('yihui/tinytex')
tinytex::install_tinytex()
p1 = tinytex::tl_pkgs()

Then render the book, and let tinytex automatically install missing LaTeX packages (this will take a while for the first time):

bookdown::render_book('index.Rmd')
p2 = tinytex::tl_pkgs()

Check which new packages were required:

p3 = setdiff(p2, p1) 

So the instructions on using TinyTeX can tell users to install these additional packages (so normal users won't need to do the above steps by themselves but simply run the code below):

p3 = c(
  "appendix", "babel-english", "babel-greek", "babel-latin", 
  "biber", "biblatex", "caption", "cbfonts-fd", "colortbl", "csquotes", 
  "enumitem", "environ", "eso-pic", "fancyhdr", "greek-fontenc", 
  "grfext", "hyphen-greek", "hyphen-latin", "lineno", "logreq", 
  "makecell", "microtype", "minitoc", "multirow", "notoccite", 
  "oberdiek", "pdflscape", "pdfpages", "quotchap", "soul", "tabu", 
  "threeparttable", "threeparttablex", "titlesec", "tocbibind", 
  "trimspaces", "ulem", "units", "utopia", "varwidth", "wrapfig"
)
tinytex::tlmgr_install(p3)

Then this 280Mb TinyTeX should match the 4Gb MiKTeX and produce the expected PDF output.

ulyngs commented 3 years ago

This is fantastic, will update the readme! Thank you so much for looking into this, Yihui! 😄

Point of clarification: Why would an ordinary user explicitly run tinytex::tlmgr_install(p3) --- TinyTex will install these automatically anyway, no?

Was your point just to clarify what the additional packages are that should be installed by TinyTex upon the first build?

yihui commented 3 years ago

TinyTeX will install these automatically anyway, no?

Yes, but it will take a long time for the first-time users, because TinyTeX will try to install packages one by one only after failed compilations. I don't remember how many attempts it had to make to figure out all missing packages (I remember it took at least five minutes or perhaps ten minutes); p3 contains 41 packages, so this project may have to be recompiled for ~30 times for the first time.

Was your point just to clarify what the additional packages are that should be installed by TinyTeX upon the first build?

Exactly.

ulyngs commented 3 years ago

I've updated the readme now, thank you Yihui!!

yihui commented 3 years ago

Perfect! You are welcome! I'd like to also thank @bttomio for the help with https://github.com/yihui/tinytex/issues/303, which I wouldn't be able to figure out by myself.

ulyngs commented 3 years ago

Perfect! You are welcome! I'd like to also thank @bttomio for the help with yihui/tinytex#303, which I wouldn't be able to figure out by myself.

Does this issue mean that the latex package psnfss should be added to the list of packages to install with tinytex::tlmgr_install? (it's not included in the list above)

yihui commented 3 years ago

No, I've included it in the base installation, which is how I fixed yihui/tinytex#303.