From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60780 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: abbreviations as macros Date: Sat, 7 Aug 2010 11:10:21 -0400 (EDT) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1281193583 30545 80.91.229.12 (7 Aug 2010 15:06:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 7 Aug 2010 15:06:23 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 07 17:06:22 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ohkya-0006gc-Eo for gctc-ntg-context-518@m.gmane.org; Sat, 07 Aug 2010 17:06:20 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BAD57CA143; Sat, 7 Aug 2010 17:06:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uIULgRx+O32f; Sat, 7 Aug 2010 17:06:16 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0B843CA13A; Sat, 7 Aug 2010 17:06:16 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 19EDFCA13A for ; Sat, 7 Aug 2010 17:06:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ca1cx8jS0ZgL for ; Sat, 7 Aug 2010 17:06:12 +0200 (CEST) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by balder.ntg.nl (Postfix) with ESMTP id 1A6CCCA131 for ; Sat, 7 Aug 2010 17:06:11 +0200 (CEST) Original-Received: FROM [192.168.0.104] (c-71-235-82-170.hsd1.ct.comcast.net [71.235.82.170]) By hackers.mr.itd.umich.edu ID 4C5D7662.34DAB.27694 ; Authuser adityam; 7 Aug 2010 11:06:10 EDT In-Reply-To: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:60780 Archived-At: 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 ___________________________________________________________________________________