Beyond compiling, a TeX installation ships small utilities that smooth out daily work: texdoc to open a package’s manual, texfot to trim compile output down to what matters, Ghostscript to make or shrink PDFs, and dvisvgm to turn output into web-ready SVG. This page is a quick reference for the four.
Put the four tools into the writing workflow
The goal of this chapter is not to memorize four commands, but to know which tool to reach for at each point in writing a document. Before adding a package, read its manual with texdoc. When the build output gets noisy, use texfot to surface warnings. If a submission PDF is too large, compress it with Ghostscript, then check links and embedded fonts. For formulas or diagrams on the web, export SVG with dvisvgm and inspect it in a browser at high zoom. Used in that order, research, writing, finishing, and publishing become one workflow.
texdoc — open a package’s manual
Most CTAN packages come with a thorough manual (a PDF), and it is already on your machine after installation. Type texdoc PACKAGE and it finds that manual and opens it in a viewer — offline, and matching the version you actually have. It ships with TeX Live (originally by Manuel Pégourié-Gonnard); the same database is also browsable at texdoc.org.
texdoc booktabs # booktabs の説明書を開く / open booktabs’ manual
texdoc -l siunitx # 候補を一覧表示(開かない)/ list matches instead of openingBy default it opens the single best match. -l (--list) shows a list of candidates to choose from instead of opening one. -s (--showall) widens the results to include lower-scored matches as well. When adding a package to a report or thesis chapter, first use texdoc PACKAGE to identify the loading command, the canonical example, and the options that matter; then copy only the minimum needed into the preamble. That keeps setup from sprawling.
texfot — only the messages that matter
A TeX run spews a flood of messages, and the warnings or errors you actually need can scroll right past. texfot (a public-domain Perl script by Karl Berry) runs the engine and filters the transcript down to the “interesting” lines — errors, warnings, overfull/underfull boxes, and the like. It passes the exit code straight through, so it won’t break a build tool’s success check.
texfot pdflatex document.tex # 出力を要約しつつコンパイル / compile with a quiet, filtered logTo pair it with latexmk, wrap the engine invocation with texfot in your config file:
# .latexmkrc
$pdflatex = 'texfot pdflatex %O %S';Ghostscript — make and shrink PDFs
gs (Ghostscript) is the PostScript/PDF interpreter — it is also what ps2pdf runs underneath. With -sDEVICE=pdfwrite it writes PDF, which lets you convert PS to PDF, merge several PDFs, and compress an oversized PDF (downsampling its images). You pick the quality with a -dPDFSETTINGS preset such as /screen (screen checking), /ebook (medium), /printer (print-oriented), or /prepress (prepress-oriented). These presets rebuild the PDF and can change the input. For submission or print delivery, always inspect image legibility, embedded fonts, links, and page size after compression.
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH \
-sOutputFile=small.pdf big.pdfdvisvgm — DVI to SVG
dvisvgm (by Martin Gieseking) converts DVI to SVG (vector graphics). It also takes EPS, and PDF input with --pdf. It is ideal when you want math or diagrams on the web that stay crisp at any zoom. Fonts are embedded as SVG by default, but --font-format=woff2 (or woff, ttf) can switch to web-font formats. With PDF input, depending on the processing path, text may become paths instead of embedded fonts; decide whether to convert from DVI or from PDF, then check the actual browser rendering. Use -p (--page) to select pages.
latex equation.tex # → equation.dvi
dvisvgm --font-format=woff2 equation.dvi # → equation.svg
dvisvgm --pdf figure.pdf # PDF を入力にする / convert a PDFHow to debug common failures
- If
texdocopens the wrong manual, runtexdoc -l PACKAGE, inspect the candidates, and choose the intended PDF by number. - If
texfotshows nothing but the PDF still looks wrong, temporarily remove texfot and read the raw log to check whether useful context was filtered out. - If links or bookmarks disappear after
Ghostscriptcompression, the PDF rebuild may have dropped non-visible information. Compare the original and compressed PDFs before submission. - If
dvisvgm --pdfturns text into paths, the SVG will not keep searchable or swappable text. For editable web figures, try converting from DVI first.
When to reach for each
- Look up how a package works →
texdoc PACKAGE. - Quiet a noisy log →
texfot(withlatexmk). - A PDF is too big / convert PS to PDF →
Ghostscript(-dPDFSETTINGS). - Put math or figures on the web as SVG →
dvisvgm.