Problems printing special characters (slovene) in latex reports

I am having trouble printing special characters (ščž) in a pdf report made by knitr.

\documentclass[a4paper, 12pt, oneside]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[slovene]{babel} \begin{document} <<>>= plot(runif(100), main = "ŠČĆŽ ščćž") @ \end{document} 

enter image description here

+4
source share
1 answer

Based on Yihui comments (see also comments below), here is a solution that worked for me. The .Rnw document I'm working with is encoded as UTF-8.

The key must indicate the encoding on knit .

enter image description here

Please note that we still do not see "č" (for media without media, you can read this character as "ch").

The problem can be solved by specifying a different printing device. Try specifying dev = "CairoPDF" (requires the optional CairoPDF package) or dev = "cairo_pdf" (doesn't require the additional packages) in your chunk option.

 <<dev = "CairoPDF">>= plot(runif(100), main = "ŠČĆŽ ščćž") @ 

or

 <<dev = "cairo_pdf">>= plot(runif(100), main = "ŠČĆŽ ščćž") @ 

enter image description here

If you use Eclipse + StatET to frict your reports, you can configure these options to automate your workflow.

enter image description here

+4
source

Source: https://habr.com/ru/post/1484604/


All Articles