# Tag Info

2

Instead of \iff, you can use an extensible arrow from mathtools (which loads amsmath, and should therefore be compatible with your example): \documentclass{article} \usepackage{mathtools} \begin{document} $A \overset{Forward}{\underset{inverse}{\iff}} B \qquad A \xLeftrightarrow[\text{inverse}]{\text{forward}} B$ \end{document}

2

One option is to use etoolbox's \csxdef to store the value and \csuse to retrieve it: ##Code: \documentclass{article} \usepackage{pgfplots,pgfplotstable} \usepackage{etoolbox} \pgfplotsset{ compat=1.13 } \begin{document} %% Dummy data \pgfplotstableread{ x1 y1 x2 y2 1 1 1 2 2 2 2 4 3 3 3 6 4 4 4 8 }{\mytable} ...

2

For example using OPmac: \input opmac \def\MyFormatter{\afterassignment\MyFormatterA \def\tmpb} \def\MyFormatterA{\replacestrings{p}{{\bf p}}\replacestrings{k}{{\bf k}}% \replacestrings{m}{{\it m}\/}\replacestrings{t}{{\it t}\/}\tmpb} \MyFormatter{Supermarket} \bye

4

An approach using catcodes that works if the \MyFormatter appears in the clear and is not part of an argument. As egreg pointed out in this regard, \mbox{\MyFormatter{Supermarket}} fails. However, I jokingly retort in my comment that the way to get around the fail-case is to put the \mbox inside the MyFormatter, not the other way around. Of course, the ...

6

It's easy and flexible with regular expressions: \documentclass{article} \usepackage{xparse,l3regex} \ExplSyntaxOn \NewDocumentCommand{\myformatter}{m} { \tl_set:Nn \l_tmpa_tl { #1 } \regex_replace_all:nnN { ([kp]+) } { \c{textbf}\cB\{ \1 \cE\} } \l_tmpa_tl \regex_replace_all:nnN { ([mt]+) } { \c{textit}\cB\{ \1 \cE\} } \l_tmpa_tl \...

7

Here's a straightforward solution using expl3. If you need it to work in subgroups \MyFormatter{Supermarket and \MakeUppercase{Supermarket}} you can check this solution. \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand \myformatter { +m } { \xmllmx_myformatter:n { #1 } } \cs_new_protected:Npn \xmllmx_myformatter:n #1 { \tl_set:Nn \l_tmpa_tl { #1 } ...

Top 50 recent answers are included