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 80 forks source link

unable to build book #3

Closed rPromptt closed 4 years ago

rPromptt commented 5 years ago

I am able to knit the individual files without any issues , however, attempt to compile the entire files by hitting build book spits out the following error:

pandoc: unrecognized option `--lua-filter=scripts_and_filters/correction_filter.lua' Try pandoc --help for more information. Error: pandoc document conversion failed with error 2.

In addition, there seems to be a conflict btwn these files [index.Rdm & main.Rmd], because even upon replacing the above Pandoc's argument with the one in bookdown ("Yihui Xie"), ie, pandoc_args: --top-level-division=chapter? it also spits out a different error prompt:

The file _main.Rmd exists. Please delete it if it was automatically generated, or set a different book_filename option in _bookdown.yml. If you are sure it can be safely deleted, please set the option 'delete_merged_file' to true in _bookdown.yml.

gozervandechat commented 5 years ago

Try if the following works:

to false

Always delete the _main.Rmd after a failed build attempt and press build all again.

Best

rPromptt commented 5 years ago

It worked perfectly thanks:), except for a few lines of trivial warnings. Whilst you're still here, any idea on advanced customisation since this is what controls the overall outlook of the book. For instance, I added the krantz.cls (from Yihui's repo) to the file directories and also updated the index.Rmd with the "krantz" documentclass, however, there was no discernible difference with these customisations upon rendering the pdf. Thanks

gozervandechat commented 5 years ago

Hey I am not an expert, that's why I use the template. But when I tried to replicate the building of my pdf on someone else's pc I stumbled upon the same problem as you. Funnily, I also yesterday found out this works.

Anyway open the tex template in the template folder, replace ociamthesis in \documentclass[a4paper, $if(page-layout)$$page-layout$$endif$]{templates/ociamthesis} (and everywhere else where ociamthesis appears) with krantz. Paste krantz into the template folder. See if it works?

rPromptt commented 5 years ago

Hi Ulyngs, no it did not work but thanks for the helps so far - at least I am now able to compile pdf. I'll adapt your template as much as I am technically able to in order to suit my need. Unfortunately, Yihui did not treat this topic properly [advance customisation for PDF compilation] in his bookdown documentation as I've noticed a lot of submissions in the community about rendering pdf_book.

giuliagrisot commented 5 years ago

hi, I have a slightly different problem with the same effect (i am unable to build): following the very first steps of the video tutorial, if i click on build all, i get the following error:

! Package fontenc Error: Encoding file `lgrenc.def' not found.
(fontenc)                You might have misspelt the name of the encoding.

Error: Failed to compile _main.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See _main.log for more info.
Execution halted
make: *** [Makefile:2: pdf] Error 1

Exited with status 2.

and when typing make gitbook, the following"

Output created: docs/index.html
[1] "C:/Users/Giulia/OneDrive - The University of Nottingham/Latex/Thesis_Grisot_OD/docs/index.html"
Rscript -e 'browseURL("docs/index.html")'
Error in shell.exec(url) : 'docs/index.html' not found
Calls: browseURL -> shell.exec
Execution halted
make: *** [Makefile:8: gitbook] Error 1

any idea what should i do?

ulyngs commented 4 years ago

@giuliagrisot:

@rPromptt: Are you on a Windows machine?

ss4ws commented 4 years ago

Hi @ulyngs, Thanks for all your work putting together the oxforddown! Although, I can render individual chapter in pdf and word files, I am unable to compile the whole thesis in a pdf book and here is the error I am getting:

