From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/81721 Path: news.gmane.org!not-for-mail From: Marco Patzer Newsgroups: gmane.comp.tex.context Subject: Re: the difference between \def and \define Date: Mon, 15 Apr 2013 16:07:03 +0200 Message-ID: <20130415140703.GA5709@homerow> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1080780883==" X-Trace: ger.gmane.org 1366034841 21859 80.91.229.3 (15 Apr 2013 14:07:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Apr 2013 14:07:21 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Mon Apr 15 16:07:25 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1URk45-0008Ln-5w for gctc-ntg-context-518@m.gmane.org; Mon, 15 Apr 2013 16:07:25 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 475B110238; Mon, 15 Apr 2013 16:07:23 +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 Nt-XMGalx8YB; Mon, 15 Apr 2013 16:07:22 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id B4C0610215; Mon, 15 Apr 2013 16:07:19 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BEA921020E for ; Mon, 15 Apr 2013 16:07:17 +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 3YQAgYFuZCOs for ; Mon, 15 Apr 2013 16:07:16 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 3B17F10215 for ; Mon, 15 Apr 2013 16:07:08 +0200 (CEST) Original-Received: from karen.lavabit.com (karen.lavabit.com [72.249.41.33]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r3FE76U1003123 for ; Mon, 15 Apr 2013 16:07:07 +0200 Original-Received: from a.earth.lavabit.com (a.earth.lavabit.com [192.168.111.10]) by karen.lavabit.com (Postfix) with ESMTP id CBF6711BC1F for ; Mon, 15 Apr 2013 09:07:05 -0500 (CDT) Original-Received: from homerow (miun107-84.dynamic.miun.se [193.10.107.84]) by lavabit.com with ESMTP id VI05T7ZHZP8E for ; Mon, 15 Apr 2013 09:07:05 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=lavabit; d=lavabit.com; b=yZA/JKIdJmiAT5lOT3X9YW01iwjdFETkeAtCXhh/RSUje0FIkBRlib7zhIqPkGLvFowkV2kBVv0dC5B07tDt4ttyfqqdCdn+8um4G3pUpJd5M9NmO+rPeAnP8QC3poWurR6xapx+Nx6F4z1/vCMXA24FmX4LVjXgbZyvWUD31F0=; h=Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; Mail-Followup-To: ntg-context@ntg.nl In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=72.249.41.33; country=US; region=TX; city=Dallas; postalcode=75204; latitude=32.8019; longitude=-96.7883; metrocode=623; areacode=214; http://maps.google.com/maps?q=32.8019,-96.7883&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0QJoe77Qs - 26f785141d9f - 20130415 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:81721 Archived-At: --===============1080780883== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hFEw+uh9kF5V6COn" Content-Disposition: inline --hFEw+uh9kF5V6COn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2013=E2=80=9304=E2=80=9315 Tim Li wrote: > What's the difference between \def and \define? \define is basically the same as \unexpanded\def. It uses a slightly different syntax for specifying optional arguments: \define[3]\foo{First: #1, Second: #2, Third: #3} \unexpanded\def\foo#1#2#3{First: #1, Second: #2, Third: #3} Furthermore, \define displays a message if the command is already defined: system > command '\foo' is already defined However, ConTeXt happily overwrites the existing macro. > Can I use \define to replace all \def? There is \defineexpandable, which uses the same syntax as \define, but it's a simple \def, without \unexpanded which is the closest replacement. I don't think named parameters are possible with \define, but maybe I'm mistaken. \def\bar#first#second{First: #first, Second: #second} For you information, there's also \starttexdefinition mycmd #1 =E2=80=A6 \stoptexdefinition \starttexdefinition mycmd $#first #second =E2=80=A6 \stoptexdefinition \starttexdefinition unexpanded mycmd #first #second =E2=80=A6 \stoptexdefinition Marco --hFEw+uh9kF5V6COn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRbAmHAAoJEPGqVaNSn0iKlegH/3DnhqTJc9kSLjmzqFMNEXoV p2AoR3dxjr/W8RTMC2qKXphQJh+QXPuusjwcRLT828loG4hDtW98b9fxwbvLcB4c LZXsRTUN2y5pwZY9vPuK0qL6gBH05phZgkFbaZN/NYCS9hjIZhoYmU/hzmUmFfvP uZITjPAC9cobg6AbdRDWWi5pxRuWEosiOWH5tdqbvWRI0oH8cMavv6Pd17khqRQT ypj4LDaqlUeRfya7SIBFS1PX0joErrIjPzx7PdZxRI+lOkG0vxXU+n3FIHDV0vqS 3IOFal5SRX+Hi7FnJf6gW6SuwBmN2k+hTMSEveWHebD62lgKXgqFRYmQt3wkuWU= =BBi8 -----END PGP SIGNATURE----- --hFEw+uh9kF5V6COn-- --===============1080780883== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1080780883==--