Title: Creating document commands: The good, the bad and the ugly
Summary: best practices for using \NewDocumentCommand from xparse.
Full text of article: publicly available now.
Author: Joseph Wright
Publication: TUGboat volume 42, number 1 (2021), pages 40-41
DOI (this page):
10.47397/tb/42-1/tb130wright-goodbad
(previous doi
- next doi)
Category: Software & Tools
Difficulty: Intermediate
Abstract: Creating document commands in LaTeX has traditionally involved a mix of \newcommand, semi-internal kernel commands (like \@ifnextchar and \@ifstar) and low-level TeX programming using \def. As part of wider efforts to improve LaTeX, the team have over the past few years developed ideas for creating document commands in the package xparse. The LaTeX kernel now integrates most, though not all, of xparse into the kernel. That means the core ideas are available out-of-the-box. This seems like a good time, therefore, to look at the best ways to use the abilities of xparse in making document commands. I won’t look at the full detail, but rather pick out how to, and how not to, create good document commands.