ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Basic \def error?
Date: Wed, 24 Apr 2013 00:20:51 +0200	[thread overview]
Message-ID: <144AD722-F81E-496F-8350-84434B5841F4@gmail.com> (raw)
In-Reply-To: <5176CEB4.6010601@ziggo.nl>


Am 23.04.2013 um 20:11 schrieb "Verhaag, G.C.H.M." <verhaaggchm@ziggo.nl>:

> Hi Luigi,
> 
> Thanks for your very quick response, just great! Your suggestion works!
> 
> By the way, what does this expanded mean, is it documented somewhere? Is it a typical MKIV thing related to Lua?

It’s a typical way in MkIV to check for the existing of values in “command” keys but it has nothing to do with Lua.


I can demonstrate the purpose of \unexpanded with the following example. First I create the two
command \one and \two, afterwards I add \expandedone and \expandedtwo which hold the
expanded values of \one and \two.

As you can see I get the same text with \one and \expandedone. In the next step I redefine \one
and \two to hold a new value and compare again the content of all four macros. Unlike in the
previous output \one and \expandedone are different while \two and \expandedtwo show
the same result. The reason why \expandedtwo show “Second” is that \unexpanded\def
prevented the expansion of \two in \edef\expandedtwo{…}.

\starttext

           \def\one{One}
\unexpanded\def\two{Two}

\edef\expandedone{\one}
\edef\expandedtwo{\two}

\startlines
\one:\expandedone
\two:\expandedtwo
\stoplines

\def\one{First}
\def\two{Second}

\startlines
\one:\expandedone
\two:\expandedtwo
\stoplines

\stoptext

Wolfgang
___________________________________________________________________________________
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:[~2013-04-23 22:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 17:04 Verhaag, G.C.H.M.
2013-04-23 17:08 ` luigi scarso
2013-04-23 18:11   ` Verhaag, G.C.H.M.
2013-04-23 22:20     ` Wolfgang Schuster [this message]
2013-04-25 12:10       ` Verhaag, G.C.H.M.
2013-04-23 21:33   ` Wolfgang Schuster

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=144AD722-F81E-496F-8350-84434B5841F4@gmail.com \
    --to=schuster.wolfgang@gmail.com \
    --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).