# NOT RUN {
data('iris')
if(interactive()){
# Raw TeX
tex <- '\\begin{tabular}{llr}
\\hline
\\multicolumn{2}{c}{Item} \\\\
\\cline{1-2}
Animal & Description & Price (\\$) \\\\
\\hline
Gnat & per gram & 13.65 \\\\
& each & 0.01 \\\\
Gnu & stuffed & 92.50 \\\\
Emu & stuffed & 33.33 \\\\
Armadillo & frozen & 8.99 \\\\
\\hline
\\end{tabular}'
# knitr kable
mtcars%>%
head()%>%
knitr::kable("latex")%>%
tex_preview()
# with svg output pan/zoom is enabled in the internal viewer
tex_preview(obj = tex,stem = 'eq',imgFormat = 'svg')
# use tex_lines parameter to pass full document
tikz_path <- system.file(
'examples/tikz/credit_rationing.tex',
package = 'texPreview'
)
tex_preview(tex_lines = readLines(tikz_path))
}
# }
Run the code above in your browser using DataLab