[texhax] Delimited arguments and ProvidesFile macro in hyphen.cfg
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Tue Jan 3 03:30:30 CET 2012
On Mon, Jan 02, 2012 at 06:13:30PM -0700, Doug McKenna wrote:
> \def\ProvidesFile#1[#2 #3 #4]{\toks 8{Babel <#3> and hyphenation patterns
> \ProvidesFile #1[#2 #3 #4]->\toks 8{Babel <#3> and hyphenation patterns
> for }\b
> bl at tempa #1[#2 #3 #4]\let \ProvidesFile \bbl at tempa
> #1<-{hyphen.cfg}
> #2<-2008/07/06
> #3<-v3.8l
> #4<-Babel language switching mechanism
> {\toks}
> etc.
>
> My question is, why does the argument token list for parameter #1 include
> the open and closed braces (followed by a space)? I thought TeX stripped
> the outermost set of braces during argument collection.
Because of the space, hyphen.cfg installed on my system
contains:
\ProvidesFile{hyphen.cfg}
[2008/07/08 v3.8m %
The first argument of the definition above is a delimited
argument, delimited by "[". In this case this is
"{hyphen.cfg}" and the line end that becomes a space: "{hyphen.cfg} ".
Now the braces are not a pair of outermost braces and are not
removed.
> The reason I'm confused is because if I trace the following simple test
> macro with parallel argument delimiter structure
>
> {
> \def\tester#1[#2 #3 #4]{}
> \tracingcommands=3
> \tracingmacros=3
> \tester{sweet}[babel onion tears]%
> }
>
> during a normal run of TeX (using the LaTeX format), the log file contains
>
> \tester #1[#2 #3 #4]->
> #1<-sweet
> #2<-babel
> #3<-onion
> #4<-tears
>
> and the first argument has had its outermost braces stripped, as I
> expected.
Compare with "\tester{sweet} [babel onion tears]".
Yours sincerely
Heiko Oberdiek
More information about the texhax
mailing list