Essential Utilities for LaTeX Package and Class Development
Developing LaTeX packages or classes is not a common task for most users, who typically rely on pre-existing packages. According to the CTAN: Comprehensive TeX Archive Network, there are only 3,040 TeX developers worldwide (as of February 2025). As a result, online resources for LaTeX package and class development are relatively scarce.
From my perspective, there isn’t currently a comprehensive guide to the utility commands essential for package development. So, I’ve compiled this blog post, gathering a set of useful commands and packages I’ve discovered or developed through experience. I hope it proves helpful for anyone who is developing—or planning to develop—LaTeX packages or classes.
This post also serves as a personal reference for me to revisit the next time I work on a package.
This post will be a dynamic document, and I’ll update it as I discover new commands. If you have any useful commands that I haven’t mentioned, please feel free to share them in the comments.
Command-line Tools
texdoc - Documentation Viewer
Displays the documentation for a package. For example, texdoc hyperref shows the documentation for the hyperref package.
texdef or latexdef - Command Definition Viewer
Displays the definition of a LaTeX command for a given engine, class, and package. For example, latexdef -t xelatex -c article -p hyperref url shows the definition of \url in the hyperref package for the article class using the xelatex engine.
It also has another use: porting readable Expl3 expressions to LaTeX2e. For example, if you want to achieve recursive expand for the third argument, but expand once for the second argument in LaTeX2e, a better approach is to check the Expl3 implementation \exp_args:Nox. By recursively running latexdef exp_args:Nox and its components, you can get useful hints without solving the puzzle of wrapping it with multiple \noexpand, \unexpanded, \expandafter, \edef, etc.
kpsewhich - File Location Finder
Finds the location of a file in the TeX distribution. For example, kpsewhich article.cls shows the location of the article.cls file. You can also use it to check if an installed package is indexed.
tlmgr - TeX Live Package Manager
You can use it to install, update, and remove packages. For example, tlmgr install --usermode amsmath installs the amsmath package in user mode.
fmtutil - Format File Generator
If you don’t want to modify the system-wide TeX installation, you can use fmtutil-user to generate a format file in your home directory. For example, fmtutil-user --all generates all format files in your home texmf directory.
Packages
If you’re a document class developer and want to demonstrate your beautiful class alongside its documentation—especially when the official l3doc document class cannot be used together with your class—here’s a solution.
The useclass package, which I developed, solves the “double classes” problem. It allows you to bootstrap a class directly in the class documentation.
For example, if you want to demonstrate your document class myclass.cls with the DocStrip file myclass.dtx, you can use the following code:
% \iffalse
\documentclass{myclass}
\usepackage{useclass}
\useclass{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
% \fi
%
% \section{Implementation}
% \begin{variable}{\l_demo_tl}
% \begin{macrocode}
\tl_new:N \l_demo_tl
% \end{macrocode}
% \end{variable}
For more information or to provide feedback, feel free to visit the GitHub repository.
Comments