[NTG-context] Macro for acronyms

Cecil Westerhof cldwesterhof at gmail.com
Sat Mar 19 05:00:47 CET 2011


2011/3/19 Aditya Mahajan <adityam at umich.edu>

> On Sat, 19 Mar 2011, Cecil Westerhof wrote:
>
>  At the moment I have I my document:
>> {\switchtobodyfont[1.25em]\bf M}ust
>>
>> {\switchtobodyfont[1.25em]\bf S}hould
>>
>> {\switchtobodyfont[1.25em]\bf C}ould
>>
>> {\switchtobodyfont[1.25em]\bf N}ot now
>>
>> But I like to have a macro for this, so I could just do:
>> \Acronym{Must Should Could Not~now}
>>
>> Is more readable and when I want a change (for example another color for
>> the
>> first letter), this is much easier to implement. How should I implement
>> such
>> a macro?
>>
>
>
> Use recursion!
>
> \definestartstop
>  [FancyFirstLetter]
>  [style={\switchtobodyfont[big]\bf},
>   color=red]
>
> \def\FancyUppercase#1%
>  {\dostartFancyUppercase#1\dostopFancyUppercase}
>
> \def\dostartFancyUppercase#1#2\dostopFancyUppercase
>  {\FancyFirstLetter{#1}#2}
>
>
> \def\Acronym#1%
>  {\dostartAcronym#1 \dostopAcronym}
>
> \def\dostartAcronym#1 #2\dostopAcronym
>  {\doifsomething{#1}
>      {\FancyUppercase{#1} %space
>       \dostartAcronym#2 \dostopAcronym}}


Almost. dostartAcronym needs a blanco line to put the words under
each-other:
\def\dostartAcronym#1 #2\dostopAcronym
  {\doifsomething{#1}
     {\FancyUppercase{#1} %space

       \dostartAcronym#2 \dostopAcronym}}

-- 
Cecil Westerhof
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110319/319fcc57/attachment-0001.html>


More information about the ntg-context mailing list