From: Marco Patzer <homerow@lavabit.com>
To: ntg-context@ntg.nl
Subject: Re: Referring to multiple elements
Date: Fri, 28 Sep 2012 10:56:35 +0200 [thread overview]
Message-ID: <20120928105635.3ad7368d@homerow> (raw)
In-Reply-To: <CAF=dkzzsmCWv+ZUyKMP67R0d+mUXbhHf4HhZeiJvjJkx1yYtvA@mail.gmail.com>
2012-09-28 Sietse Brouwer <sbbrouwer@gmail.com>:
Hi Sietse,
> > \in{figure}[alpha,beta,gamma]
> >
> > This outputs “figure 1”. What I'd like to have is “figure 1-3”.
>
> The attached quasi-module seems to do it! On my computer, at least. (I
> call it 'quasi' because it is really nothing more than code in a file
> of its own.No configurability whatsoever, except to the extent that I
> tried to comment well, and split things up into functions.) I'd have
> written it so that it properly identifies runs like '1.2.1, 1.2.2,
> 1.2.3', too, but I can't find a function that will turn reference
> strings into such a prefixed strings.
>
> I hope it does what you want! Let me know if you want/need any
> alterations, or discover bugs.
Thanks a lot for that. I'd adjust the interface, so that it matches
the behaviour of \in:
\def\inrange
{\dodoublegroupempty\doinrange}
\def\doinrange#left#right#dummy[#label]
{\iffirstargument
{#left }%%
\fi
\ctxlua{userdata.inwithranges("#label")}%%
\ifsecondargument
{#right}%%
\fi}
Then you can write:
See \inrange{figures} [fig:a,fig:c,fig:d,fig:e,fig:g,fig:x,fig:h]
See \inrange{figures}{TT} [fig:a,fig:c,fig:d,fig:e,fig:g,fig:x,fig:h]
See \inrange [fig:a,fig:c,fig:d,fig:e,fig:g,fig:x,fig:h]
Maybe worth mentioning: You need the additional module
`showtable.lua` from http://article.gmane.org/gmane.comp.tex.context/78336
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-28 8: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
2012-09-28 1:39 ` Sietse Brouwer
2012-09-28 8:56 ` Marco Patzer [this message]
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=20120928105635.3ad7368d@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).