ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \e!start in lua
Date: Sun, 16 Jan 2011 11:27:15 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.2.01.1101161115250.12968@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <8D05D89F-60BF-47E6-A9FE-EA88398C79DB@gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1069 bytes --]

On Sun, 16 Jan 2011, Wolfgang Schuster wrote:

>
> Am 15.01.2011 um 23:57 schrieb Aditya Mahajan:
>
>> What is the best way to define the equivalent of
>>
>>    \setvalue{\e!start\NAME}{...}
>>
>> in lua.
>>
>>    e_start = ??
>>    context.setvalue(e_start .. name, "...")
>
> \startluacode
> context.setvalue("foo","\\framedtext")
> context.setvalue(table.concat({"start","foo"}),"\\startframedtext")
> context.setvalue(table.concat({"stop" ,"foo"}),"\\stopframedtext" )
> \stopluacode
>
> \starttext
> \foo{foo}
> \startfoo bar\stopfoo
> \stoptext
>
This would just create \startfoo. \setvalue{\e!start foo} creates a 
interface specific command. The code that Hans posted does that. I am 
sorry that this was not clear in the question.

> You can also write “context.setvalue("start".."foo","…")” but table.concat
> looks better

OK.

> but the question is why don’t you use just tex
> to create the start/stop commands.

Because I find it much easier to understand expansion at lua level than at 
TeX level.

Thanks,
Aditya

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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:[~2011-01-16 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15 22:57 Aditya Mahajan
2011-01-16  8:52 ` Wolfgang Schuster
2011-01-16 16:27   ` Aditya Mahajan [this message]
2011-01-16 17:03     ` Wolfgang Schuster
2011-01-16 16:08 ` Hans Hagen
2011-01-16 16:28   ` Aditya Mahajan
2011-01-16 16:36     ` Hans Hagen

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=alpine.LNX.2.01.1101161115250.12968@ybpnyubfg.ybpnyqbznva \
    --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).