I am currently using many simple substitutions like:
\newcommand{\abc}{{\small ABC}}
\newcommand{\ABC}{{\abc} }
And then in my document text:
I use \ABC if I want a space and if not then \abc.
I'm using this pattern for small caps because the output from \textsc is either too big (for uppercase) or too small (for lowercase), but I use it for accents too.
However, for me it's much better if I can just use one command like so:
I use \abc if I want a space and if not then I can still use \abc.
So, my questions:
Is there a way to combine the
\ABCand\abccommands into just\abcby intelligently detecting punctuation? I guess this would require asking the parser for a lookahead token.If so, can the interface be something easy like:
\smartnewcommand{\abc}{\small ABC}
- And can the interface also handle:
\smartnewcommand{\def}{d\'{e}f}


xspacea try for this. – Miyase Jul 14 '22 at 23:26awk '{print gensub(/(\\[[:alpha:]]+) /, "\\1{} ", "g")}' foo.tex. If that causes problems maybe I can generate a specific list of commands from my .tex source for awk to recognize – cjfp Jul 15 '22 at 01:10