From: Marco Patzer <homerow@lavabit.com>
To: ntg-context@ntg.nl
Subject: Re: Referring to multiple elements
Date: Sun, 16 Sep 2012 14:56:46 +0200 [thread overview]
Message-ID: <20120916145646.64648cc8@homerow> (raw)
In-Reply-To: <CAF=dkzzdRQYjBoHra1uo_qc2ZcTDCsp1MCkPUA1BFDZz-AWtnQ@mail.gmail.com>
2012-09-14 Sietse Brouwer <sbbrouwer@gmail.com>:
Hi Sietse,
I'm sorry for my late reply.
> The heart of what you need is a lua function that will take an array
> of numbers, and return an array of consective-number runs, like so:
>
> […]
>
> I've written one below, plus the scaffolding required to feed it the
> right input, and print its output to ConTeXt.
I wonder if this function is not already present in ConTeXt. The
register mechanism, for instance, already does something very
similar:
\setupregister
[index]
[compress=yes]
\starttext
A\index{A} \page
A\index{A} \page
aaa \page
bbb \page
A\index{A} \page
A\index{A} \page
A\index{A}
\placeindex %% => A 1-2, 5-7
\stoptext
> Only two functions still need writing --- one to turn the context
> argument [fig:f1, fig:f2, fig:f4] into a lua array of strings, and
> one to turn each reference string into a figure number.
I'm quite sure that all the building blocks are already present. I'm
not sure about the case when the float number is preceded by a
chapter number.
> If you're not comfortable with programming LuaTeX, say so and I can
> fill in the two missing functions sometime this weekend. But they
> should be doable, really.
Someone with more expertise and knowledge about the ConTeXt
internals should be able to point to the relevant functions. I guess
the code that produces the index compression is located in
registers.flush() in strc-reg.lua, but apparently it's not a
function and I don't know if it can be adopted for the float
referencing.
> (And, of course, you may be far more experienced in LuaTeX than I,
> I don't know.)
Probably not. I can read and write simple Lua scripts, but I lack
knowledge about the LuaTeX and ConTeXt internals and the data
structures used. For LuaTeX there is a manual that explains a lot,
but it doesn't help figuring out how ConTeXts float referencing
mechanism works.
Thanks for the work you spend on this. I don't need this function
for the current project (I use the workaround), but I would like to
see this feature in ConTeXt. If you have time and expertise to
implement this, it would be great. Otherwise I'll do the range
referencing manually.
Regards
Marco
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2012-09-16 12:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 10:15 Marco Patzer
2012-09-13 10:48 ` Andreas Mang
2012-09-14 7:33 ` Marco Patzer
2012-09-14 12:08 ` Sietse Brouwer
2012-09-16 12:56 ` Marco Patzer [this message]
2012-09-28 1:39 ` Sietse Brouwer
2012-09-28 8:56 ` Marco Patzer
2012-09-28 11:28 ` Sietse Brouwer
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=20120916145646.64648cc8@homerow \
--to=homerow@lavabit.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).