www-home/blog/20070522-latex-tips.html

97 lines
4.7 KiB
HTML
Raw Permalink Normal View History

2021-07-01 21:19:53 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/favicon.ico">
<link rel="canonical" href="https://www.mcmillen.dev/blog/20070522-latex-tips.html">
<link rel="alternate" type="application/atom+xml" href="https://www.mcmillen.dev/feed.atom" title="Colin McMillen's Blog - Atom">
<title>LaTeX Tips | Colin McMillen</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=block" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Mono:500&display=block" rel="stylesheet">
<link rel="stylesheet" href="/pygments.css">
<link rel="stylesheet" href="/style.css">
2021-07-02 04:55:08 +00:00
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@mcmillen">
<meta name="twitter:title" content="LaTeX Tips | Colin McMillen">
<meta name="twitter:description" content="Note that these instructions are over a decade old. Some documentation may be out of date. :) Embedding fonts in PDFs">
2021-07-01 21:19:53 +00:00
</head>
2022-11-07 20:10:05 +00:00
<script>
function fixEmails() {
const mailtoArray = [
'm', 'a', 'i', 'l', 't', 'o', ':',
'c', 'o', 'l', 'i', 'n', '@',
'm', 'c', 'm', 'i', 'l', 'l', 'e', 'n',
'.', 'd', 'e', 'v'];
const mailtoLink = mailtoArray.join('');
const anchors = document.getElementsByTagName('a');
for (let i = 0; i < anchors.length; i++) {
const anchor = anchors[i];
if (anchor.href == 'mailto:email@example.com') {
anchor.href = mailtoLink;
if (anchor.innerText == 'colin at mcmillen dot dev') {
anchor.innerText = mailtoLink.substring(7);
}
}
}
}
</script>
<body onload="fixEmails()">
2021-07-01 21:19:53 +00:00
<div id="page-container">
<div id="content-wrap">
<div id="header">
<div class="content">
<a href="/" class="undecorated">Colin McMillen</a>
<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>
<span style="float: right;"><a href="https://twitter.com/mcmillen"><img src="/img/twitter.svg" alt="@mcmillen"></a></span>
</div>
</div>
<div class="content">
<h1 id="latex-tips">LaTeX Tips</h1>
2021-07-01 21:34:34 +00:00
<p><em>Posted 2007-05-22; updated 2021-07-01.</em></p>
2021-07-01 22:34:24 +00:00
<p>Note that these instructions are over a decade old. Some documentation may be out of date. :)</p>
2021-07-01 21:19:53 +00:00
<h2 id="embedding-fonts-in-pdfs">Embedding fonts in PDFs</h2>
<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>
<div class="codehilite"><pre><span></span>$ pdffonts paper.pdf
2021-07-01 21:34:34 +00:00
name type emb sub uni object ID
2021-07-01 21:19:53 +00:00
------------------------------------ ------------ --- --- --- ---------
2021-07-01 21:34:34 +00:00
FHQIOS+NimbusRomNo9L-Medi Type 1 yes yes no 6 0
NEESMN+NimbusRomNo9L-Regu Type 1 yes yes no 9 0
PJQNOS+CMSY10 Type 1 yes yes no 12 0
2021-07-01 21:19:53 +00:00
</pre></div>
<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>
<p><code>pdftexDownloadBase14 true</code></p>
2021-07-01 21:34:34 +00:00
<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:</p>
<div class="codehilite"><pre><span></span>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
2021-07-01 21:28:32 +00:00
</pre></div>
2021-07-01 21:19:53 +00:00
<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>
<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>
</div>
</div>
<div id="footer">
<div class="content">
2023-11-08 23:53:09 +00:00
&copy; 2023 <a href="/" class="undecorated">Colin McMillen</a>. No cookies, no tracking.
2021-07-01 21:19:53 +00:00
</div>
</div>
</div>
</body>
</html>