From: Michael Orlitzky Date: Fri, 2 May 2025 15:58:49 +0000 (-0400) Subject: {examples,mjo-arrow}.tex: support blank \identity argument X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=8395ab5f5ad59b35292f22506ee67190004f102a;p=mjotex.git {examples,mjo-arrow}.tex: support blank \identity argument --- 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}{