TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to store the argument of a macro in a temporary variable, but I know in advance that some people will incorrectly enclose the argument in parentheses as well as braces (long story). Specifically, some users will say something like


while others will say


I want the macro \bernardto store the string abc in the temporary variable in both cases. How do I achieve this?

share|improve this question
Is Bernard the person? :-D – Matthew Leingang Mar 2 '11 at 0:40
@Matthew - sadly not. Their name is Legion, for they are many. – Ian Thompson Mar 2 '11 at 16:13
up vote 8 down vote accepted

\bernard{(abc)} \bTemp
\bernard{abc}   \bTemp
share|improve this answer
Thanks Herbert. – Ian Thompson Mar 1 '11 at 15:19
Nice. Maybe Ian needs a \newbernard macro that defines a command that takes Bernard-style arguments. – Matthew Leingang Mar 2 '11 at 18:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.