Error in rmarkdown::render_site(output_format = "bookdown::pdf_book",  : 
  No site generator found.
Execution halted

Would you have any tips on how to solve this issue? Time is pressing... I have to send my thesis this week.
Many thanks for your help.

ulyngs commented 4 years ago

@ss4ws You need to provide more information for me to understand the issue, but:

ss4ws commented 4 years ago

Hi @ulyngs, thanks for writing back. Below I am answering to your bullet points.

Quitting from lines 427-429 (_main.Rmd) 
Error in loadNamespace(name) : there is no package called 'reticulate'
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
The 'python' engine in knitr requires the reticulate package. If you do not want to use the reticulate package, set the chunk option python.reticulate = FALSE. 
Execution halted
make: *** [pdf] Error 1

Exited with status 2.
ss4ws commented 4 years ago

@ulyngs update:

Rscript -e 'bookdown::render_book("index.Rmd", output_format = "bookdown::pdf_book")'
Error in match.arg(citation_package) : 
  'arg' should be one of “none”, “natbib”, “biblatex”
Calls: <Anonymous> ... get_base_format -> do.call -> <Anonymous> -> match.arg
Execution halted
make: *** [pdf] Error 1
ulyngs commented 4 years ago

The 'citation_package' error suggests that you've done something to the index.Rmd file - is should have citation_package: biblatex set as option under bookdown::pdf_book (see index.Rmd in the demo repository).

Other than that, if the demo repository works, then just carefully take a look at what changes you've made. Other things I note:

ss4ws commented 4 years ago

Hi @ulyngs thank you for your tips and your patience while I am trying to resolve these errors!

/usr/local/bin/pandoc +RTS -K512m -RTS _main.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output _main.tex --self-contained --table-of-contents --toc-depth 2 --template templates/template.tex --number-sections --highlight-style tango --pdf-engine pdflatex --biblatex --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/lua/latex-div.lua --wrap preserve --lua-filter=scripts_and_filters/correction_filter.lua --include-in-header /var/folders/ym/pmrvzv993psc1c4w4dvbwg180000gn/T//Rtmp55gUpy/rmarkdown-str3021684f0d2f.html --variable tables=yes --standalone -Mhas-frontmatter=false 

! LaTeX Error: Option clash for package hyperref.

Error: LaTeX failed to compile _main.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See _main.log for more info.
Execution halted
make: *** [pdf] Error 1

Exited with status 2.

update:

I commented out \usepackage[colorlinks=false,pdfpagelabels,hidelinks=$hidelinks$]{hyperref} in the template.tex file and I tried to build again with yet a new error as a result.

! Package pdftex.def Error: File `figures/beltcrest.pdf' not found.

Error: LaTeX failed to compile _main.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See _main.log for more info.
Execution halted
make: *** [pdf] Error 1

Exited with status 2.
ulyngs commented 4 years ago

... is there a file named beltcrest.pdf in the figures folder?

On the clashing options for the hyperref package, did you add any additional options for this? Also, could you show what the YAML front matter in your index.Rmd file looks like?

ss4ws commented 4 years ago

Hi @ulyngs, Thanks for your assistance. I replaced the beltcrest.pdf figure with the logo of the University of Virginia from which I am graduating. I don't think I intentionally added any options for the hyperref package ---I hope I didn't inadvertently introduce a bug. As for the index.Rmd yaml please see below:

---
#####################
## thesis metadata ##
#####################
title: |
  _Brouillon.net:_ \
  Le rôle des blogs et sites web dans la création littéraire. \
author: Spyridon Simotas
college: University of Virginia
degree: PhD
degreedate: 2020
abstract: |
  `r paste(readLines("front-and-back-matter/_abstract.Rmd"), collapse = '\n  ')`
acknowledgements: |
  `r paste(readLines("front-and-back-matter/_acknowledgements.Rmd"), collapse = '\n  ')`
dedication: |
  À mon père. \
  À B.
abbreviations: "front-and-back-matter/abbreviations" # path to .tex file with abbreviations

#######################
## bibliography path ##
#######################
bibliography: references.bib
bibliography-heading-in-pdf: Bibliographie

#####################
## PDF formatting  ##
#####################
abstractseparate: true # include front page w/ abstract for examination schools?
bib-humanities: true #set to true if you want in-text references formatted as author-year
doi-in-bibliography: true #set to true if you want DOI's to be shown in the bibliography
draft: false # add as DRAFT mark in the footer?
page-layout: nobind #'nobind' for PDF output (equal margins), 'twoside' for two-sided binding (mirror margins and blank pages), leave blank for one-sided binding (left margin > right margin)
hidelinks: true #if false, the PDF output highlights clickable links with a colored border - you will probably want to set this to true for PDF version you wish to physically print
toc-depth: 2 # depth of heading to include in table of contents
lof: true # list of figures in front matter?
lot: true # list of tables in front matter?
mini-toc: false  # mini-table of contents at start of each chapter? (this just prepares it; you must also add \minitoc after the chapter titles)
mini-lot: false  # mini-list of tables by start of each chapter?
mini-lof: false  # mini-list of figures by start of each chapter?

params:
  corrections: false # set false to stop applying blue background to blocks of corrections

#####################
## output options  ##
#####################
output:
  bookdown::pdf_book:
    template: templates/template.tex
    keep_tex: true
    citation_package: biblatex  
    pandoc_args: ["--lua-filter=scripts_and_filters/correction_filter.lua"] #remove filter to stop applying blue background to inline corrections
  bookdown::gitbook:
    css: templates/style.css
    config:
      sharing:
        facebook: false
        twitter: false
        all: false
  bookdown::word_document2:
    toc: true   
link-citations: true
documentclass: book

---

By the way since yesterday I have been getting the following error:

 Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.1169 ...tocite{hendlerSyzygySurferCreative2011} 
                                                  nous rappellent que ``surf...
ulyngs commented 4 years ago

ah we're getting somewhere now - for the error you're getting now, as the error message suggests, take a look at line 1169 in the generated tex file and see what's going on around "tocite{hendlerSyzygySurferCreative2011}"

Also, a general debugging tip at this stage (because it seems the problem is now in some part of your actual text) is to just cut the problem into smaller pieces - e.g., try only including one chapter of your thesis and see if it compiles correctly.