caseywdunn / phylogenetic_biology

A book for my course
17 stars 7 forks source link

problems knitting to pdf #42

Closed caseywdunn closed 2 years ago

caseywdunn commented 4 years ago

through chapter 6, had only run Buil Book with gitbook output. Now want to Build Book to pdf and ensure both output formats moving forward. Resolved some issues, but these still remain:

LaTeX Warning: Reference `eq:jc69' on page 53 undefined on input line 980.

! Missing $ inserted.
<inserted text> 
                $
l.983 

Here is how much of TeX's memory you used:
 18584 strings out of 479465
 323958 string characters out of 5881418
 785041 words of memory out of 5000000
 37582 multiletter control sequences out of 15000+600000
 541685 words of font info for 88 fonts, out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 84i,7n,118p,1251b,568s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on phylogenetic_biology.pdf (52 pages).

Some relevant links on this error:

https://www.overleaf.com/learn/latex/Errors/Missing%20$%20inserted

https://tex.stackexchange.com/questions/52804/missing-inserted-inserted-text (suggests that it could be a math character pulled in from bib)

caseywdunn commented 4 years ago

I am using tinytex latex distribution. Didn't see anything at https://yihui.org/tinytex/r/#debugging

caseywdunn commented 4 years ago

After creating docker environment, now get the following error when attempting to create pdf:

bookdown::render_book("index.Rmd", "bookdown::pdf_book")
...
output file: phylogenetic_biology.knit.md

Error: Functions that produce HTML output found in document targeting latex output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

  always_allow_html: true

Note however that the HTML output will not be visible in non-HTML formats.

In addition: Warning message:
Removed 3 rows containing missing values (geom_label). 

Attempting to use Build Book button still results in same error as above.

brevans commented 3 years ago

working through each chapter by swapping out each chapter

_bookdown.yml :

rmd_files: [
  "index.rmd", 
  "intro.rmd",
  CHAPTER
  "references.rmd"
  ]

Error/warning hints for the chapters that fail

simulation.rmd

! Missing $ inserted.
<inserted text> 
                $
l.985 

You may need to add $ $ around a certain inline R expression `r ` in phylogenetic_biology.Rmd. See https://github.com/rstudio/rmarkdown/issues/385 for more info.
Error: LaTeX failed to compile phylogenetic_biology.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See phylogenetic_biology.log for more info.

inference.rmd

Missing character: There is no 𝛱 in font [lmroman10-bold]:mapping=tex-text;!
! LaTeX Error: Unknown float option `H'.

Error: LaTeX failed to compile phylogenetic_biology.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See phylogenetic_biology.log for more info.
In addition: Warning message:
Removed 3 rows containing missing values (geom_label). 

evaluation.rmd

Error: Failed to build the bibliography via bibtex
In addition: Warning message:
bibtex seems to have failed:

This is BibTeX, Version 0.99d (TeX Live 2020)
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: phylogenetic_biology.aux
The style file: apalike.bst
Database file #1: book.bib
Database file #2: packages.bib
Name 3 in "Swofford, DL and Olsen, GJ and Waddell, PJ, and Hillis, DM" has a comma at the end for entry swofford1996molecular
while executing---line 1023 of file apalike.bst
Warning--empty publisher in darwin1859
Name 3 in "Swofford, DL and Olsen, GJ and Waddell, PJ, and Hillis, DM" has a comma at the end for entry swofford1996molecular
while executing---line 1098 of file apalike.bst
Warning--can't use both author and editor fields in swofford1996molecular
You've used 17 entries,
            1935 wiz_defined-function locations,
            588 strings with 7069 characters,
and the built_in function-call counts, 6864 in all, are:
= -- 648
> -- 313
< -- 11
+ -- 112
- -- 108
* -- 614
:= -- 1217
add.period$ -- 5 [... truncated] 
Warning message:
Package natbib Warning: Citation `bookdown2016' on page 5 undefined on input li
ne 109.
Package natbib Warning: Citation `darwin1859' on page 9 undefined on input line
 237.
Package natbib Warning: Citation `haeckel1897' on page 9 undefined on input lin
e 237.
Package natbib Warning: Citation `hennig1966' on page 9 undefined on input line
 237.
Package natbib Warning: Citation `Felsenstein:1981vk' on page 9 undefined on in
put line 237.
LaTeX Warning: Reference `fig:intro-concepts' on page 10 undefined on input lin
e 252.
Package natbib Warning: Citation `Hohna2014' on page 11 undefined on input line
 282.
LaTeX Warning: Reference `fig:intro-concepts' on page 13 undefined on input lin
e 304.
Package natbib Warning: Citation `hadfield2018nextstrain' on page 14 undefined 
on input line 333.
Package natbib Warning: Citation `chang2015genomic' on page 14 undefined on inp
ut line 335.
Package natbib Warning: Citation `dunn2018pairwise' on page 14 undefined on inp
ut line 337.
Package natbib [... truncated]

bayes.rmd

Warning message:
LaTeX Warning: Reference `stats-bayes' on page 18 undefined on input line 367.
LaTeX Warning: There were undefined references

