ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Martin Fechner <fechner@bbaw.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: lua and brackets
Date: Thu, 03 Nov 2011 12:42:31 +0100	[thread overview]
Message-ID: <4EB27E27.3090902@bbaw.de> (raw)
In-Reply-To: <4EB27486.6070402@wxs.nl>

Am 03.11.2011 12:01, schrieb Hans Hagen:
 > On 3-11-2011 10:15, Martin Fechner wrote:
 >> Hi all,
 >>
 >> I try to call a lua-function, but it seems that it doesn't work if the
 >> parameter contains squared brackets. Here is a short example:
 >>
 >> \starttext
 >> sometext
 >> \reference[myref]{}
 >> is
 >> \ctxlua{tex.print(\atpage[myref])}
 >> \stoptext
 >>
 >> Is there a way to mask the brackets?
 >
 > "\atpage[myref]"
 >

My lua function doesn't just print the parameter. I have a function like 
this:

\startluacode
function pagesetup(page1,page2)
     if page1==page2 then
         tex.print(page1)
     elseif page1+1==page2 then
         tex.print(page1..'f.')
     else
         tex.print(page1..'-'..page2)
     end
function
\stopluacode

\starttext
     \reference[myref1]{}
     \page
     \reference[myref2]{}
     \ctxlua{\at[myref1],\at[myref2]}
\stoptext

But I find no way that it works with the two references with brackets. 
Somewhere else I have an similar problem when I work with counters. The 
lua-function there doesn't accept this

\ctxlua{dosomething(\getnumber[mynumber])}

___________________________________________________________________________________
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-11-03 11:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03  9:15 Martin Fechner
2011-11-03 11:01 ` Hans Hagen
2011-11-03 11:42   ` Martin Fechner [this message]
2011-11-03 13:17     ` Hans Hagen
2011-11-03 14:10       ` Martin Fechner

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=4EB27E27.3090902@bbaw.de \
    --to=fechner@bbaw.de \
    --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).