From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: \definesomething?
Date: Sat, 26 Aug 2006 00:16:32 -0400 (EDT) [thread overview]
Message-ID: <Pine.WNT.4.63.0608252350430.1256@nqvgln> (raw)
In-Reply-To: <3e73596b0608231709h7b915197o232c7324c27b3621@mail.gmail.com>
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
next prev parent reply other threads:[~2006-08-26 4:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-24 0:09 \definesomething? Pepe Barbe
2006-08-26 4:16 ` Aditya Mahajan [this message]
2006-08-27 3:32 ` \definesomething? Pepe Barbe
2006-08-27 4:04 ` \definesomething? Mojca Miklavec
2006-08-27 4:19 ` \definesomething? Aditya Mahajan
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=Pine.WNT.4.63.0608252350430.1256@nqvgln \
--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).