* Calculated Header Text
@ 2002-07-15 19:43 Henning Hraban Ramm
2002-07-19 21:17 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-15 19:43 UTC (permalink / raw)
Ahoi!
Another question concerning my address book:
\setupheadertexts [][A--Z]
I'd like to get the first and the last name per page into the header (like in
a usual phone book).
It's no problem to add a defined command to *every* name, but I can't mark
only the first and last by hand, for the address book should process
automatically.
Grüßlis vom Hraban!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-15 19:43 Calculated Header Text Henning Hraban Ramm
@ 2002-07-19 21:17 ` Hans Hagen
2002-07-21 15:27 ` Henning Hraban Ramm
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2002-07-19 21:17 UTC (permalink / raw)
Cc: ntg-context
At 09:43 PM 7/15/2002 +0200, you wrote:
>Ahoi!
>
>Another question concerning my address book:
>\setupheadertexts [][A--Z]
>
>I'd like to get the first and the last name per page into the header (like in
>a usual phone book).
>
>It's no problem to add a defined command to *every* name, but I can't mark
>only the first and last by hand, for the address book should process
>automatically.
you can define your own markings (search for that or markering) and fetch
the first/last/intermediate ones,
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-19 21:17 ` Hans Hagen
@ 2002-07-21 15:27 ` Henning Hraban Ramm
2002-07-21 22:47 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-21 15:27 UTC (permalink / raw)
Cc: ntg-context
Am Freitag, 19. Juli 2002 23:17 schrieb Hans Hagen:
> you can define your own markings (search for that or markering) and fetch
> the first/last/intermediate ones,
Yeah, great! -- that is, would be, if it would work.
I wrote:
\definemarking [myname]
\setupheadertexts [][{\getmarking[myname][all]}]
\def\Name#1{{\marking[myname]{#1}\bf #1}}
\def\Nick#1{{\it (#1)}}
\def\Geburt#1{* #1}
\def\Email#1{#1}
\def\Strasse#1{#1}
\def\Ort#1{#1}
\def\Telefon#1{#1}
\starttabulate[|w(30mm)i0j0k0|w(30mm)i0j0k0|w(18mm)i0j0k0|]
\HL
\NC\Name{Alt, Stefan}\NC\Email{alt.stefan@to.de}\NC\Nick{Old Man}\NC\NR
\NC\Strasse{Straße 77}\NC\Ort{D-77777 Town}\NC\Telefon{+49-7777-7777}\NC\NR\HL
% long list of address lines
\stoptabulate
But \getmarking shows nothing.
In the log I get only
"system : mark myname defined [myname]"
and no further mentioning of "myname"
Further let's make the "phone book header" better: How can I get the first n
characters of a text? (I guess I'd find such in the TeXbook, but perhaps
there is a ConTeXty way?)
Grüßlis vom Hraban!
--
http://www.angerweit.de
http://www.fiee.net
http://www.ramm.ch
---
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-21 15:27 ` Henning Hraban Ramm
@ 2002-07-21 22:47 ` Hans Hagen
2002-07-22 19:33 ` Henning Hraban Ramm
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2002-07-21 22:47 UTC (permalink / raw)
Cc: ntg-context
At 05:27 PM 7/21/2002 +0200, Henning Hraban Ramm wrote:
>Am Freitag, 19. Juli 2002 23:17 schrieb Hans Hagen:
> > you can define your own markings (search for that or markering) and fetch
> > the first/last/intermediate ones,
>
>Yeah, great! -- that is, would be, if it would work.
>I wrote:
>
>\definemarking [myname]
>\setupheadertexts [][{\getmarking[myname][all]}]
>\def\Name#1{{\marking[myname]{#1}\bf #1}}
>\def\Nick#1{{\it (#1)}}
>\def\Geburt#1{* #1}
>\def\Email#1{#1}
>\def\Strasse#1{#1}
>\def\Ort#1{#1}
>\def\Telefon#1{#1}
>
>\starttabulate[|w(30mm)i0j0k0|w(30mm)i0j0k0|w(18mm)i0j0k0|]
>\HL
>\NC\Name{Alt, Stefan}\NC\Email{alt.stefan@to.de}\NC\Nick{Old Man}\NC\NR
>\NC\Strasse{Straße 77}\NC\Ort{D-77777 Town}\NC\Telefon{+49-7777-7777}\NC\NR\HL
>% long list of address lines
>\stoptabulate
>
>But \getmarking shows nothing.
>In the log I get only
>"system : mark myname defined [myname]"
>and no further mentioning of "myname"
Bad luck: TeX cannot handle marks that are burried deeply (as in alignments)
Good Luck: We can fake 'm (using a few low level user macros)
\def\RegisterPageMark#1#2% #1=Class #2=Text
{\iftrialtypesetting \else
\doglobal\increment\NameCounter
\textreference[#1:t:\NameCounter]{#2}%
\doifreferencefoundelse{#1:t:\NameCounter}
{\doifundefined{#1:f:\currentrealreference}
{\setxvalue{#1:f:\currentrealreference}%
{\noexpand\in[#1:t:\NameCounter]}}%
\setxvalue{#1:l:\currentrealreference}%
{\noexpand\in[#1:t:\NameCounter]}}%
{}%
\fi}
\def\GetFirstOnPage#1{\getvalue{#1:f:\realfolio}} % #1=Class
\def\GetLastOnPage #1{\getvalue{#1:l:\realfolio}} % #1=Class
This permits:
\setupheadertexts[\GetFirstOnPage{Name}][\GetLastOnPage{Name}]
\starttext
\def\Name#1{\RegisterPageMark{Name}{#1}#1}
\def\TestLine#1{\NC test \NC \Name {test: #1} \NC \NR}
\starttabulate
\dorecurse{100}{\expanded{\TestLine{\recurselevel}}}
\stoptabulate
\stoptext
>Further let's make the "phone book header" better: How can I get the first n
>characters of a text? (I guess I'd find such in the TeXbook, but perhaps
>there is a ConTeXty way?)
a TeXy way:
\def\getthreetokens#1%
{\dogetthreetokens#1\empty\empty\empty\relax}
\def\dogetthreetokens#1#2#3#4\relax
{#1#2#3}
An alternative is to use the boundtext and limitatetext (nicer) macros
described in supp-box
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-21 22:47 ` Hans Hagen
@ 2002-07-22 19:33 ` Henning Hraban Ramm
2002-07-22 19:46 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-22 19:33 UTC (permalink / raw)
Cc: ntg-context
Am Montag, 22. Juli 2002 00:47 schrieb Hans Hagen:
> Bad luck: TeX cannot handle marks that are burried deeply (as in
> alignments)
What a pity! It could be so easy...
> Good Luck: We can fake 'm (using a few low level user macros)
>
> \def\RegisterPageMark#1#2% #1=Class #2=Text
> {\iftrialtypesetting \else
> \doglobal\increment\NameCounter
> \textreference[#1:t:\NameCounter]{#2}%
> \doifreferencefoundelse{#1:t:\NameCounter}
> {\doifundefined{#1:f:\currentrealreference}
> {\setxvalue{#1:f:\currentrealreference}%
> {\noexpand\in[#1:t:\NameCounter]}}%
> \setxvalue{#1:l:\currentrealreference}%
> {\noexpand\in[#1:t:\NameCounter]}}%
> {}%
> \fi}
>
> \def\GetFirstOnPage#1{\getvalue{#1:f:\realfolio}} % #1=Class
> \def\GetLastOnPage #1{\getvalue{#1:l:\realfolio}} % #1=Class
Looks complicated -- and doesn't work either.
That is, it shows nothing in the header as before.
I tried the \getvalue... outside the tabulation and the whole thing with other
names than "Name" -- nothing.
Not even your recurse-example works.
> >How can I get the first
> > n characters of a text?
> \def\getthreetokens#1%
> {\dogetthreetokens#1\empty\empty\empty\relax}
>
> \def\dogetthreetokens#1#2#3#4\relax
> {#1#2#3}
But that works! Thank you!
> An alternative is to use the boundtext and limitatetext (nicer) macros
> described in supp-box
Yeah, even better, so I can define the max width not only as "3 chars".
Grüßlis vom Hraban!
--
Henning Hraban Ramm
Minervaweg 2
CH-8280 Kreuzlingen
Telefon +41-71-6712494
---
http://www.angerweit.de
http://www.fiee.net
http://www.ramm.ch
---
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-22 19:33 ` Henning Hraban Ramm
@ 2002-07-22 19:46 ` Hans Hagen
2002-07-23 20:50 ` Henning Hraban Ramm
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2002-07-22 19:46 UTC (permalink / raw)
Cc: ntg-context
At 09:33 PM 7/22/2002 +0200, Henning Hraban Ramm wrote:
> > Good Luck: We can fake 'm (using a few low level user macros)
> >
> > \def\RegisterPageMark#1#2% #1=Class #2=Text
> > {\iftrialtypesetting \else
> > \doglobal\increment\NameCounter
> > \textreference[#1:t:\NameCounter]{#2}%
> > \doifreferencefoundelse{#1:t:\NameCounter}
> > {\doifundefined{#1:f:\currentrealreference}
> > {\setxvalue{#1:f:\currentrealreference}%
> > {\noexpand\in[#1:t:\NameCounter]}}%
> > \setxvalue{#1:l:\currentrealreference}%
> > {\noexpand\in[#1:t:\NameCounter]}}%
> > {}%
> > \fi}
> >
> > \def\GetFirstOnPage#1{\getvalue{#1:f:\realfolio}} % #1=Class
> > \def\GetLastOnPage #1{\getvalue{#1:l:\realfolio}} % #1=Class
>
>Looks complicated -- and doesn't work either.
>That is, it shows nothing in the header as before.
>I tried the \getvalue... outside the tabulation and the whole thing with
>other
>names than "Name" -- nothing.
>
>Not even your recurse-example works.
That is strange. How does your (minimal) file looks? Are you sure that the
tuo file is produced?
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-22 19:46 ` Hans Hagen
@ 2002-07-23 20:50 ` Henning Hraban Ramm
2002-07-24 7:13 ` Hans Hagen
0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-23 20:50 UTC (permalink / raw)
Cc: ntg-context
Am Montag, 22. Juli 2002 21:46 schrieb Hans Hagen:
> That is strange. How does your (minimal) file looks? Are you sure that the
> tuo file is produced?
The .tuo *is* produced and looks ok.
Your commands work in the body, but not in the header -- then I get the
following error:
systems : begin file minimal at line 1
! Use of \MNam:f:1 doesn't match its definition.
<argument> \GetFirstOnPage {MNam}\relax
{}{}{}{}{}
\firstoftwoarguments #1#2->#1
---------------
% Ok, it's not completely minimal...
\starttext
\enableregime [windows]
\mainlanguage [de]
\setupencoding [default=texnansi]
\setupbodyfont [7pt]
\definepapersize [filius][width=92mm, height=172mm]
\setuppapersize [filius][A4,landscape]
%\setuparranging [2SIDE]
\setuplayout [location=middle,
alternative=singlesided,
grid=no, marking=on,
leftmargin=10mm, leftmargindistance=0mm,
topspace=2mm, header=4mm, footer=0mm,
width=77mm, height=166mm]
\def\RegisterPageMark#1#2% #1=Class #2=Text
{\iftrialtypesetting \else
\doglobal\increment\MNamCounter%
\textreference[#1:t:\MNamCounter]{#2}%
\doifreferencefoundelse{#1:t:\MNamCounter}
{\doifundefined{#1:f:\currentrealreference}%
{\setxvalue{#1:f:\currentrealreference}
{\noexpand\in[#1:t:\MNamCounter]}}
\setxvalue{#1:l:\currentrealreference}%
{\noexpand\in[#1:t:\MNamCounter]}}%
{}%
\fi}
\def\GetFirstOnPage#1{\getvalue{#1:f:\realfolio}} % #1=Class
\def\GetLastOnPage#1{\getvalue{#1:l:\realfolio}} % #1=Class
% This makes the error:
\setupheadertexts [{\GetFirstOnPage{MNam}}][{\GetLastOnPage{MNam}}]
\def\Name#1{\RegisterPageMark{MNam}{#1}\bf #1}
\def\TableLine#1{\NC\Name{#1}\NC geb\NC\NR\NC Strasse\NC Ort\NC
Telefon\NC\NR\HL}
\starttabulate[|l|l|l|]
\HL
\TableLine{eins}
\TableLine{zwei}
\TableLine{drei}
\TableLine{vier}
\stoptabulate
% This works:
\GetFirstOnPage{MNam} -- \GetLastOnPage{MNam}
\stoptext
--------------------
Grüßlis vom Hraban!
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-23 20:50 ` Henning Hraban Ramm
@ 2002-07-24 7:13 ` Hans Hagen
2002-07-24 18:33 ` Henning Hraban Ramm
0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2002-07-24 7:13 UTC (permalink / raw)
Cc: ntg-context
At 10:50 PM 7/23/2002 +0200, Henning Hraban Ramm wrote:
> {\setxvalue{#1:f:\currentrealreference}%
put a % here: ^
otherwise you have a space delimited macro -)
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-24 7:13 ` Hans Hagen
@ 2002-07-24 18:33 ` Henning Hraban Ramm
2002-07-29 14:25 ` Henning Hraban Ramm
0 siblings, 1 reply; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-24 18:33 UTC (permalink / raw)
Cc: ntg-context
Am Mittwoch, 24. Juli 2002 09:13 schrieb Hans Hagen:
> At 10:50 PM 7/23/2002 +0200, Henning Hraban Ramm wrote:
> > {\setxvalue{#1:f:\currentrealreference}%
> put a % here: ^
> otherwise you have a space delimited macro -)
Ok, thank you, now *this* works.
But only on single pages -- arranging breaks it (no error, but no text).
Further I tried to limit the name to the first 3 (or some) letters.
Your \getthreetokens from a former mail doesn't work with the \GetFirst/Last
macros, neither with \doboundtext. I presume I must insert a \expandafter
somewhere, but I don't understand TeX's macro expansion.
I also tried \limitatetext -- it works with the \GetFirst/Last macros, but it
shows at least one word (the complete name), where I need only some chars up
to the given width.
Next issue: What are the third parameters of \limitatetext and \doboundtext
for? In the examples there's only \unknown in it...
Grüßlis vom Hraban!
--
http://www.fiee.net/texnique/
http://www.ramm.ch/context/ (soon)
---
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Calculated Header Text
2002-07-24 18:33 ` Henning Hraban Ramm
@ 2002-07-29 14:25 ` Henning Hraban Ramm
0 siblings, 0 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2002-07-29 14:25 UTC (permalink / raw)
Cc: ntg-context
Am Mittwoch, 24. Juli 2002 20:33 schrieb Henning Hraban Ramm:
> But only on single pages -- arranging breaks it (no error, but no text).
Solved this by reading docs... I simply forgot to tell texexec "--arrange".
But the other issues remain.
Grüßlis vom Hraban!
--
http://www.fiee.net/texnique/
http://www.ramm.ch/context/
---
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-07-29 14:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-15 19:43 Calculated Header Text Henning Hraban Ramm
2002-07-19 21:17 ` Hans Hagen
2002-07-21 15:27 ` Henning Hraban Ramm
2002-07-21 22:47 ` Hans Hagen
2002-07-22 19:33 ` Henning Hraban Ramm
2002-07-22 19:46 ` Hans Hagen
2002-07-23 20:50 ` Henning Hraban Ramm
2002-07-24 7:13 ` Hans Hagen
2002-07-24 18:33 ` Henning Hraban Ramm
2002-07-29 14:25 ` Henning Hraban Ramm
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).