yihui / bookdown-crc

A minimal example of using bookdown to write a book for Chapman & Hall/CRC
https://yihui.name/en/2018/08/bookdown-crc/
MIT License
72 stars 66 forks source link

Rendering of unicode characters fails #2

Closed henningsway closed 5 years ago

henningsway commented 5 years ago

I'm just starting to experiment with this template, but I keep running into the same issues regarding unicode characters.

With a fresh clone of this repo and the addtition of

library(lobstr)
ast(1 + 1)

which should render

█─+ ├─1 └─1

I start running into encoding problems.

> ! Package inputenc Error: Unicode char █ (U+2588)

> (inputenc) not set up for use with LaTeX.

> Error: Failed to compile bookdown.tex. See bookdown.log for more info.

I have seen Hadley adress this issue in the preamble of Advanced R: https://github.com/hadley/adv-r/blob/master/latex/preamble.tex#L24 and I've experimented with using that preamble or including the code-block in the preamble of this project.

I also tried both pdflatex and xelatex as a pdf-engine and am not entirely sure how to best proceed from here.

henningsway commented 5 years ago

Hadleys workaround actually fixes the issue.

I had to install and use "xelatex" and a couple of packages (linked in the referenced issue above) to get it to work.

yihui commented 5 years ago

Good to know. Had you installed TinyTeX (https://bookdown.org/yihui/rmarkdown/installation.html), you wouldn't even need to go through these steps of installing xelatex or any LaTeX packages, since the installation will be automatic.