Fail to generate pdf using bookdown/thesisdown

Hi there, I'd like to use a bookdown (thesisdown) template when draftinging my thesis.

However, when I knit this template, I couldn't generate the pdf and got the following error:

processing file: thesis.Rmd
  |..                                                                    |   3%
   inline R code fragments

  |....                                                                  |   5%
label: include_packages (with options) 
List of 1
 $ include: logi FALSE

  |......                                                                |   8%
  ordinary text without R code

  |........                                                              |  11%
label: cars
  |.........                                                             |  14%
   inline R code fragments

  |...........                                                           |  16%
label: pressure (with options) 
List of 2
 $ echo : logi FALSE
 $ cache: logi TRUE

  |.............                                                         |  19%
  ordinary text without R code

  |...............                                                       |  22%
label: load_data
  |.................                                                     |  24%
  ordinary text without R code

  |...................                                                   |  27%
label: str
  |.....................                                                 |  30%
  ordinary text without R code

  |.......................                                               |  32%
label: view_flights (with options) 
List of 1
 $ eval: logi FALSE

  |.........................                                             |  35%
  ordinary text without R code

  |..........................                                            |  38%
label: load_pkgs (with options) 
List of 1
 $ message: logi FALSE

  |............................                                          |  41%
  ordinary text without R code

  |..............................                                        |  43%
label: max_delays
  |................................                                      |  46%
  ordinary text without R code

  |..................................                                    |  49%
label: maxdelays (with options) 
List of 1
 $ results: chr "asis"

  |....................................                                  |  51%
  ordinary text without R code

  |......................................                                |  54%
label: max_props
  |........................................                              |  57%
  ordinary text without R code

  |..........................................                            |  59%
label: march3plot (with options) 
List of 2
 $ fig.height: num 3
 $ fig.width : num 6

  |............................................                          |  62%
  ordinary text without R code

  |.............................................                         |  65%
label: include_packages_2 (with options) 
List of 1
 $ include: logi FALSE

  |...............................................                       |  68%
  ordinary text without R code

  |.................................................                     |  70%
label: randfield (with options) 
List of 1
 $ fig.cap: chr "Random Field"

  |...................................................                   |  73%
  ordinary text without R code

  |.....................................................                 |  76%
label: delaysboxplot (with options) 
List of 4
 $ warnings : logi FALSE
 $ messages : logi FALSE
 $ fig.cap  : chr "Mean Delays by Airline"
 $ fig.width: num 6

  |.......................................................               |  78%
  ordinary text without R code

  |.........................................................             |  81%
label: mathg (with options) 
List of 4
 $ results  : chr "asis"
 $ echo     : logi FALSE
 $ fig.cap  : chr "Subdiv. graph"
 $ out.extra: chr "scale=0.75"

  |...........................................................           |  84%
  ordinary text without R code

  |.............................................................         |  86%
label: mathg2 (with options) 
List of 4
 $ results  : chr "asis"
 $ echo     : logi FALSE
 $ out.extra: chr "angle=180, scale=1.1"
 $ fig.cap  : chr "A Larger Figure, Flipped Upside Down"

  |..............................................................        |  89%
   inline R code fragments

  |................................................................      |  92%
label: unnamed-chunk-1 (with options) 
List of 3
 $ ref.label: chr "include_packages"
 $ results  : chr "hide"
 $ echo     : logi TRUE

  |..................................................................    |  95%
  ordinary text without R code

  |....................................................................  |  97%
label: unnamed-chunk-2 (with options) 
List of 3
 $ ref.label: chr "include_packages_2"
 $ results  : chr "hide"
 $ echo     : logi TRUE

  |......................................................................| 100%
  ordinary text without R code


/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS thesis.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output thesis.tex --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmarkdown/lua/latex-div.lua --metadata-file /var/folders/jj/0nmx6s3s0ns5b1lq7kmn7kx80000gn/T//RtmpV25IuJ/file500963045845 --self-contained --table-of-contents --toc-depth 3 --template template.tex --number-sections --highlight-style pygments --pdf-engine pdflatex --wrap preserve --top-level-division=chapter --variable tables=yes --standalone -Mhas-frontmatter=false --citeproc 
output file: thesis.knit.md

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
I was unable to find any missing LaTeX packages from the error log thesis.log.
! Undefined control sequence.
<argument> @{} >{\centering \arraybackslash 
                                            }p{(\columnwidth - 4\tabcolsep )...
l.575 ...mnwidth - 4\tabcolsep) * \real{0.18}}@{}}

Error: LaTeX failed to compile thesis.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See thesis.log for more info.
Execution halted

I went through the debugging suggestion on @yihui's website, but it still doesn't work. Hope I can get more suggestions here.

Your kind guidance is much appreciated!

It seems there is an issue with the template. A latex package is missing and tinytex have not found it in the log to guess which one to install. IMO You should look and open an issue in https://github.com/thomas-fung/thesisdownmq

There has been a lingering issues with pandoc that should now be removed from Chapter 3 of the template of thesisdown. Please try a fresh install by running remotes::install_github("ismayc/thesisdown") and knit of the template. If you have further problems, it's best to file an issue on the thesisdown issues page. Thanks!

1 Like

Thanks to @chesterismay's advice, the template works again after I add the following lines in the template.tex file:

$if(csl-refs)$
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newenvironment{CSLReferences}%
  {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  {\par}
\newenvironment{cslreferences}%
  {$if(csl-hanging-indent)$\setlength{\parindent}{0pt}%
  \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces$endif$}%
  {\par}
$endif$

And thanks @cderv. I've opened an issue in this template's github for updating.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.