Re: [NTG-context] Reference to a subitem

2008-10-27 Thread Wolfgang Schuster
2008/10/25 Marcin Borkowski [EMAIL PROTECTED]:
 Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa#322;(a):
 2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:
 
  \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.

 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.

 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.

Wolfgang
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-27 Thread Diego Depaoli
2008/10/25 Marcin Borkowski [EMAIL PROTECTED]:
 Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa#322;(a):
 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.
Thanks for clarification, here I begin to understand

 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
... I tried before posting... doesn't work

 \edef\sometemporarymacroname{%
  \def\noexpand\doItemNumber ##1\stopper ##2\stopperr ##3\relax
  {\noexpand\doifelsenothing{##2}
{##1}
{##2}}%
 }%
 \sometemporarymacroname
Here I stop understand and I can't get this code working.
Could you give me a full example?

 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_:))).
This time will never come for me.

Cheers
-- 
Diego Depaoli
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-27 Thread Diego Depaoli
Another curiosity...
why have such kind of reference since we get more flexibility with
\in[item]\in[subitem]?
-- 
Diego Depaoli
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-27 Thread Marcin Borkowski
Dnia Mon, Oct 27, 2008 at 10:56:32AM +0100, Wolfgang Schuster napisa#322;(a):
 2008/10/25 Marcin Borkowski [EMAIL PROTECTED]:
  Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa#322;(a):
  2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:
  
   \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
___


Re: [NTG-context] Reference to a subitem

2008-10-27 Thread Marcin Borkowski
Dnia Mon, Oct 27, 2008 at 05:24:56PM +0100, Diego Depaoli napisa#322;(a):
 2008/10/25 Marcin Borkowski [EMAIL PROTECTED]:
  Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa#322;(a):
  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.
 Thanks for clarification, here I begin to understand
 
  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
 ... I tried before posting... doesn't work

Could you please send me a minimal example?

  \edef\sometemporarymacroname{%
   \def\noexpand\doItemNumber ##1\stopper ##2\stopperr ##3\relax
   {\noexpand\doifelsenothing{##2}
 {##1}
 {##2}}%
  }%
  \sometemporarymacroname
 Here I stop understand and I can't get this code working.
 Could you give me a full example?

As above; send me a file, I'll try to do something.  Still, I'm not
really sure this would work, it was only a rough idea.  I'll explain it
later (it's 1:30 AM here in Poland;)).

  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_:))).
 This time will never come for me.

If you follow the path of TeX, your expertise will gradually rise;).
You'll never notice, though, until people start coming to you asking
questions, and will be baffled by your expert-like,
impossible-to-understand-and-technical answers;).

 Cheers
 -- 
 Diego Depaoli

Greets

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

- Gandalf!  A ja myślałem, że nie żyjesz.  Co prawda o sobie też byłem
tego zdania.
Sam Gamgee
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-25 Thread Marcin Borkowski
Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisa#322;(a):
 2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:
 
  \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.

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.)

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_:))).

 
 Cheers
 -- 
 Diego Depaoli

Greets

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

Kim jest ta, co wyłania się z pustyni,
Idzie wsparta na swoim Oblubieńcu?
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-25 Thread Hans Hagen
Diego Depaoli wrote:
 2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:
 \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?

in mkiv this will be done differently, more control over each bit and piece

Hans


-
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-24 Thread Diego Depaoli
2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:

 \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?

Cheers
-- 
Diego Depaoli
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-23 Thread Wolfgang Schuster
On Thu, Oct 23, 2008 at 12:55 AM, Diego Depaoli [EMAIL PROTECTED] wrote:
 Hi all,
 referencing a subitem I get also the item (1.a, 2.c and so on).
 Can I split them or get only the subitem?

 \starttext
 \startitemize [n]
 \item [number] one
 \startitemize  [a]
 \item [letter] letter
 \stopitemize
 \stopitemize
 Look at number \in[number] letter \in[letter]
 \stoptext

 Normal output:
 Look at number 1 letter 1.a

 Wanted result
 Look at number 1 letter a

\def\ItemNumber#1%
 {\expandafter\doItemNumber#1..\relax}

\def\doItemNumber#1.#2.#3\relax
 {\doifelsenothing{#2}
{#1}
{#2}}

\definereferenceformat[initem][left=\ItemNumber]

\starttext
\startitemize[n]
\item[number] one
  \startitemize  [a]
  \item[letter] letter
  \stopitemize
\stopitemize
Look at \initem{number}[number] \initem{letter}[letter]
\stoptext

Regards,
Wolfgang
___
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
___


Re: [NTG-context] Reference to a subitem

2008-10-23 Thread Diego Depaoli
2008/10/23 Wolfgang Schuster [EMAIL PROTECTED]:

 Wanted result
 Look at number 1 letter a

 \def\ItemNumber#1%
  {\expandafter\doItemNumber#1..\relax}
As usual, Wolfgang solved!

Mojca, can I have a Context t-shirt customized 'Wolfgang's fan club'?

-- 
Diego Depaoli
___
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
___


[NTG-context] Reference to a subitem

2008-10-22 Thread Diego Depaoli
Hi all,
referencing a subitem I get also the item (1.a, 2.c and so on).
Can I split them or get only the subitem?

\starttext
\startitemize [n]
\item [number] one
\startitemize  [a]
\item [letter] letter
\stopitemize
\stopitemize
Look at number \in[number] letter \in[letter]
\stoptext

Normal output:
Look at number 1 letter 1.a

Wanted result
Look at number 1 letter a

Many thanks

-- 
Diego Depaoli
___
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
___