[texworks] Suggestion: set the PATH before running tools

Duncan Murdoch murdoch.duncan at gmail.com
Sun Dec 4 18:28:26 CET 2022


Just one more comment about the problem I'm trying to solve, in case 
anyone has a suggestion of a different solution.

I'm working on support for R Markdown PDF documents in TeXworks.  I have 
got support for Synctex working in R Markdown, so if I open the PDF 
output and click on "Jump to Source", the TeXworks editor will show me 
the original R Markdown source file at the right place, and "Jump to 
PDF" also works.

What's not working so well just now is the Typesetting step.  I have a 
tool set up to use R code to render the source file into a PDF, but it 
needs to use Pandoc to convert the Markdown to LaTeX for processing.

For R users, Pandoc is typically installed with RStudio, and if you run 
everything from RStudio it will be found.  However, I'd rather be doing 
my editing in TeXworks (since RStudio doesn't support Synctex), and I'm 
trying to work out user-friendly instructions for other users to do the 
same.

Two ways I know of to set the Pandoc location are to make sure it is on 
the PATH or in the RSTUDIO_PANDOC environment variable.  My suggestion 
in this thread was that TeXworks should modify the PATH so that the user 
could enter the Pandoc location there.

Another way to go would be to get users to put a soft link to Pandoc in 
some directory on the path.  This seems like a more invasive thing to 
request them to do, but it's relatively easy, e.g. in RStudio,

   file.symlink(rmarkdown::pandoc_exec(), "/usr/local/bin")

This doesn't necessarily work in plain R because 
rmarkdown::pandoc_exec() can fail there.

Duncan Murdoch


More information about the texworks mailing list.