You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.9 KiB

  1. # LaTeX Tips
  2. *Posted 2007-05-22; updated 2021-07-01.*
  3. Note that these instructions are over a decade old. Some documentation may be out of date. :)
  4. ## Embedding fonts in PDFs
  5. To check whether fonts are embedded, use `pdffonts`, which is included with `xpdf`. `pdffonts` gives output that looks like this:
  6. ```text
  7. $ pdffonts paper.pdf
  8. name type emb sub uni object ID
  9. ------------------------------------ ------------ --- --- --- ---------
  10. FHQIOS+NimbusRomNo9L-Medi Type 1 yes yes no 6 0
  11. NEESMN+NimbusRomNo9L-Regu Type 1 yes yes no 9 0
  12. PJQNOS+CMSY10 Type 1 yes yes no 12 0
  13. ```
  14. You want `emb` to be `yes` for all fonts (and possibly `sub` as well; also, all fonts should be Type 1, not Type 3). By default in Ubuntu, pdflatex should embed all fonts. Just in case, you can check `/etc/texmf/updmap.d/00updmap.cfg`, which should have a line like this:
  15. `pdftexDownloadBase14 true`
  16. If it's set to `false`, change it to `true`, then run `update-updmap` as root. Remake the PDF; if it still has non-embedded fonts, your figures are probably to blame. Check your PDF figures and make sure their fonts are embedded (using the `pdffonts` command). For anything that doesn't have embedded fonts, you can try the following magical invocation:
  17. ```
  18. gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \
  19. -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer \
  20. -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true \
  21. -dEmbedAllFonts=true -sOutputFile=figures/Mprime-new.pdf -f figures/Mprime.pdf
  22. ```
  23. This creates a file `figures/Mprime-new.pdf` that is hopefully identical to the input file `figures/Mprime.pdf`, except that the fonts are embedded. Run `pdffonts` on it to check.
  24. Once all your figures are in PDF format, remake the paper again. Hopefully, all your fonts are now embedded --- check again with `pdffonts`.