* Highlight current chapter in list @ 2012-11-07 23:29 Marco Patzer 2012-11-08 8:44 ` Wolfgang Schuster 0 siblings, 1 reply; 16+ messages in thread From: Marco Patzer @ 2012-11-07 23:29 UTC (permalink / raw) To: context Hi! How do I highlight the current chapter in the table of contents? The TOC is displayed on each page. For illustration I misused the interaction colour, which of course only works for the first page of a chapter. \setupheadertexts [\setups{headlist}] \startsetups [headlist] \framed[align=normal, frame=off] {\placelist [chapter] [alternative=f, criterium=all]} \stopsetups \setupinteraction [state=start, color=lightgray, contrastcolor=darkgreen] \starttext \startchapter [title=alpha] \stopchapter \startchapter [title=beta] \page\input knuth \stopchapter \startchapter [title=gamma] \stopchapter \stoptext 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-07 23:29 Highlight current chapter in list Marco Patzer @ 2012-11-08 8:44 ` Wolfgang Schuster 2012-11-08 10:06 ` Marco Patzer 2012-11-08 21:37 ` Marco Patzer 0 siblings, 2 replies; 16+ messages in thread From: Wolfgang Schuster @ 2012-11-08 8:44 UTC (permalink / raw) To: mailing list for ConTeXt users Am 08.11.2012 um 00:29 schrieb Marco Patzer <homerow@lavabit.com>: > Hi! > > How do I highlight the current chapter in the table of contents? The > TOC is displayed on each page. For illustration I misused the > interaction colour, which of course only works for the first page of > a chapter. > > \setupheadertexts > [\setups{headlist}] > > \startsetups [headlist] > \framed[align=normal, frame=off] > {\placelist [chapter] [alternative=f, criterium=all]} > \stopsetups > > \setupinteraction > [state=start, > color=lightgray, > contrastcolor=darkgreen] > > \starttext > \startchapter [title=alpha] \stopchapter > \startchapter [title=beta] \page\input knuth \stopchapter > \startchapter [title=gamma] \stopchapter > \stoptext You can use the marking mechanism to get the title of the current chapter. The problem for the solution below is to get a expandable version of the list entry because \currentlistentrytitle itself isn’t expandable and can’t be used in \doifelse. Instead of using \ctxcommand better ask Hans for a raw/expandable version of the tile/pagenumber commands. \setupheadertexts [\setups{headlist}] \startsetups [headlist] \framed[align=normal, frame=off] {\placelist [chapter] [alternative=highlight, criterium=all]} \stopsetups \definelistalternative [highlight] [renderingsetup=list:highlight] \startsetups [list:highlight] \par \startlinealignment[middle] \doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle} %\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle("\currentlist",\currentlistindex)}} {\color[red] {\currentlistentrytitle}} {\color[blue]{\currentlistentrytitle}} \stoplinealignment \par \stopsetups \setupinteraction [state=start, color=lightgray, contrastcolor=darkgreen] \starttext \startchapter [title=alpha] \stopchapter \startchapter [title=beta] \page\input knuth \stopchapter \startchapter [title=gamma] \stopchapter \stoptext 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 8:44 ` Wolfgang Schuster @ 2012-11-08 10:06 ` Marco Patzer 2012-11-08 11:06 ` Hans Hagen 2012-11-08 21:37 ` Marco Patzer 1 sibling, 1 reply; 16+ messages in thread From: Marco Patzer @ 2012-11-08 10:06 UTC (permalink / raw) To: ntg-context 2012-11-08 Wolfgang Schuster: Hi Wolfgang! > \startsetups [headlist] > \framed[align=normal, frame=off] > {\placelist [chapter] [alternative=highlight, criterium=all]} > \stopsetups > > \definelistalternative > [highlight] > [renderingsetup=list:highlight] I like the flexibility of renderingsetups for \defineheadalternative, but frankly, I didn't know they can be used for lists as well and I was clueless about the best place to hook into. > \startsetups [list:highlight] > \par > \startlinealignment[middle] > \doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle} > %\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle("\currentlist",\currentlistindex)}} > {\color[red] {\currentlistentrytitle}} > {\color[blue]{\currentlistentrytitle}} > \stoplinealignment > \par > \stopsetups That's a neat and clean solution. Thanks Wolfgang. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 10:06 ` Marco Patzer @ 2012-11-08 11:06 ` Hans Hagen 2012-11-08 11:15 ` Hans Hagen 0 siblings, 1 reply; 16+ messages in thread From: Hans Hagen @ 2012-11-08 11:06 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/8/2012 11:06 AM, Marco Patzer wrote: > 2012-11-08 Wolfgang Schuster: > > Hi Wolfgang! > >> \startsetups [headlist] >> \framed[align=normal, frame=off] >> {\placelist [chapter] [alternative=highlight, criterium=all]} >> \stopsetups >> >> \definelistalternative >> [highlight] >> [renderingsetup=list:highlight] > > I like the flexibility of renderingsetups for \defineheadalternative, > but frankly, I didn't know they can be used for lists as well and > I was clueless about the best place to hook into. > >> \startsetups [list:highlight] >> \par >> \startlinealignment[middle] >> \doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle} >> %\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle("\currentlist",\currentlistindex)}} >> {\color[red] {\currentlistentrytitle}} >> {\color[blue]{\currentlistentrytitle}} >> \stoplinealignment >> \par >> \stopsetups > > That's a neat and clean solution. Thanks Wolfgang. Wolfgang: Say that we have: \installcorenamespace{internalreference} \def\structureheadlocation#1% {\csname\??internalreference\ifcsname\??internalreference#1\endcsname#1\else\s!default\fi\endcsname} \letvalue{\??internalreference\s!default}\!!zerocount \def\storeinternalreference#1#2% {\setxvalue{\??internalreference\currentstructurename}{#2}} and in \strc_sectioning_register add: \storeinternalreference\currentstructurename\nextinternalreference then we can say: \startsetups [list:highlight] \par \startlinealignment[middle] \doifelse\currentlistentrylocation{\structureheadlocation{chapter}} {\color[red] {\currentlistentrytitle}} {\color[blue]{\currentlistentrytitle}} \stoplinealignment \par \stopsetups which is just comparing numbers (so one can also say: \startsetups [list:highlight] \par \startlinealignment[middle] \ifnum\currentlistentrylocation=\structureheadlocation{chapter}\relax \color[red] {\currentlistentrytitle} \else \color[blue]{\currentlistentrytitle} \fi \stoplinealignment \par \stopsetups but that's for low level coders) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 11:06 ` Hans Hagen @ 2012-11-08 11:15 ` Hans Hagen 2012-11-08 11:42 ` Marco Patzer 2012-11-09 16:53 ` Sietse Brouwer 0 siblings, 2 replies; 16+ messages in thread From: Hans Hagen @ 2012-11-08 11:15 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/8/2012 12:06 PM, Hans Hagen wrote: > On 11/8/2012 11:06 AM, Marco Patzer wrote: >> 2012-11-08 Wolfgang Schuster: >> >> Hi Wolfgang! >> >>> \startsetups [headlist] >>> \framed[align=normal, frame=off] >>> {\placelist [chapter] [alternative=highlight, criterium=all]} >>> \stopsetups >>> >>> \definelistalternative >>> [highlight] >>> [renderingsetup=list:highlight] >> >> I like the flexibility of renderingsetups for \defineheadalternative, >> but frankly, I didn't know they can be used for lists as well and >> I was clueless about the best place to hook into. >> >>> \startsetups [list:highlight] >>> \par >>> \startlinealignment[middle] >>> \doifelse{\fetchmark[chapter][first]}{\currentlistentrytitle} >>> >>> %\doifelse{\fetchmark[chapter][first]}{\ctxcommand{listtitle("\currentlist",\currentlistindex)}} >>> >>> {\color[red] {\currentlistentrytitle}} >>> {\color[blue]{\currentlistentrytitle}} >>> \stoplinealignment >>> \par >>> \stopsetups >> >> That's a neat and clean solution. Thanks Wolfgang. the next beta has: \namedstructureheadlocation{name} so that you can compare \currentlistentrylocation with \namedstructureheadlocation{chapter} (todo: also store locations elsewhere?) Best document this before we forget about it. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 11:15 ` Hans Hagen @ 2012-11-08 11:42 ` Marco Patzer 2012-11-08 17:32 ` Marco Patzer 2012-11-09 16:53 ` Sietse Brouwer 1 sibling, 1 reply; 16+ messages in thread From: Marco Patzer @ 2012-11-08 11:42 UTC (permalink / raw) To: ntg-context 2012-11-08 Hans Hagen: > the next beta has: \namedstructureheadlocation{name} > > so that you can compare > > \currentlistentrylocation > > with > > \namedstructureheadlocation{chapter} Thanks Hans. > Best document this before we forget about it. I assume that's my part, right? I'll extend or add a wiki page the weekend after the beta is released. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 11:42 ` Marco Patzer @ 2012-11-08 17:32 ` Marco Patzer 2012-11-08 18:18 ` Hans Hagen 0 siblings, 1 reply; 16+ messages in thread From: Marco Patzer @ 2012-11-08 17:32 UTC (permalink / raw) To: ntg-context 2012-11-08 Marco Patzer: > > Best document this before we forget about it. > > I assume that's my part, right? I'll extend or add a wiki page the > weekend after the beta is released. http://wiki.contextgarden.net/Command/definelistalternative 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 17:32 ` Marco Patzer @ 2012-11-08 18:18 ` Hans Hagen 0 siblings, 0 replies; 16+ messages in thread From: Hans Hagen @ 2012-11-08 18:18 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/8/2012 6:32 PM, Marco Patzer wrote: > 2012-11-08 Marco Patzer: > >>> Best document this before we forget about it. >> >> I assume that's my part, right? I'll extend or add a wiki page the >> weekend after the beta is released. > > http://wiki.contextgarden.net/Command/definelistalternative fyi: more commands will support a redering setup approach Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 11:15 ` Hans Hagen 2012-11-08 11:42 ` Marco Patzer @ 2012-11-09 16:53 ` Sietse Brouwer 2012-11-09 17:03 ` Hans Hagen 1 sibling, 1 reply; 16+ messages in thread From: Sietse Brouwer @ 2012-11-09 16:53 UTC (permalink / raw) To: mailing list for ConTeXt users Hans wrote: > the next beta has: \namedstructureheadlocation{name} > so that you can compare > \currentlistentrylocation > with > \namedstructureheadlocation{chapter} > (todo: also store locations elsewhere?) > Best document this before we forget about it. Is this a good description of the command's behavior? All structure heads, regardless of level, get a location number in the order in which they appear. Like so (see also MWE at bottom of this e-mail): \section{Alpha} % location number: 1; type: section; section number: 1 \section{Beta} % location number: 2; type: section; section number: 2 \subsection{Aap} % location number: 3; type: subsection; subsection number: 1 \subsection{Noot} % location number: 4; type: subsection; subsection number: 2 \section{Gamma} % location number: 5; type: section; section number: 3 \namedstructureheadlocation{X} then returns the location number of the current X, where X is the name of a structure level (e.g. 'chapter', 'section', etc.) If you ask for e.g. \namedstructureheadlocation{chapter}, and you are not in a chapter, then 0 is returned. Anything missing? @Marco: sweet job on http://wiki.contextgarden.net/Command/definelistalternative. I have taken the lazy liberty of redirecting Command/currentlistentrylocation Command/structureheadlocation Command/currentlistentrynumber etc to that page for the now, so that they at least appear in the list of commands. --Sietse \starttext \startsection [title=alpha] \stopsection \startsection [title=beta] \startsubsection[title=aap] \namedstructureheadlocation{section} \namedstructureheadlocation{subsection} \startsubsection[title=noot] \namedstructureheadlocation{section} \namedstructureheadlocation{subsection} \stopsubsection \stopsection \startsection [title=gamma] \namedstructureheadlocation{section} \stopsection \stoptext ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-09 16:53 ` Sietse Brouwer @ 2012-11-09 17:03 ` Hans Hagen 0 siblings, 0 replies; 16+ messages in thread From: Hans Hagen @ 2012-11-09 17:03 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/9/2012 5:53 PM, Sietse Brouwer wrote: > Hans wrote: >> the next beta has: \namedstructureheadlocation{name} >> so that you can compare >> \currentlistentrylocation >> with >> \namedstructureheadlocation{chapter} >> (todo: also store locations elsewhere?) >> Best document this before we forget about it. > > Is this a good description of the command's behavior? > > All structure heads, regardless of level, get a location number in the > order in which they appear. Like so (see also MWE at bottom of this > e-mail): > > \section{Alpha} > % location number: 1; type: section; section number: 1 > \section{Beta} > % location number: 2; type: section; section number: 2 > \subsection{Aap} > % location number: 3; type: subsection; subsection number: 1 > \subsection{Noot} > % location number: 4; type: subsection; subsection number: 2 > \section{Gamma} > % location number: 5; type: section; section number: 3 > > \namedstructureheadlocation{X} then returns the location number of the > current X, where X is the name of a structure level (e.g. 'chapter', > 'section', etc.) > > If you ask for e.g. \namedstructureheadlocation{chapter}, and you are > not in a chapter, then 0 is returned. > > Anything missing? a location number is some kind of unique internal reference, a pretty old feature btw, dating from the early days of context, when complex interactivity was added, but it comes in handy here Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 8:44 ` Wolfgang Schuster 2012-11-08 10:06 ` Marco Patzer @ 2012-11-08 21:37 ` Marco Patzer 2012-11-08 21:45 ` Marco Patzer 2012-11-08 21:48 ` Wolfgang Schuster 1 sibling, 2 replies; 16+ messages in thread From: Marco Patzer @ 2012-11-08 21:37 UTC (permalink / raw) To: ntg-context 2012-11-08 Wolfgang Schuster: > \setupheadertexts > [\setups{headlist}] > > \startsetups [headlist] > \framed[align=normal, frame=off] > {\placelist [chapter] [alternative=highlight, criterium=all]} > \stopsetups > > \definelistalternative > [highlight] > [renderingsetup=list:highlight] Why does the custom list alternative succeed in a header but fails in a layer? A predefined alternative works perfectly in a layer. \setupfootertexts [\setups{footlist}] \setupbackgrounds [page] [background=layer:chapter] \definelayer [layer:chapter] [state=repeat] \setlayer [layer:chapter] {\placelist [chapter] [alternative=f, criterium=all]} %% works %% {\placelist [chapter] [alternative=highlight, criterium=all]} %% fails \definelistalternative [highlight] [renderingsetup=list:highlight] \startsetups [list:highlight] \currentlistentrytitle \stopsetups %% works \startsetups [footlist] \placelist [chapter] [alternative=highlight, criterium=all] \stopsetups \starttext \startchapter [title=Alpha] \stopchapter \startchapter [title=Beta] \stopchapter \startchapter [title=Gamma] \stopchapter \stoptext 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 21:37 ` Marco Patzer @ 2012-11-08 21:45 ` Marco Patzer 2012-11-08 21:48 ` Wolfgang Schuster 1 sibling, 0 replies; 16+ messages in thread From: Marco Patzer @ 2012-11-08 21:45 UTC (permalink / raw) To: ntg-context 2012-11-08 Marco Patzer: I just realized when I presses “send”: > Why does the custom list alternative succeed in a header but fails > in a layer? A predefined alternative works perfectly in a layer. > > \setupfootertexts > [\setups{footlist}] > > \setupbackgrounds > [page] > [background=layer:chapter] \setupbackgrounds [page] [background=layer:chapter, setups=setups:headlayer] > \setlayer > [layer:chapter] > {\placelist [chapter] [alternative=f, criterium=all]} %% works > %% {\placelist [chapter] [alternative=highlight, criterium=all]} %% fails \startsetups [setups:headlayer] \setlayer [layer:chapter] {\placelist [chapter] [alternative=highlight, criterium=all]} \stopsetups Well, we have dynamic content, so wrap it in a setup. 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 21:37 ` Marco Patzer 2012-11-08 21:45 ` Marco Patzer @ 2012-11-08 21:48 ` Wolfgang Schuster 2012-11-08 22:16 ` Hans Hagen 1 sibling, 1 reply; 16+ messages in thread From: Wolfgang Schuster @ 2012-11-08 21:48 UTC (permalink / raw) To: mailing list for ConTeXt users Am 08.11.2012 um 22:37 schrieb Marco Patzer <homerow@lavabit.com>: > 2012-11-08 Wolfgang Schuster: > >> \setupheadertexts >> [\setups{headlist}] >> >> \startsetups [headlist] >> \framed[align=normal, frame=off] >> {\placelist [chapter] [alternative=highlight, criterium=all]} >> \stopsetups >> >> \definelistalternative >> [highlight] >> [renderingsetup=list:highlight] > > Why does the custom list alternative succeed in a header but fails > in a layer? A predefined alternative works perfectly in a layer. Header and footers are added and calculated after the page is finished but when you put a text in a layer it is fixed at this moment. The problem in your example with the custom list alternative is that you haven’t defined it when it is needed, when you put \definelistalternative and \startsetups … \stopsetups before \setlayer you can see it. For a dynamic layer take a look at this wiki page: http://wiki.contextgarden.net/Layers#Use_dynamic_content 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Highlight current chapter in list 2012-11-08 21:48 ` Wolfgang Schuster @ 2012-11-08 22:16 ` Hans Hagen 2012-11-09 0:43 ` Tikz backgrounds (was Re: Highlight current chapter in list) Aditya Mahajan 0 siblings, 1 reply; 16+ messages in thread From: Hans Hagen @ 2012-11-08 22:16 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Wolfgang Schuster On 11/8/2012 10:48 PM, Wolfgang Schuster wrote: > > Am 08.11.2012 um 22:37 schrieb Marco Patzer <homerow@lavabit.com>: > >> 2012-11-08 Wolfgang Schuster: >> >>> \setupheadertexts >>> [\setups{headlist}] >>> >>> \startsetups [headlist] >>> \framed[align=normal, frame=off] >>> {\placelist [chapter] [alternative=highlight, criterium=all]} >>> \stopsetups >>> >>> \definelistalternative >>> [highlight] >>> [renderingsetup=list:highlight] >> >> Why does the custom list alternative succeed in a header but fails >> in a layer? A predefined alternative works perfectly in a layer. > > Header and footers are added and calculated after the page is finished > but when you put a text in a layer it is fixed at this moment. > > The problem in your example with the custom list alternative is that > you haven’t defined it when it is needed, when you put \definelistalternative > and \startsetups … \stopsetups before \setlayer you can see it. > > For a dynamic layer take a look at this wiki page: http://wiki.contextgarden.net/Layers#Use_dynamic_content here is another variant: \defineoverlay[pagenumber:preset][\texsetup{pagenumber:preset}] \startsetups pagenumber:preset PRESET \stopsetups \defineoverlay[pagenumber:action][\texsetup{pagenumber:action}] \startsetups pagenumber:action ACTION \stopsetups \setupbackgrounds [page] [background={pagenumber:preset,pagenumber:action}] \starttext \dorecurse{4}{\page[empty]} \stoptext (just to illustrate that an overlay can be used for anything) ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Tikz backgrounds (was Re: Highlight current chapter in list) 2012-11-08 22:16 ` Hans Hagen @ 2012-11-09 0:43 ` Aditya Mahajan 2012-11-09 9:17 ` Hans Hagen 0 siblings, 1 reply; 16+ messages in thread From: Aditya Mahajan @ 2012-11-09 0:43 UTC (permalink / raw) To: mailing list for ConTeXt users On Thu, 8 Nov 2012, Hans Hagen wrote: > (just to illustrate that an overlay can be used for anything) This prompted me to finish testing what I had been thinking about for a while. In most cases, metapost is sufficient for drawing backgrounds, but occasionally using tikz is nicer. For example, when tikz provides a solution that is not available in metapost (e.g., drawing "snake" paths), or extremely difficult to get right in metapost (drawing shadows). As Hans said, overlays can be used for anything, including tikz background. Here is a proof of concept implementation: \usemodule[tikz] \usetikzlibrary[decorations.pathmorphing] \def\TIKZdecorationoverlay {\starttikzpicture \expanded{\draw[\overlaylinecolor, line width=\overlaylinewidth, decorate, decoration={\framedparameter{decoration}}] (0,0)--(\overlaywidth,0) -- (\overlaywidth,\overlayheight) -- (0,\overlayheight) -- cycle;} \stoptikzpicture} \defineoverlay[decoration][\TIKZdecorationoverlay] \setupframed [decoration=snake] \starttext \framed[frame=off, rulethickness=3bp, background=decoration, backgroundoffset=3mm, framecolor=red, align=normal] {\input ward \endgraf} \blank[2*big] \externalfigure [cow] [frame=off, frameoffset=5pt, backgroundoffset=frame, background=decoration, decoration={coil, amplitude=4pt, segment length=5pt}] \stoptext Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Tikz backgrounds (was Re: Highlight current chapter in list) 2012-11-09 0:43 ` Tikz backgrounds (was Re: Highlight current chapter in list) Aditya Mahajan @ 2012-11-09 9:17 ` Hans Hagen 0 siblings, 0 replies; 16+ messages in thread From: Hans Hagen @ 2012-11-09 9:17 UTC (permalink / raw) To: mailing list for ConTeXt users On 11/9/2012 1:43 AM, Aditya Mahajan wrote: > \externalfigure > [cow] > [frame=off, frameoffset=5pt, backgroundoffset=frame, > background=decoration, > decoration={coil, amplitude=4pt, segment length=5pt}] how about a namespace: decoration:spec={coil, amplitude=4pt, segment length=5pt}] or so, i.e. avoid a clash with (potentially new) keys Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-11-09 17:03 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-11-07 23:29 Highlight current chapter in list Marco Patzer 2012-11-08 8:44 ` Wolfgang Schuster 2012-11-08 10:06 ` Marco Patzer 2012-11-08 11:06 ` Hans Hagen 2012-11-08 11:15 ` Hans Hagen 2012-11-08 11:42 ` Marco Patzer 2012-11-08 17:32 ` Marco Patzer 2012-11-08 18:18 ` Hans Hagen 2012-11-09 16:53 ` Sietse Brouwer 2012-11-09 17:03 ` Hans Hagen 2012-11-08 21:37 ` Marco Patzer 2012-11-08 21:45 ` Marco Patzer 2012-11-08 21:48 ` Wolfgang Schuster 2012-11-08 22:16 ` Hans Hagen 2012-11-09 0:43 ` Tikz backgrounds (was Re: Highlight current chapter in list) Aditya Mahajan 2012-11-09 9:17 ` Hans Hagen
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).