ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: hajtmar@gyza.cz, mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Dig out contents of the TeX macro using Lua
Date: Wed, 15 Jul 2015 09:01:49 +0200	[thread overview]
Message-ID: <55A6055D.5030406@wxs.nl> (raw)
In-Reply-To: <55A573EB.4040201@gyza.cz>

On 7/14/2015 10:41 PM, Jaroslav Hajtmar wrote:
> Hello ConTeXist.
> I hope that my crazy questions not much bother.
> This time I needed to get to the fair value of the parameter, delivering
> to lua function over the content macros.
> Obviously it's my misunderstanding of the functioning of expansion in
> case maker with optional parameters, or you really can not explain the
> functioning of the transmission values. It seems that is passed to a
> sort of reference as to the actual contents of the macro perhaps can not
> even get through Lua. Or did they?
> The following minimal example, perhaps explain what going on.

Tex has tokens so "foo" is three tokens "f" "o" "o" and not a string. 
This means that you need to turn tokens into a string (using the 
(new)token library). It means that you need to be well aware of tex's 
internals and the way it deals with input -> tokenization -> expansion 
etc etc.

> The question ultimately: Is there any alternative how using Lua somehow
> easily evaluate the macro content? For example to determine whether two
> different macros have the same content?

just avoid storing stuff in macros .. .as most you do seem to be lua, 
keep your data in lua. If you put something in a token register you can 
consult it as string but even then it cannot be what you expect as 
embedded macros don't get expanded (for good reason as they can be 
anything).

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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:[~2015-07-15  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 20:41 Jaroslav Hajtmar
2015-07-15  7:01 ` Hans Hagen [this message]

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=55A6055D.5030406@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=hajtmar@gyza.cz \
    --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).