objpath <- file.path(getwd(),"slickr_files/figure-html")
if(!dir.exists(objpath))
dir.create(objpath,recursive = TRUE)
tex_opts$set(
fileDir = objpath, # path to save output
returnType = 'html', # return images ready for html
imgFormat = 'svg' # return svg images
)
The first two chunks create outputs to place in the carousel in the last chunk.
tab='
\\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}'
tab%>%
texPreview::tex_preview(stem = 'tex-1')
The images created above are placed in a slickR carousel.
slickR::slickR(
list.files(objpath,full.names = TRUE,pattern = 'svg'),
height = 200,
width = '95%')
#> Warning: The `slickOpts` argument of `slickR()` is deprecated as of slickR 0.5.0.
#> This warning is displayed once per session.
#> Call `lifecycle::last_warnings()` to see where this warning was generated.