With the package array, I want to define a new column type for my tables with the command
\newcolumntype{U}{>{\switchon}{l}<{\switchoff}}
However, the command I’d like to use is not a switch but a plain, unary macro like \emph or \textsc, so I must define \switchon such that
{\switchon some text}
will be equivalent to
\macro{some text}
(if it must be, I could live with \switchon some text \switchoff but I think this is not necessary.)
Converting a switch to a macro (e.g. \em to \emph) is pretty simple but how would I do it the other way round?
Edit
It seems, I also have to fight this problem which does not seem to allow for an explicit \switchoff (because I need to support the X column type of tabularx and it does not seem to work well together with newcolumntype):
\renewcommand{\tabularxcolumn}[1]{>{\theswitch}m{#1}}
Where \theswitch must be some (sensible) combination of \lowercase and other font macros. \lowercase has no ‘switch’ version (I think) which makes things a bit complicated.
\endgroup. – Debilski Mar 28 '11 at 10:11\switchoffversion, which got me confused. Note that all font macros have "switch" versions as well. – Martin Scharrer Mar 28 '11 at 10:23