Workspace users can use the full range of LaTeX packages when creating PDF reports. These allow the creation of more complex reports and are also necessary for using certain LaTeX templates. LaTex packages are installed in a similar way to installing R packages using the LaTex package manager.
Installing LaTex packages
When you are in an active R Console session follow the commands below to install LaTex packages.
Set the repository URL
system("tlmgr --usermode option repository https://anorien.csc.warwick.ac.uk/mirrors/CTAN/systems/texlive/tlnet")
Install the packages Run the below code replacing the package name in
system("tlmgr --usermode install <package_name>",ignore.stderr = TRUE)</package_name>For example:
system("tlmgr --usermode install collection-fontsrecommended",ignore.stderr = TRUE)
The installed packages should now be added to your workspace files in the files/texmf folder. The Latex packages can be used inside .Rnw file to generate PDF reports.
Using the LaTex compiler
LaTex packages can be used to generate PDF reports within the workspace using the following instructions.
Click the "+" button and select the option for a New File. Enter a file name and select "R NoWeb file" (.rnw) as the format.
Once the file opens, add the LaTex content as required to generate your PDF.
Begin an R session or navigate to an existing session and run the following code
setwd(“/home/workspace/files”)replacing filename with the name of your new .rnw file.
A PDF report will be generated and added to the workspace files.
Once the compiler has been used, you may find it useful to change your working directory back to the default using this command: