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.

63 lines
3.9 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="icon" type="image/png" href="/favicon.ico">
  7. <link rel="canonical" href="https://www.mcmillen.dev/blog/20070522-latex-tips.html">
  8. <link rel="alternate" type="application/atom+xml" href="https://www.mcmillen.dev/feed.atom" title="Colin McMillen's Blog - Atom">
  9. <title>LaTeX Tips | Colin McMillen</title>
  10. <link rel="preconnect" href="https://fonts.gstatic.com">
  11. <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=block" rel="stylesheet">
  12. <link href="https://fonts.googleapis.com/css?family=Fira+Mono:500&display=block" rel="stylesheet">
  13. <link rel="stylesheet" href="/pygments.css">
  14. <link rel="stylesheet" href="/style.css">
  15. </head>
  16. <body>
  17. <div id="page-container">
  18. <div id="content-wrap">
  19. <div id="header">
  20. <div class="content">
  21. <a href="/" class="undecorated">Colin McMillen</a>
  22. <span style="float: right;"><a href="/feed.atom"><img src="/img/rss.svg" alt="Atom feed" style="width: 17px; height: 17px; margin-bottom: 1px;"></a></span>
  23. <span style="float: right;"><a href="https://twitter.com/mcmillen"><img src="/img/twitter.svg" alt="@mcmillen"></a></span>
  24. </div>
  25. </div>
  26. <div class="content">
  27. <h1 id="latex-tips">LaTeX Tips</h1>
  28. <p><em>Posted 2007-05-22.</em></p>
  29. <h2 id="embedding-fonts-in-pdfs">Embedding fonts in PDFs</h2>
  30. <p>To check whether fonts are embedded, use <code>pdffonts</code>, which is included with <code>xpdf</code>. <code>pdffonts</code> gives output that looks like this:</p>
  31. <div class="codehilite"><pre><span></span>$ pdffonts paper.pdf
  32. name <span class="nb">type</span> emb sub uni object ID
  33. ------------------------------------ ------------ --- --- --- ---------
  34. FHQIOS+NimbusRomNo9L-Medi Type <span class="m">1</span> yes yes no <span class="m">6</span> <span class="m">0</span>
  35. NEESMN+NimbusRomNo9L-Regu Type <span class="m">1</span> yes yes no <span class="m">9</span> <span class="m">0</span>
  36. PJQNOS+CMSY10 Type <span class="m">1</span> yes yes no <span class="m">12</span> <span class="m">0</span>
  37. </pre></div>
  38. <p>You want <code>emb</code> to be <code>yes</code> for all fonts (and possibly <code>sub</code> 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 <code>/etc/texmf/updmap.d/00updmap.cfg</code>, which should have a line like this:</p>
  39. <p><code>pdftexDownloadBase14 true</code></p>
  40. <p>If it&rsquo;s set to <code>false</code>, change it to <code>true</code>, then run <code>update-updmap</code> 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 <code>pdffonts</code> command). For anything that doesn&rsquo;t have embedded fonts, you can try the following magical invocation (all on one line):</p>
  41. <p><code>gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPAPERSIZE=letter -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -sOutputFile=figures/Mprime-new.pdf -f figures/Mprime.pdf</code></p>
  42. <p>This creates a file <code>figures/Mprime-new.pdf</code> that is hopefully identical to the input file <code>figures/Mprime.pdf</code>, except that the fonts are embedded. Run <code>pdffonts</code> on it to check.</p>
  43. <p>Once all your figures are in PDF format, remake the paper again. Hopefully, all your fonts are now embedded &mdash; check again with <code>pdffonts</code>.</p>
  44. </div>
  45. </div>
  46. <div id="footer">
  47. <div class="content">
  48. &copy; 2021 <a href="/" class="undecorated">Colin McMillen</a>. No cookies, no tracking.
  49. </div>
  50. </div>
  51. </div>
  52. </body>
  53. </html>