[OS X TeX] Scandinavian {\aa} ??

Ross Moore ross at ics.mq.edu.au
Tue Mar 25 18:21:16 EDT 2008


Hi Maarten, and Bruno,

On 26/03/2008, at 8:56 AM, Maarten Sneep wrote:

>
> On 25 mrt 2008, at 22:51, Bruno Voisin wrote:
>> Le 25 mars 08 à 22:33, Maarten Sneep a écrit :
>>
>>> But avoid \def unless you _really_ know what you're doing, and  
>>> single letter macros are just too dangerous.
>>
>> By the way, do you know a way to write a command defining another  
>> command and not involving \def?
>>
>> For example, in a custom fax class I once wrote:
>>
>> \newcommand*{\subject}[1]{\def\thesubject{#1}}
>> \newcommand*{\noofpages}[1]{\def\thenoofpages{#1}}
>> \subject{}
>> \noofpages{}
>
> How about:
>
> \newcommand{\thesubject}{}
> \newcommand*{\subject}[1]{\renewcommand{\thesubject{#1}}

Also consider using:

   \providecommand{\thesubject}{}
   \newcommand*{\subject}[1]{\renewcommand{\thesubject{#1}}

which works cleanly also when  \thesubject  has been defined
already, by a package or document-class.

This is particularly useful when you need to use the same
coding in different contexts, each requiring different packages
or classes, but you don't have full control over all of the
contexts (e.g., because other people use some of them too, and
they would not be happy with you messing with vital packages).


Another useful trick is:

   \AtBeginDocument{\providecommand{\thesubject}{}}
   \newcommand*{\subject}[1]{\renewcommand{\thesubject{#1}}

when you know that \subject  cannot be used until the body
of your document.

This way you are free to provide a default expansion for
  \thesubject ,  but it doesn't matter if you do not do so,
or if you later comment it out.

>
> Maarten


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------






More information about the MacOSX-TeX mailing list