I have seen some examples that you can pass parameters
to build a template such as \int_step_inline
: you can write #1
to represent the current value of the loop. I wonder how it works and have some try.
As I know from TeXbyTopic
, in every expansion, #1
is replaced by <parameter token1>
and ##
is replaced by #
(here is a question, how is ###
and ####
replaced?).
But I do not sure what happens when #1
is passed as a parameter of a macro. It seems that #1
just replaces #n
of the macro.
I have following example.
\def\a#1{\def\b##1{#1}}
If I have the right idea. \a{*#1*}
is expande to \def\b#1{*#1*}
, then \b{test}
will get *test*
. From the output, it seems that I'm right, but I want to know if I really get the right idea or there is some extra information that I ignored.
###
the first##
is replaced by#
and the remaining#
would generate an error unless followed by#
or1
-9
,####
is just two##
each replaced by#
so you get##
.