In the definition of a command appears the declaration of \@dblarg, as follows: \def\title{\@dblarg\CJ@title}. What exactly does \@dblarg do?
|
|
||||
|
It essentially checks if the token after
so that, with a call such as
the expansions will be (successively}
and with a call such as
the expansions will be (successively}
One can follow
So with
With
(There's an extra pair of braces in the first case, but it should do nothing particular.) How to do the same with
|
Instead of using the command \def by \newcommand, what would happen? Anything change? – osjerick May 17 '12 at 23:22 |
|||
|
@osjerick You can't define a command with delimited arguments with \newcommand, so \def is necessary. – egreg May 17 '12 at 23:26 |
||
Thanks @egreg, now I'm learning all about creating classes, you could recommend me a manual or book about this, please? – osjerick May 17 '12 at 23:31 |
|||
|
@osjerick: These are typically package-specific notations. Within the .sty file, @ is treated like a letter. So, it could be that the package author prefix certain internal commands with their initials, or perhaps even an abbreviation of the package name. For example, the keyval package author (David Carlisle) decided to use a KV@ prefix, which was duplicated in the xkeyval package using XKV. – Werner May 18 '12 at 5:26 |
|
This is an easy way of allowing optional arguments to some other function/macro. For example, using your case of
without an optional argument, or use
with an optional argument. "Easy" here refers to the fact that if you don't specify the optional component (like in the former example), it defaults to
thereby converting single-argument responses into double-arguments. The macro
This is typically the case with sectional commands that have an optional argument: Here are the formal definitions contained within
|
||||
|
|

\@dblarg{<command>}{<arg>}will expand to\{<command>}[<arg>]{<arg>}. – Gonzalo Medina May 17 '12 at 23:02