[Mac OS X TeX] Macro Question

Zachary Davis zsd3711 at gamma2.uta.edu
Sun Jun 17 02:27:01 EDT 2001



<x-flowed windows-1252>The macro that I've defined here does not reside within an environment, 
but is rather a stand-alone macro:

\def\linespacing\#1{\baselineskip=#1\normalbaselineskip}

To my knowledge, Plain TeX should accept one argument--an integer, set 
the \baselineskip, which is a TeX primitive to this integer multiplied 
by the \normalbaselineskip--a Plain TeX reporter which has the job of 
remembering the normal size of a \baselineskip.  When TeX starts up, the 
\normalbaselineskip is 12pt.  Therefore, by introducing this macro, I 
should be able to double space my TeX documents by issuing the command 
\linespacing{2}.  For some reason, I get an error when doing this, and 
I'm sort of confused as to why this is happening.  I guess I could just 
add another # into the definition, but I'm still curious as to why this 
is needed.

Also, I have a list of macros that I would like to include at the 
beginning of my TeX documents by issuing the command \input macros.  
Under Texshop, where does this file need to reside for TeX to be able to 
find the file?

Thanks,

On Saturday, June 16, 2001, at 09:31  PM, Ross Moore wrote:

>
>> 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.
> -----------------------------------------------------------------
>

========================================================
Zachary S. Davis
Department of Aerospace Engineering
University of Texas at Arlington
P.O. Box 19032
Arlington, TX 76019

Home:	(817) 272-6418			zsd3711 at gamma2.uta.edu
Office:	(817) 272-5269

         “Throughout the centuries there were men who took
          first steps down new roads armed with nothing
          but their own vision.”
                                 -Ayn Rand
========================================================

-----------------------------------------------------------------
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.
-----------------------------------------------------------------
</x-flowed>




More information about the MacOSX-TeX mailing list