]> gitweb.michael.orlitzky.com - mjotex.git/commitdiff
{examples,mjo-arrow}.tex: support blank \identity argument
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 2 May 2025 15:58:49 +0000 (11:58 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 2 May 2025 15:58:49 +0000 (11:58 -0400)
examples.tex
mjo-arrow.tex

index 31acc21cfb89f1e3bff39f4a9932f626c1c28428..e9b409d57b9d876fdaa4b869fdb8615de27eebac 100644 (file)
 
   \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}
 
index 2d5095ee327b9866bbd84b8098f8d7a084bd27f7..634f4366a9a311b3a50496356dfbce0208850cb8 100644 (file)
   }
 \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}{