Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

PGF has a nice feature, declaring an image and re-using it again and again. With a PDF backend, it reduces the size of the output, as the image is embedded in the file only once. However, the PGF manual clearly states that LaTeX users should prefer \includegraphics to this mechanism.

Is it possible to mimic this feature, i.e., reusing an image without increasing the file size, using LaTeX's native graphics packages? Would putting the image in a box do this effect?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

\includegraphics does the trick itself.

share|improve this answer
1  
For PDF output I'm sure of that, but not for DVI/PS. There it might depend on the dvips tool used. Also AFAIK the pgf graphic commands are using \includegraphics internally for PDF output. –  Martin Scharrer Apr 17 '11 at 7:48
    
DVI does not contain images. pdfTeX, dvipdfm(x), XeTeX and LuaTeX reuse the images for pdf output. However, indeed, dvips copys the code repeatedly and produces huge .ps file. It seems limited by the background graphics driver. I've no idea for that. –  Leo Liu Apr 17 '11 at 9:08
    
@Martin The pgf graphic commands directly use pdftex commands if the pdftex output driver is used. For other drivers (including ps unless I am mistaken), the fallback is to use \includegraphics. I believe that there might be a difference between pgf and \includegraphics when using the pdftex engine (I have related remarks of the pgf manual in mind... but perhaps \includegraphics has the related features now as well). –  Christian Feuersänger Apr 22 '11 at 22:19
    
@Christian: Thanks for pointing this out. –  Martin Scharrer Apr 23 '11 at 4:36

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.