Can I use an image located on the web in a LaTeX document?
you could use \write18
and a curl or wget script to grab the image from the web and download it to your directory.
\documentclass{article}
\usepackage{graphicx} % includegraphics command is implemented here
\begin{document}
\write18{wget http://www.some-site.com/path/to/image.png}
\includegraphics{image.png}
\end{document}
note however, that recent versions of miktex and texlive come with restricted versions of \write18, and it some cases you must pass an option to latex to enable it, as in:
pdflatex --shell-escape test.tex
Short answer: no. You will need to download the image and use it locally if you want to include it in your document. pdfTeX and XeTeX do not include the necessary code to grab an image from an arbitrary location.
Of course, you can link to an image at at remote location. You can make use of the hyperref
package to include a suitable link. You might do this using a bit of text:
\href{http://somewhere.com/someplace/some.jpg}{picture here}
or by downloading a local copy and then pointing to the online version
\href{http://somewhere.com/someplace/some.jpg}{\incudegraphics{some.jpg}}
I note from the comments that LuaTeX does include the necessary library to download a copy of an image itself. That would make inclusion possible directly, but I don't know of a pre-build solution for LuaLaTeX. I guess that would be a separate answer in any case.
(Copying from the comments section)
ConTeXt supports this natively:
http://wiki.contextgarden.net/What_is_ConTeXt
The following:
\externalfigure[http://www.site.com/path/to/figure.png]
just works. Behind the scenes, ConTeXt downloads the file to the luatex cache once, and from then on just reuses the figure.
My additional notes:
- If you have MacTeX, you don't need to do any extra installation. Just change the typesetting option inside your TeX editor.
- I couldn't get
this to work in TeXShop, but it works fine in TeXWorks. Also, I had
to use
ConTeXt (LuaTeX)
. It didn't work when I triedConTeXt (pdfTeX)
.