From 8395ab5f5ad59b35292f22506ee67190004f102a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky <michael@orlitzky.com> Date: Fri, 2 May 2025 11:58:49 -0400 Subject: [PATCH] {examples,mjo-arrow}.tex: support blank \identity argument --- examples.tex | 7 ++++--- mjo-arrow.tex | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/examples.tex b/examples.tex index 31acc21..e9b409d 100644 --- a/examples.tex +++ b/examples.tex @@ -68,9 +68,10 @@ \begin{section}{Arrow} The constant function that always returns $a$ is $\const{a}$. The - identity operator on $V$ is $\identity{V}$. The composition of $f$ - and $g$ is $\compose{f}{g}$. The inverse of $f$ is - $\inverse{f}$. If $f$ is a function and $A$ is a subset of its + identity operator on $V$ is $\identity{V}$ but the argument can be + left blank to get a ``generic'' identity, $\identity{}$. The + composition of $f$ and $g$ is $\compose{f}{g}$. The inverse of $f$ + is $\inverse{f}$. If $f$ is a function and $A$ is a subset of its domain, then the preimage under $f$ of $A$ is $\preimage{f}{A}$. \end{section} diff --git a/mjo-arrow.tex b/mjo-arrow.tex index 2d5095e..634f436 100644 --- a/mjo-arrow.tex +++ b/mjo-arrow.tex @@ -23,8 +23,14 @@ } \fi -% The identity function/arrow on its argument. -\newcommand*{\identity}[1]{ \operatorname{id}_{{#1}} } +% The identity function/arrow on its argument. Leave the argument +% blank to get the plain "id" +\newcommand*{\identity}[1]{% + \operatorname{id}% + \if\relax\detokenize{#1}\relax\else% + _{#1}% + \fi% +} \ifdefined\newglossaryentry \newglossaryentry{identity}{ -- 2.49.0