Dean Attali has just added an R package called ezknitr to CRAN. It enables those who use knitr and RMarkdown in .Rmd files to handle directories quite flexibly. His blog describes it well: path control with ezknitr

Unfortunately, the package doesn't at this time help if knitr compiles an .Rnw file for LaTeX.

Is there a comparable package or code technique to enable the efficient and simple identification of multiple directories (for images, for output, etc.) with LaTeX?

  • it isn't clear exactly what features you are looking for. If TEXINPUTS includes .// as a path segment then tex will find files in any directory below the current directory in the directory tree, this works for \input and \includegraphics and specialised input such as \usepackage – David Carlisle Dec 11 '15 at 12:58
  • @David Carlisle. Thank you, David. I am very new to LaTeX, My .Rnw file is in one directory, but most of the images I draw on with \includegraphics are in two other directories. What do I put in the preamble, therefore, so that tex will find those two directories without me resorting to path definitions, absolute paths, and \graphicspath? Do I use a command like \textinputs{.//} and thereby tell tex to search from my base directory? – lawyeR Dec 11 '15 at 16:48
  • within tex you could use the \graphicspath eg \graphicspath{{dir1/}{dir2/}} command (use texdoc grfguide to see the relevant manual) or more efficiently just set the environment variable TEXINPUTS to be .//: before starting tex – David Carlisle Dec 11 '15 at 19:55
  • Relevant: github.com/daattali/ezknitr/issues/5 – Adam Liter Jan 21 '16 at 2:06
  • @AdamLiter: Thanks, Dean Attalli added that after I wrote to him to see whether there was support for .Rnw. I guess no one took up the opportunity :( – lawyeR Jan 21 '16 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.