[NTG-context] abbreviations as macros

Aditya Mahajan adityam at umich.edu
Sat Aug 7 17:10:21 CEST 2010

On Sat, 7 Aug 2010, ivo welch wrote:

> Hi Hans:
> This is asking Armin Varmaz' question in a different way, although I
> know even less.  I would like to define a macro that is just an
> abbreviation.
> For example, say I want to define a snippet \NPV which provides the
> text NPV$_0$, and NPV is in textfont while 0 is in mathfont.  This
> should work everywhere---formulas, subscripts, footnotes, etc., and
> automatically appear in the correct sizing.
> In LaTeX, this is easy to do:
>  \newcommand{\NPV}{\text{NPV\ensuremath{_0}}}
> I can now use \NPV\ in formulas, footnotes, subscripts, titles, etc.,
> and it is properly sized everywhere.

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.


I would, however, write this slightly differently (even in LaTeX) as


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.


More information about the ntg-context mailing list