[Tex/LaTex] Programmatically load an image from LyX

lyxshell-escape

Following the accepted answer to this question: Can I use an image located on the web in a LaTeX document?

I am trying to insert the following code to a trivial LyX document:

\write18{wget "http://cdn.sstatic.net/tex/img/logo.png" -O "/home/erelsgl/logo.png"}

I export the document to PS, but the file is not downloaded, and I get no error message (the trivial LyX document is indeed shown in PS).

How can I make LyX run the command?

I saw that there is a "shell-escape" argument that should be passed to the tex file processor, but how do I access it from LyX?

Best Answer

You did add the \write18 in an ERT, or the preamble?

I think you add the --shell-escape flag in Tools --> Preferences --> File Handling --> Converters. If you use pdfLaTeX to compile your document, find the entry in the list called LaTeX (pdfLaTeX) -> PDF (pdflatex). Add --shell-escape in the Converter field, between pdflatex and $$i:

preferences window