time.rmd

Warning message:
LaTeX Warning: Reference `trees-edge-lengths' on page 17 undefined on input lin
e 356.
LaTeX Warning: Reference `fig:time-cladogram' on page 18 undefined on input lin
e 364.
LaTeX Warning: Reference `tree-properties' on page 20 undefined on input line 4
25.
LaTeX Warning: There were undefined references.
brevans commented 3 years ago

Fixed bibliography, syntax and floating errors in recent commits, so now you at least get a pdf to look at.

Tail of R's console output:

/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS phylogenetic_biology.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output phylogenetic_biology.tex --lua-filter /usr/local/lib/R/site-library/bookdown/rmarkdown/lua/custom-environment.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /usr/local/lib/R/site-library/rmarkdown/rmarkdown/lua/latex-div.lua --metadata-file /tmp/RtmpokERPa/filefb59387b46 --self-contained --table-of-contents --toc-depth 2 --number-sections --highlight-style tango --pdf-engine xelatex --natbib --include-in-header preamble.tex --variable graphics --wrap preserve --variable tables=yes --standalone -Mhas-frontmatter=false 

Output created: docs/phylogenetic_biology.pdf
[1] "/phylogenetic_biology/docs/phylogenetic_biology.pdf"
Warning messages:
1: Removed 3 rows containing missing values (geom_label). 
2: LaTeX Warning: Reference `fig:sim-tree' on page 61 undefined on input line 1189
.
LaTeX Warning: Reference `fig:sim-tree' on page 62 undefined on input line 1194
.
LaTeX Warning: Reference `fig:sim-tree' on page 62 undefined on input line 1194
.
LaTeX Warning: Float too large for page by 69.74217pt on input line 1751.
LaTeX Warning: Float too large for page by 119.59538pt on input line 1848.
LaTeX Warning: Reference `fig:time-cladogram' on page 108 undefined on input li
ne 2055.
LaTeX Warning: There were undefined references. 

Some issues remain, outlined below.

Pi in simulation.rmd, inference.rmd

Capital Greek letter Pi (Π) seems to be getting stuck pointing to the non-math fonts that don't have the right glyph and just gets dropped. Might be good to also read through simulation.rmd and make sure upper and lowecase pi are used consistently.

mathrm is the normal upright Roman font

$\mathrm{\Pi}$

mathnormal is the normal math italic font

$\mathnormal{\Pi}$

Just dollar signs

$\Pi$

mathcal is the special calligraphic font for uppercase letters only

$\mathcal{\Pi}$

mathbf gives upright Roman boldface letters

$\mathbf{\Pi}$

mathsf gives upright sans serif letters

$\mathsf{\Pi}$

mathit gives text italic letters

$\mathit{\Pi}$

mathtt gives upright letters from the typewriter type font

$\mathtt{\Pi}$

mathbb for "blackboard bold" uppercase letters

$\mathbb{\Pi}$

renders

image

With errors like this:

Missing character: There is no 𝛱 in font [lmroman10-bold]:mapping=tex-text;!

A simple rendering of the same .tex with my rudimentary skills or in overleaf doesn't have these issues.

Figure reference in simulation.rmd

An R code block is being rendered to pdf but its metadata don't make it into the .tex file.

https://github.com/caseywdunn/phylogenetic_biology/blob/e77406addca51523f2d9f5f4d641cc591fc5194f/simulation.rmd#L538-L566

becomes just

\includegraphics{phylogenetic_biology_files/figure-latex/sim-tree-1.pdf}

Whereas

https://github.com/caseywdunn/phylogenetic_biology/blob/e77406addca51523f2d9f5f4d641cc591fc5194f/simulation.rmd#L155-L159

becomes

\begin{figure}
\centering
\includegraphics{figures/Fig_cnidaria.png}
\caption{\label{fig:sim-tree-cnid}A published phylogeny \citep{zapata2015} with a scale bar indicating branch length in terms of the expected amount of evolutionary change, rather than absolute time.}
\end{figure}

Because there isn't a label added to the .tex file you get warnings like

LaTeX Warning: Reference `fig:sim-tree' on page 62 undefined

and ?? references in the pdf.

Figures too big?

Finally, a couple Float too large for page warnings for

https://github.com/caseywdunn/phylogenetic_biology/blob/e77406addca51523f2d9f5f4d641cc591fc5194f/evaluation.rmd#L28-L32

and

https://github.com/caseywdunn/phylogenetic_biology/blob/e77406addca51523f2d9f5f4d641cc591fc5194f/evaluation.rmd#L147-L151

caseywdunn commented 2 years ago

knitting to pdf without problems now...