encoding - Using Knitr engine in TeXshop but pdf plot labels with accented letters are incorrect -
i want compile next rnw file containing r plot of normal density function.
\documentclass{amsart} \usepackage[a4paper]{geometry} \usepackage[italian]{babel} \usepackage[utf8]{inputenc} \usepackage[t1]{fontenc} \usepackage{lmodern} %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <<setup, include=false, cache=false>>= opts_chunk$set(dev = "pdf", comment = na, fig.align='center', cache=false, message=false, background='white') options(replace.assign=true, width=85) knit_hooks$set(fig=function(before, options, envir){if (before) par(mar=c(4,4,.1,.1),cex.lab=.95,cex.axis=.9,mgp=c(2,.7,0),tcl=-.3)}) @ <<prepare-data, include=false>>= @ %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \begin{document} plot italian caption ``densità'' means ``density''. <<norm, echo = false, fig.width=4, fig.height=3.5>>= curve(dnorm(x), -4, 4, xlab = 'z', ylab = 'densità') @ \end{document}
the file has utf-8 encoding.
then compile file r , knitr
rscript -e "library(knitr); knit2pdf('~/desktop/label.rnw')"
i right plot label "densità" (in italian means density, lastly letter accented).
i'm using macosx 10.10 yosemite , r locale
> sessioninfo() r version 3.1.1 (2014-07-10) platform: x86_64-apple-darwin13.1.0 (64-bit) locale: [1] en_us.utf-8/en_us.utf-8/en_us.utf-8/c/en_us.utf-8/en_us.utf-8 attached base of operations packages: [1] stats graphics grdevices utils datasets methods base of operations loaded via namespace (and not attached): [1] tools_3.1.1
the problem comes using texshop. utilize knitr.engine suggested here: http://yihui.name/knitr/demo/editors/ , compile file label.rnw.
now wrong label in plot, i.e., "density" becomes "densit..". right accented letters in text.
anybody knows why?
encoding text-editor knitr
No comments:
Post a Comment