[texhax] LaTeX \providecommand bug?

iNOUE Koich! inoue at ma.ns.musashi-tech.ac.jp
Tue Dec 23 01:29:41 CET 2003


Hello,

I found \providecommand does not define \reserved at a correctly:

¥newcommand¥somecommand[2][a]{[#1][#2]}
¥providecommand¥somecommand[2][d]{[#1][#2]}
\reserved at a{b}    -> error

I wonder why \providecommand define \reserved at a when \somecommand is 
already defined, but it must be some reason.   This bug is derived from 
\@xargdef definition, so it can be corrected as follows:

¥long¥def¥@xargdef#1[#2][#3]#4{%
  ¥@ifdefinable#1{%
       ¥expandafter¥@yargdef
          ¥csname¥string#1¥endcsname
           ¥tw@
           {#2}%
           {#4}%
       ¥expandafter¥def¥expandafter#1¥expandafter{%
          ¥expandafter
          ¥@protected at testopt
          ¥expandafter
          #1%
          ¥csname¥string#1¥endcsname
          {#3}}}}

Regards,
-- 
https://www.ns.musashi-tech.ac.jp/%7einoue/Signature/              inoue
.


More information about the texhax mailing list