From: Andreas Harder <aharder@uni-koblenz.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: loop textext and \MPstring{…}
Date: Thu, 13 Aug 2009 18:41:53 +0200 [thread overview]
Message-ID: <D865D9AF-0DDD-42E6-8946-C42108D953B1@uni-koblenz.de> (raw)
In-Reply-To: <alpine.LNX.2.00.0908122258320.26461@ybpnyubfg.ybpnyqbznva>
[-- Attachment #1.1: Type: text/plain, Size: 1293 bytes --]
Am 13.08.2009 um 05:00 schrieb Aditya Mahajan:
> You just need to work a little harder.
>
> \startbuffer[1]
> This is a test
> \stopbuffer
>
> \startbuffer[2]
> Another test
> \stopbuffer
>
> \startbuffer[3]
> And again
> \stopbuffer
>
> \startluacode
> userdata = userdata or {}
> function userdata.shift(i)
> return "(" .. i .. "cm ," .. i .. "cm )"
> end
>
> function userdata.buffers(i)
> local idx = string.format("%s",i)
> local b = buffers.data[idx]
> if b then
> if type(b) == "table" then
> return table.concat(b)
> else
> return b
> end
> else
> return "unknown"
> end
> end
>
> function userdata.draw_buffer(i)
> return "draw btex " .. userdata.buffers(i) .. " etex shifted "..
> userdata.shift(i) .. ";"
> end
> \stopluacode
>
> \starttext
>
>
> \startluacode
>
> context.startMPpage({offset = "1ex", width = [[\paperwidth]],
> height = [[\paperheight]]})
> for i = 1,3 do
> context(userdata.draw_buffer(i))
> end
> context.stopMPpage()
> \stopluacode
>
> \stoptext
Thank you very much!
I played today (a couple of hours) with your solution and adapted some
things, so if someone is interested, I've attached the file.
PS. I like the math.random() function I found in the Lua manual.
Andreas
[-- Attachment #1.2.1: Type: text/html, Size: 2078 bytes --]
[-- Attachment #1.2.2: MP-Luatext2.tex --]
[-- Type: application/x-tex, Size: 4865 bytes --]
[-- Attachment #1.2.3: Type: text/html, Size: 257 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2009-08-13 16:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-11 14:08 Andreas Harder
2009-08-11 22:07 ` Hans Hagen
2009-08-12 5:40 ` Aditya Mahajan
2009-08-12 10:51 ` Andreas Harder
2009-08-12 13:25 ` Aditya Mahajan
2009-08-12 14:53 ` Andreas Harder
2009-08-13 3:00 ` Aditya Mahajan
2009-08-13 16:41 ` Andreas Harder [this message]
2009-08-12 19:23 ` Hans Hagen
2009-08-12 18:34 ` Mojca Miklavec
2009-08-12 21:22 ` Hans Hagen
2009-08-13 16:50 ` Andreas Harder
2009-08-12 21:27 ` Andreas Harder
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=D865D9AF-0DDD-42E6-8946-C42108D953B1@uni-koblenz.de \
--to=aharder@uni-koblenz.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).