Quantcast
Viewing all articles
Browse latest Browse all 63

How keep macro with \csname from gobbling up starred argument?

For purposes more involved than what's shown here, I want to test certain commands having both an ordinary form and a starred form, with the latter constructed using the suffix package. To do that, I pass each form as argument into a macro \try that involves a \csname...\endcsname expression.

For example:

\documentclass{article}\usepackage{suffix}\newcommand{\toward}{\rightarrow}\WithSuffix\newcommand\toward*{\Rightarrow}\newcommand{\try}[1]{$a \csname#1\endcsname b$}\begin{document}OK: $a \toward b$ and $a \toward* b$OK---\verb!\try{toward}! works: \try{toward}BAD--\verb!\try{toward*}! gobbles up the arrow: \try{toward*}\end{document}

As shown below, the result of a \Rightarrow b disappears from the output of \try{toward*}

How can that be fixed?

Image may be NSFW.
Clik here to view.
Unwanted gobbling up of starred form of argument


Viewing all articles
Browse latest Browse all 63

Trending Articles