ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: abbreviations as macros
Date: Sat, 7 Aug 2010 11:10:21 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.00.1008071059050.8743@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <AANLkTik3dtc6-=SD6e7hzhRvBoizuQu3QU-biJd=8twf@mail.gmail.com>

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.

\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
___________________________________________________________________________________
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
___________________________________________________________________________________


      reply	other threads:[~2010-08-07 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-07 14:15 ivo welch
2010-08-07 15:10 ` Aditya Mahajan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.00.1008071059050.8743@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).