1

I noticed that \includegraphics can be used to embed either a PDF or a PNG (and possibly other things as well).

Although both are allowed, is there one which is less finicky / less prone to cause errors than the other?

Others have asked how to embed an image file or pdf, but I only want to know which choice (if it matters) is considered best practice.

Martin Scharrer
  • 262,582
IdleCustard
  • 1,194
  • That's a bit of an odd link I suggest you replace that one as its how to embed the raw ascii hex data for an image not .pdf or .png binary as such. also this question is likely to to be frowned on if you don't explain why you think there may be a preference for one over the other as PDF can be much more complex than PNG which in itself would negate your need for an answer –  Jan 07 '19 at 02:57
  • 3
    The is answer is "it depends". What is your intended output destination (home printer/digital print/offset print) and the related question what is your required output colour space (Gray/RGB/CMYK). What format is the original image from which you make the PNG or PDF (or what application made it)? What type of image is it (diagram, photo, etc.)? I prefer JPG for photos and vector based PDF for anything else. Of course, there is no gain in using a PDF if your PDF is simply a PNG converted to PDF. – David Purton Jan 07 '19 at 03:22
  • 1
    @DavidPurton: There is a speed gain (PDF inclusion is in real world situations faster than PNG inclusion). – TeXnician Jan 07 '19 at 05:39
  • 1
    If you include a PDF which does not have all its fonts included there might be viewing issues by future readers if they don't have the fonts installed locally. – Martin Scharrer Jan 07 '19 at 07:02
  • As @DavidPurton already stated it depends on the content. Have a look at my answer to another image question where I describe it in more detail. – Martin Scharrer Jan 07 '19 at 07:03
  • In a recent discussion (I think it was on the texlive mailing list), it was noted that png is not actually supported by the pdf format, but pdflatex has build in libs to convert png to the internal bitmap format used by pdf. It has to do this conversion every time you compile. So here is the speed gain TeXnician mentions: preconvert ongs to pdf, preferably using sam2p, to get a massive speed gain if you use a lot of pngs – daleif Jan 07 '19 at 07:07
  • 1
    @MartinScharrer It might be an idea to add that PNG vs PDF discussion to the answer you refer to (a very good summary) – daleif Jan 07 '19 at 08:11

0 Answers0