For graphs and small figures I have used TIKZ together with tikzexternalize until now, converting all figures into PDF, which then are included. This approach worked nicely, as it also allowed me to scale figures without having issues with the attached fonts.

Now I got feedback from an older colleague (who has used TeX for a longer time than me) that (according to his knowledge) PNG-figures are more standard to use in TeX-documents compared to PDF-figures, as the PDF-format could face font issues.

I was slightly confused about this, as I have never experienced such issues (and prefer PDF in general, due to it being better scalable). Are there configurations where one could run into such issues with PDF-files, but not with PNG-files (for example by using older TeX-installations, or using TeX instead of LaTeX/pdfLaTeX)? Or is that completely impossible?

  • I'm using pdf files without any issue.
    – CarLaTeX
    Dec 6 '21 at 7:14

png is certainly not "more standard". And as you wrote it is not scalable so normally not the right choice for graphs and plots. Also it can be quite slow to embed as pdftex normally has to uncompress and recompress it. A few differences between graphics formats are discussed in the pdftex documentation, pdftex-a.pdf, in section 9 Graphics.

But your colleage is right that embedding a pdf can lead to font issues. While embedding pdftex tries to optimize the file size by combining fonts it thinks are the same, and sometimes this gives the wrong result. You can find a number of cases by searching for \pdfinclusioncopyfonts on the site for example pdflatex: glyph undefined (symbols disappear from included pdf).

The cases are rare and typically only happen if the graphic has been created on another computer with different fonts, so not when you use tikzexternalize, and with \pdfinclusioncopyfonts=1 there exist a suitable solution. So they should prevent you from using the best format for a plot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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