2014-09-12 9 views
5

LaTeX si arresta in modo anomalo quando viene eseguito sull'output di questo documento knitr perché i caratteri speciali LaTeX non sono correttamente sfuggiti. Qualche suggerimento su come risolvere questo problema?

\documentclass{beamer} 
\begin{document} 
\begin{frame}{Unescaped dollar signs and tildes} 

In this example, neither the tilde nor the dollar sign 
will appear in the pdf document, and the dollar sign 
will cause a \LaTeX error. 

<<xtable, results="asis">>= 
n <- 100 

x <- rnorm(n) 

y <- 2*x + rnorm(n) 

out <- lm(y ~ x) 

library(xtable) 

xtable(summary(out)$coef, digits=c(0, 2, 2, 1, 2)) 
@ 

\end{frame} 
\end{document} 

risposta

3

è necessario aggiungere [fragile] opzione se il frame contiene un pezzo knitr con caratteri speciali in lattice:

\begin{frame}[fragile] 

Fonte: knitr webpage.