ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: abbreviations as macros (Aditya Mahajan)
       [not found] <mailman.3207.1281200098.4277.ntg-context@ntg.nl>
@ 2010-08-08 15:34 ` Armin Varmaz
  2010-08-08 16:53   ` Aditya Mahajan
  0 siblings, 1 reply; 2+ messages in thread
From: Armin Varmaz @ 2010-08-08 15:34 UTC (permalink / raw)
  To: ntg-context

>Message: 5
>Date: Sat, 7 Aug 2010 11:10:21 -0400 (EDT)
>From: Aditya Mahajan [
>To: mailing list for ConTeXt users 
>Subject: Re: [NTG-context] abbreviations as macros
>Message-ID: [
>Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
>On Sat, 7 Aug 2010, ivo welch wrote:
>
>
>If you never need to use a full form of the abbreviation, then you can 
>just use the same in ConTeXt. The equivalent of \ensuremath is \math; 
>everything else is the same.
>
>\define\NPV{\text{NPV\math{_0}}
>
>I would, however, write this slightly differently (even in LaTeX) as
>
>\math{\text{NPV}_0}
>
>but that is just a stylistic issue.
>
>> Is there a recommended way to do this on conTeXt?
>
>The usual way of defining abbreviations in ConTeXt is
>
>\abbreviation [NPV] {\math{\text{NPV}_0}} {full form}
>
>Then you can use
>
>\NPV\ for a short form of the abbreviation and \infull{NPV} for the full 
>form. The advantage is that you can also get a list of used abbreviations.
>
>
>Aditya

Hi Aditya,

can you tell me how I can ensure as in AMSmath that the font size in abbreviations automatically match the font size of current text?  see my example below. 

Best Armin

******** EXAMPLE

\definealternativestyle[ImportantStyle][{\definedfont[Kurier-Bold at 24pt]}]


\definetextbackground[zhu]
 [location=paragraph,
 background=color,backgroundcolor=orange,
 leftoffset=0.5\bodyfontsize,rightoffset=.5\bodyfontsize,
 topoffset=.5\bodyfontsize,bottomoffset=.5\bodyfontsize,
 style=ImportantStyle,
 frame=off]


\startsetups important:start
 \starttextbackground[zhu] 
\stopsetups


\startsetups important:stop
 \endgraf
 \stoptextbackground
\stopsetups


\definestartstop
 [important]
 [before=\setups{important:start},
 after=\setups{important:stop}]

\abbreviation [NPV] {\math{\text{NPV}}} {full form} 

\starttext

this looks normal $x$, \NPV.

\startimportant
this looks bad \mathematics{x}, \NPV.
\stopimportant

this looks normal $x$, \NPV.

\stoptext

******** END EXAMPLE
___________________________________________________________
WEB.DE DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für 
nur 19,99 ¿/mtl.!* http://web.de/DSL-Doppel-Flatrate/
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: abbreviations as macros (Aditya Mahajan)
  2010-08-08 15:34 ` abbreviations as macros (Aditya Mahajan) Armin Varmaz
@ 2010-08-08 16:53   ` Aditya Mahajan
  0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2010-08-08 16:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 8 Aug 2010, Armin Varmaz wrote:

> Hi Aditya,
>
> can you tell me how I can ensure as in AMSmath that the font size in 
> abbreviations automatically match the font size of current text?  see my 
> example below.
>
> Best Armin
>
> ******** EXAMPLE

Shorter example showing what goes wrong:

\definealternativestyle[ImportantStyle]
                        [{\definedfont[Kurier-Bold at 24pt]}]

\defineframedtext[important][style=ImportantStyle]

\starttext
\startimportant
   Math $x$ does not scale
\stopimportant
\stoptext

The reason is that you only specified how to scale text. To get the right 
math scaling you have to use \switchtobodyfont. You can go about it in two 
ways

\defineframedtext[important][style={\switchtobodyfont[24pt]\ImportantStyle}]

(which will scale the math font, but not change it to Kurier-Bold).

Or you can define a typescript for kurier-bold (see type-otf for 
examples), and then use

\usetypescript[kurier-bold]

\defineframedtext[important][style={\switchtobodyfont[kurier-bold,24pt]}]

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-08 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.3207.1281200098.4277.ntg-context@ntg.nl>
2010-08-08 15:34 ` abbreviations as macros (Aditya Mahajan) Armin Varmaz
2010-08-08 16:53   ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).