ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marcin Borkowski <mbork@atos.wmid.amu.edu.pl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Reference to a subitem
Date: Tue, 28 Oct 2008 01:30:48 +0100	[thread overview]
Message-ID: <20081028003048.GE13542@atos.labs.wmid.amu.edu.pl> (raw)
In-Reply-To: <115224fb0810270256m7cc7d3b1vd139c6b7afb7168f@mail.gmail.com>

Dnia Mon, Oct 27, 2008 at 10:56:32AM +0100, Wolfgang Schuster napisa&#322;(a):
> 2008/10/25 Marcin Borkowski <mbork@atos.wmid.amu.edu.pl>:
> > Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa&#322;(a):
> >> 2008/10/23 Wolfgang Schuster <schuster.wolfgang@googlemail.com>:
> >> >
> >> > \def\ItemNumber#1%
> >> >  {\expandafter\doItemNumber#1..\relax}
> >> >
> >> > \def\doItemNumber#1.#2.#3\relax
> >> >  {\doifelsenothing{#2}
> >> >    {#1}
> >> >    {#2}}
> >> >
> >> > \definereferenceformat[initem][left=\ItemNumber]
> >> Since I don't speak that language, someone could explain why this code
> >> doesn't work when I put a stopper in subitemization?
> >> The standard dot isn't a stopper itself?
> >
> > This code seems to work (approximately) like this: it expands the "full"
> > reference, which is:
> > <number> <dot> <number> <dot> <something, probably space>
> > and selects "everything from the first dot up to the second one (w/o the
> > dots themselves).  So I consider it to be a bit dirty hack (sorry,
> > Wolfgang;)), in a sense that it is not very flexible.
> 
> It's just hack at user level, a dirty hack would redefine core macros but
> this is what I try to avoid.

OK, sorry - probably we have different semantics of "dirty" (or, more
probably, we're talking about different "levels" of dirtiness).  Here I
meant roughly that this hack is not very flexible.

> > If your stopper is, say ")" (and the second one, say, "]", so you have
> > references in a strange form like "1)2]"), you might want to say
> > something like
> > \def\doItemNumber #1)#2]#3\relax
> > (the space after \doItemNumber is gobbled by TeX, so it might be present
> > here or not, it is a matter of taste only).
> > If you have different stoppers, another approach might be reasonable.  I
> > can see two possibilities:
> > 1. Get to know _where_ ConTeXt really keeps the relevant info about
> > labels; if the info about the values (w/o stoppers) is preserved, we are
> > saved, if not, we've got a problem;
> > 2. so in the latter case we have to (?) use this kind of hacky solution,
> > which might be something like this (assuming that \stopper and \stopperr
> > are the first- and second level stoppers respectively):
> >
> > \edef\sometemporarymacroname{%
> >  \def\noexpand\doItemNumber ##1\stopper ##2\stopperr ##3\relax
> >  {\noexpand\doifelsenothing{##2}
> >    {##1}
> >    {##2}}%
> > }%
> > \sometemporarymacroname
> >
> > (I'm not sure whether the last percentage sign is needed, but a good
> > rule of thumb is to put them everywhere after <closing brace> <newline>,
> > so that the newlines don't get translated into spaces.)
> 
> You don't need the comment sign at the end of the macro in outer level
> but you need it for local definitons in other macros if your're in
> horizontal mode.

Shame on me, being a mathematician and being sooo imprecise:):)

> > I'm not sure whether this works, though, *please* check it and tell me
> > (maybe I'm doing some stupid error, please the TeX gurus correct me if
> > yes).  I hope this is ok, though, because then it my first post to this
> > list containing actually an _answer_ and not a _question_:))).
> 
> Thanks to explain my solution.

You're welcome:).

> Wolfgang

Greets

-- 
Marcin Borkowski (http://mbork.pl)

Jeść.  Pić.  Spać.  Wstać.  Kupić.  Sprzedać.  Mieć.
Możesz więcej chcieć - czegoś więcej!
                        (40i30na70)
___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2008-10-28  0:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-22 22:55 Diego Depaoli
2008-10-23  7:22 ` Wolfgang Schuster
2008-10-23  9:58   ` Diego Depaoli
2008-10-25  0:58   ` Diego Depaoli
2008-10-25  7:07     ` Marcin Borkowski
2008-10-27  9:56       ` Wolfgang Schuster
2008-10-28  0:30         ` Marcin Borkowski [this message]
2008-10-27 16:24       ` Diego Depaoli
2008-10-27 16:30         ` Diego Depaoli
2008-10-28  0:34         ` Marcin Borkowski
2008-10-25  8:43     ` 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=20081028003048.GE13542@atos.labs.wmid.amu.edu.pl \
    --to=mbork@atos.wmid.amu.edu.pl \
    --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).