[Mac OS X TeX] Macro Question

Ross Moore ross at ics.mq.edu.au
Sun Jun 17 04:31:40 CEST 2001




> Can anyone explain to me what is wrong with the following macro?  I keep
> getting an error in the TeX log saying that it will assume that I
> meant ##:
> 
> \def\linespacint#1{\baselineskip=#1\normalbaselineskip}

Is this definition within the macro-expansion part of another
definition; e.g.

 \newenvironment{myenv}
  {.... \def\linespacint#1{\baselineskip=#1\normalbaselineskip}...}
  {.....}

If so then the message is correct.
  #1, #2, .... refer to parameters of the  \myenv 
  defined by the \newenvironment declaration.

To set parameters to  \linespacint and refer to them,
you need to say:
  \def\linespacint##1{\baselineskip=##1\normalbaselineskip}

Similarly, if your internally defined macro itself defines
further macros, then each # needs further doubling:

 \newenvironment{myenv}
  {.... \def\linespacint#1{%
    \def\next####1{\typeout{####1}...}.....}%
   ...}
  {...}


The same considerations apply for any definition macro:
  \def \edef \gdef \xdef 
  \newcommand  \providecommand  \nextheorem \DeclareRobustCommand
  \renewcommand  \renewenvironment  etc.


Hope this helps,

	Ross Moore
  




-----------------------------------------------------------------
To UNSUBSCRIBE, send email to <info at email.esm.psu.edu> with
"unsubscribe macosx-tex" (no quotes) in the body.
For additional HELP, send email to <info at email.esm.psu.edu> with
"help" (no quotes) in the body.
This list is not moderated, and I am not responsible for
messages posted by third parties.
-----------------------------------------------------------------




More information about the macostex-archives mailing list