TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using LyX and have created a document that includes numerous images. I'm wondering if it's possible to reference the path and file name to the images in LyX so that when I compile and create my PDF document, the new images with the same file name as the old file name referenced in the document will be displayed?

For example, when I originally create my document I will have a reference to myimage1.pdf. When I compile my document I see myimage1.pdf just fine as I would expect. However, my LyX document contains some code that executes external program code that generates new graphics when LyX the document is compiled and the PDF generated. After generating a new PDF, I'd like my LyX document to pull in the newly created myimage1.pdf. Currently, LyX seems to be rending the document with the old image. When I generate the document a second time, it pulls in the correct images (presumably because the new myimpage1.pdf is available initially at run-time). Is there any way to get this to work without have the image available in advance of generating my PDF?

share|improve this question
TeX will grab whatever is available in the form of myimage1.pdf at the time of compilation. Are you saying that you change myimage1.pdf during compilation? – Werner Sep 9 '13 at 5:21
Yes, myimage1.pdf changes at compile time. – StatsStudent Sep 9 '13 at 5:51
@Werner This would need some more info and a small example. When I am thinking about embedded R code (i.e. sweave or knitr), this should be handled as expected, i.e code executed and graph generated and inserted. Other code might have different approaches. Without further info, I would suggest to look at the copiers in LyX, or the command line compilation of the LyX document, so that you could e.g. run it twice? – Rainer Sep 11 '13 at 7:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.