How would I write macros \firstArgument and \macroName which would do the following:

\firstArgument{\bf{a}}    reduces to a
\macroName{\bf{a}}        reduces to bf

I am aware of the approach \def\dismantle#1{{\let\Large\@firstofone #1}} but it is not a solution for me since it only works for \bf whereas is am looking for macros doing this for all macros.

Update: As it became clear throughout the discussion, "firstArgument" only shall allude to the structure of what is meant here. Similarly \bf only serves as an arbitrary example. That is important, as TeX has no notion of argument when the definition of a macro is not (yet) known and the notion may depend on that definition.

  • 1
    \bf is not defined by default in latex, and when it is defined it does not take an argument, so the syntax would be {\bf a} not \bf{a} Commented Sep 25, 2020 at 21:00
  • Would it help in understanding what I want if I had written \XYZ above? Commented Sep 25, 2020 at 21:08
  • I'd have given the same answer as Phelype :-) Commented Sep 25, 2020 at 21:10
  • it seemed worth raising the bf syntax error as if your actual use case is to extract the font command and the styled text that would matter, if it was just \xyz you picked an unfortunate example since a isn't an argument of \bf so \firstArgument is a bad name. Commented Sep 25, 2020 at 21:14
  • 1
    @Nobody-Knows-I-am-a-Dog sure in the answer I (mostly) stuck to answering that, but in comments other issues were raised such as "why is \bf bad style" and also checking whether you did actually want to grab a real argument (to pre-process it before calling the original, say, in which case checking it is actually an argument may have been relevant:-) Commented Sep 26, 2020 at 8:34

2 Answers 2





enter image description here

note that a is not an argument of \bf here.

  • \zzc is the same as \@gobble? For eliminating the backslash Commented Oct 14, 2020 at 16:23

As in TeX they are closely tied to the concepts of defining and expanding macros let's avoid the terms "argument" and "parameter" completely and instead use the modified form of Backus/Naur-notation introduced for defining TeX's "parts of speech" in Chapter 24: Summary of Vertical Mode of the TeXbook:

If this is to be applied to the token-pattern

⟨control sequence⟩⟨left brace⟩⟨balanced text⟩⟨right brace⟩

  • ⟨control sequence⟩ neither being an \outer token nor being an active character nor being the "nameless control sequence token" constructable via \csname\endcsname or via a single character of category code 0(escape), i.e., a backslash, at the not-commented end of a line of input while \endlinechar's value is not positive
  • ⟨balanced text⟩ not containing tokens defined in terms of \outer

only, while the \escapechar-parameter has its usual value 92(decimal):






  • Cood edit of your answer. This is so much more precise in employed concepts. Commented Sep 26, 2020 at 8:34
  • 1
    @Nobody-Knows-I-am-a-Dog Thanks, but it wasn't sufficiently precise so I saw the need of doing another edit. ;-( Commented Sep 26, 2020 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .