From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30509 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: \definesomething? Date: Sat, 26 Aug 2006 00:16:32 -0400 (EDT) Message-ID: References: <3e73596b0608231709h7b915197o232c7324c27b3621@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156565912 18567 80.91.229.2 (26 Aug 2006 04:18:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Aug 2006 04:18:32 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sat Aug 26 06:18:29 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GGpcp-0003eO-4o for gctc-ntg-context-518@m.gmane.org; Sat, 26 Aug 2006 06:18:27 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C7DA31FE8D; Sat, 26 Aug 2006 06:18:26 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 23815-05; Sat, 26 Aug 2006 06:18:26 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C3E9C1FE73; Sat, 26 Aug 2006 06:16:33 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DB3041FE73 for ; Sat, 26 Aug 2006 06:16:31 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 25127-02 for ; Sat, 26 Aug 2006 06:16:28 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.93.161]) by ronja.ntg.nl (Postfix) with SMTP id 2F1F81FE72 for ; Sat, 26 Aug 2006 06:16:27 +0200 (CEST) Original-Received: FROM aditya.annarb01.mi.comcast.net (c-68-40-50-205.hsd1.mi.comcast.net [68.40.50.205]) BY tombraider.mr.itd.umich.edu ID 44EFCB1A.9363A.15628 ; 26 Aug 2006 00:16:26 -0400 Original-To: mailing list for ConTeXt users In-Reply-To: <3e73596b0608231709h7b915197o232c7324c27b3621@mail.gmail.com> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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 X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:30509 Archived-At: On Wed, 23 Aug 2006, Pepe Barbe wrote: > In the ConTeXt manuales there is a reference to \definesomething as a > way to create new commands(?)/variables(?). The truth is that I > haven't bee able to truly understand if this is a generic example or I > can define my own commands with this and how the syntax would be used. > I would appreciate if anyone can clarify this to me. You can use if for almost anything you want. This is how \define is defined :) \def\define#1% {\ifx#1\undefined \expandafter\def \else \message{[\noexpand#1is already defined]}% \expandafter\def\expandafter\gobbleddefinition \fi#1} Which basically means that \define\mymacro#1 is equivalent to \def\mymacro#1 but also checks if mymacro has already been defined. In general, it is a good idea to use \define for all your private macros to make sure that you do not redefine one of context's internal macros. Another way to ensure the same thing is to use CAPS for all your private macros. If you really want to redefine a macro that is already defined, you should use \redefine\macro.... you can also use \def\macro.... but \redefine gives you a warning message. Aditya