ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* multiple backgrounds
@ 2006-01-14 23:42 Henning Hraban Ramm
       [not found] ` <6faad9f00601141623x70ae39a9m11a0854a9045f418@mail.gmail.com>
  2006-01-15 17:54 ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Henning Hraban Ramm @ 2006-01-14 23:42 UTC (permalink / raw)


I'm playing around with layers and try to rewrite the letter style in  
a cleaner way.

How can I use several layers as page backgrounds and switch them on  
and off independently from each other?

With
\setupbackgrounds[rightpage][page][state=start, background=logolayer]
\setupbackgrounds[rightpage][page][state=start, background=senderlayer]
the second background overwrites the first, but I can't define them  
together, because there could be several combinations of 5-7 layers.

Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
       [not found] ` <6faad9f00601141623x70ae39a9m11a0854a9045f418@mail.gmail.com>
@ 2006-01-15  0:37   ` Henning Hraban Ramm
  2006-01-15  8:03     ` Peter Münster
  0 siblings, 1 reply; 9+ messages in thread
From: Henning Hraban Ramm @ 2006-01-15  0:37 UTC (permalink / raw)


Am 2006-01-15 um 01:23 schrieb Mojca Miklavec:

> I don't know if this works, but the only thing I can think of is  
> setting
> \setupbackgrounds[rightpage][page][state=start,
> background={logolayer,sendlayer}]

I guess I must use that, but it's not flexible enough (e.g. you can't  
*add* some background).

> and then alternatively using
> \defineoverlay[logolayer][whatever the content is]
> and
> \defineoverlay[logolayer][]
>
> But that's an ugly solution. I always redefine \setupbackgrounds for
> my basic usage.
>
> Perhaps you can ask Hans for implementing
> \setupoverlay[logolayer][state=start/stop]

Hm, Holger uses a complicated bunch of setups in his letter style.
I hoped to get that easier...


Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-15  0:37   ` Henning Hraban Ramm
@ 2006-01-15  8:03     ` Peter Münster
  2006-01-15 11:17       ` Henning Hraban Ramm
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Münster @ 2006-01-15  8:03 UTC (permalink / raw)


On Sun, 15 Jan 2006, Henning Hraban Ramm wrote:

> I guess I must use that, but it's not flexible enough (e.g. you can't  
> *add* some background).

Hello Henning,
since some weeks, you *can* add some backgrounds:

\setupcolors[state=start]
\defineoverlay[layer1][{\color[red]{this is layer 1}}]
\defineoverlay[layer2][{\rotate[rotation=30]{\color[blue]{this is layer 2}}}]
\defineoverlay[layer3][{\rotate[rotation=60]{\color[green]{this is layer 3}}}]
\setupbackgrounds[page][state=start,background=layer1]
\doifmode{layer2}{%
  \expandparameters
  \setupbackgrounds[page][background={\currentvalue,layer2}]}
\doifmode{layer3}{%
  \expandparameters
  \setupbackgrounds[page][background={\currentvalue,layer3}]}
\starttext
\input tufte
\stoptext

Then, you can use any combination of mode=layer2 and/or mode=layer3...

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-15  8:03     ` Peter Münster
@ 2006-01-15 11:17       ` Henning Hraban Ramm
  2006-01-16 19:13         ` Peter Münster
  0 siblings, 1 reply; 9+ messages in thread
From: Henning Hraban Ramm @ 2006-01-15 11:17 UTC (permalink / raw)


Am 2006-01-15 um 09:03 schrieb Peter Münster:

>> I guess I must use that, but it's not flexible enough (e.g. you can't
>> *add* some background).
> since some weeks, you *can* add some backgrounds:

Cool! :-)
Now I must only find a way to *subtract* a layer, but I guess I can  
manage that with some "doifmode"s



Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-14 23:42 multiple backgrounds Henning Hraban Ramm
       [not found] ` <6faad9f00601141623x70ae39a9m11a0854a9045f418@mail.gmail.com>
@ 2006-01-15 17:54 ` Hans Hagen
  2006-01-15 19:13   ` Henning Hraban Ramm
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2006-01-15 17:54 UTC (permalink / raw)


Henning Hraban Ramm wrote:

> I'm playing around with layers and try to rewrite the letter style in  
> a cleaner way.
>
> How can I use several layers as page backgrounds and switch them on  
> and off independently from each other?
>
> With
> \setupbackgrounds[rightpage][page][state=start, background=logolayer]
> \setupbackgrounds[rightpage][page][state=start, background=senderlayer]
> the second background overwrites the first, but I can't define them  
> together, because there could be several combinations of 5-7 layers.

background={logolayer,senderlayer}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-15 17:54 ` Hans Hagen
@ 2006-01-15 19:13   ` Henning Hraban Ramm
  0 siblings, 0 replies; 9+ messages in thread
From: Henning Hraban Ramm @ 2006-01-15 19:13 UTC (permalink / raw)


Am 2006-01-15 um 18:54 schrieb Hans Hagen:

>> \setupbackgrounds[rightpage][page][state=start, background=logolayer]
>> \setupbackgrounds[rightpage][page][state=start,  
>> background=senderlayer]
>> the second background overwrites the first, but I can't define  
>> them  together, because there could be several combinations of 5-7  
>> layers.
> background={logolayer,senderlayer}

Thanks, I knew that, but I've some more layers and need to activate/ 
deactivate them independent from each other.

At the moment I use modes to "mark" which layers should be visible.
If I want to change something, I switch everything off and add those  
layers that I need.
Like this:

\def\EnableLayer#1{\enablemode[#1layermode]\setups[#1layersetup]}
% *layersetup typesets and activates *layer
\def\DisableLayer#1{\disablemode[#1layermode]\ResetLayers}

\startsetups firstpagesetup
	\setuplayout[header=96mm, footer=20mm]
	\EnableLayer{marks}
	\EnableLayer{logo}
	\EnableLayer{sender}
	\EnableLayer{account}
	\EnableLayer{recipient}
	\ResetLayers
\stopsetups

\startsetups normalpagesetup
	\setuplayout[header=10mm, footer=10mm]
	\EnableLayer{marks}
	\EnableLayer{logo}
	\DisableLayer{recipient}
	\DisableLayer{sender}
	\DisableLayer{account}
	\ResetLayers
\stopsetups

\def\LetterFirstPage{\setups{firstpagesetup}}
\appendtoks\setups{normalpagesetup}\to\everyaftershipout

\def\ResetLayers{%
	\setupbackgrounds[page][background=]
	\setupbackgrounds[rightpage][page][background=]
	\doifmode{senderlayermode}{%
		\expandparameters
		\setupbackgrounds[rightpage][page][background= 
{\currentvalue,senderlayer}]
	}
	\doifmode{recipientlayermode}{%
		\expandparameters
		\setupbackgrounds[rightpage][page][background= 
{\currentvalue,recipientlayer}]
	}
	\doifmode{accountlayermode}{%
		\expandparameters
		\setupbackgrounds[rightpage][page][background= 
{\currentvalue,accountlayer}]
	}
	\doifmode{logolayermode}{%
		\expandparameters
		\setupbackgrounds[page][background={\currentvalue,logolayer}] %  
maybe rightpage
	}
	\doifmode{markslayermode}{%
		\expandparameters
		\setupbackgrounds[rightpage][page][background= 
{\currentvalue,markslayer}]
	}
}

I still wonder why those backgrounds are only visible on one page,  
even if I use state=repeat and don't call normalsetup.




Grüßlis vom Hraban!
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-15 11:17       ` Henning Hraban Ramm
@ 2006-01-16 19:13         ` Peter Münster
  2006-01-16 19:51           ` Hans Hagen
  2006-01-16 20:15           ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Peter Münster @ 2006-01-16 19:13 UTC (permalink / raw)


On Sun, 15 Jan 2006, Henning Hraban Ramm wrote:

> Now I must only find a way to *subtract* a layer, but I guess I can  
> manage that with some "doifmode"s

Hello TeX-experts,

I tried to do the layer-subtraction, but it seems that I need more
experience with expansion in TeX. Here is the error:
! Undefined control sequence.
\GetList #1,#2;->\edef \ListHead 

And here my test file:

\def\GetList#1,#2;{\edef\ListHead{#1}\edef\ListTail{#2}}
\def\Remove#1#2{\doRemove{#1}{#2,\relax}}
\def\doRemove#1#2{\expandafter\GetList#2;%
  \doifelse{\ListHead}{#1}{}{\ListHead,}%
  \doifelse{\ListTail}{\relax}{}{\doRemove{#1}{\ListTail}}%
}

\def\addBGbefore#1{\expandparameters
  \setupbackgrounds[page][background={#1,\currentvalue}]}
\def\addBGafter#1{\expandparameters
  \setupbackgrounds[page][background={\currentvalue,#1}]}
\def\removeBG#1{\expandparameters
  \setupbackgrounds[page][background={\Remove{#1}{\currentvalue}}]}

\setupcolors[state=start]
\defineoverlay[layer1][{\color[red]{this is layer 1}}]
\defineoverlay[layer2][{\rotate[rotation=30]{\color[blue]{this is layer 2}}}]
\defineoverlay[layer3][{\rotate[rotation=60]{\color[green]{this is layer 3}}}]

\starttext
\addBGafter{layer1}
\input tufte
\page
\addBGafter{layer2}
\input tufte
\page
\addBGbefore{layer3}
\input tufte
\page
\removeBG{layer2}
\Values
\input tufte
\page
\removeBG{layer1}
\input tufte
\stoptext

Cheers, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-16 19:13         ` Peter Münster
@ 2006-01-16 19:51           ` Hans Hagen
  2006-01-16 20:15           ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-01-16 19:51 UTC (permalink / raw)


� wrote:

>On Sun, 15 Jan 2006, Henning Hraban Ramm wrote:
>
>  
>
>>Now I must only find a way to *subtract* a layer, but I guess I can  
>>manage that with some "doifmode"s
>>    
>>
>
>Hello TeX-experts,
>
>I tried to do the layer-subtraction, but it seems that I need more
>experience with expansion in TeX. Here is the error:
>! Undefined control sequence.
>\GetList #1,#2;->\edef \ListHead 
>
>And here my test file:
>
>\def\GetList#1,#2;{\edef\ListHead{#1}\edef\ListTail{#2}}
>\def\Remove#1#2{\doRemove{#1}{#2,\relax}}
>\def\doRemove#1#2{\expandafter\GetList#2;%
>  \doifelse{\ListHead}{#1}{}{\ListHead,}%
>  \doifelse{\ListTail}{\relax}{}{\doRemove{#1}{\ListTail}}%
>}
>
>\def\addBGbefore#1{\expandparameters
>  \setupbackgrounds[page][background={#1,\currentvalue}]}
>\def\addBGafter#1{\expandparameters
>  \setupbackgrounds[page][background={\currentvalue,#1}]}
>\def\removeBG#1{\expandparameters
>  \setupbackgrounds[page][background={\Remove{#1}{\currentvalue}}]}
>
>\setupcolors[state=start]
>\defineoverlay[layer1][{\color[red]{this is layer 1}}]
>\defineoverlay[layer2][{\rotate[rotation=30]{\color[blue]{this is layer 2}}}]
>\defineoverlay[layer3][{\rotate[rotation=60]{\color[green]{this is layer 3}}}]
>
>\starttext
>\addBGafter{layer1}
>\input tufte
>\page
>\addBGafter{layer2}
>\input tufte
>\page
>\addBGbefore{layer3}
>\input tufte
>\page
>\removeBG{layer2}
>\Values
>\input tufte
>\page
>\removeBG{layer1}
>\input tufte
>\stoptext
>
>  
>
i dunno what you want to to, but why not

background={l-1,l-2,l-3,l-4}

and simply set and reset layers, with

\defineoverlay[l-1][] % gone

\defineoverlay[l-1][present]

\defineoverlay[l-1][] % gone again

Hans

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: multiple backgrounds
  2006-01-16 19:13         ` Peter Münster
  2006-01-16 19:51           ` Hans Hagen
@ 2006-01-16 20:15           ` Hans Hagen
  1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2006-01-16 20:15 UTC (permalink / raw)


� wrote:

>On Sun, 15 Jan 2006, Henning Hraban Ramm wrote:
>
>  
>
>>Now I must only find a way to *subtract* a layer, but I guess I can  
>>manage that with some "doifmode"s
>>    
>>
>
>Hello TeX-experts,
>
>I tried to do the layer-subtraction, but it seems that I need more
>experience with expansion in TeX. Here is the error:
>! Undefined control sequence.
>\GetList #1,#2;->\edef \ListHead 
>
>  
>
teaser:

\def\ResetMyList{\lua{MyList = {} ;}}
\def\FlushMyList{\lua{tex.print(table.concat(MyList,","))}}
\def\AddToMyList#1#2{\lua{table.insert(MyList,#1,"#2")}}
\def\RemoveFromMyList#1{\lua{table.remove(MyList,#1)}}

\defineoverlay[mine-1][ONE]
\defineoverlay[mine-2][TWO]
\defineoverlay[mine-3][THREE]

\startsetups [test] \framed[background={\FlushMyList}]{it works okay} 
\stopsetups

\ResetMyList

\AddToMyList{1}{mine-1} \setups[test]
\AddToMyList{2}{mine-2} \setups[test]
\AddToMyList{1}{mine-3} \setups[test]

\RemoveFromMyList{1} \setups[test]
\RemoveFromMyList{1} \setups[test]
\RemoveFromMyList{1} \setups[test]

but ... for at least half a year [we don't expect to have a stable user 
interface before eurotex]  you have to fall back on list processing 
macros in syst-gen.tex and syst-ext.tex

(you can add to lists, split lists and reconstruct them using those  
macros)

Hans

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-01-16 20:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-14 23:42 multiple backgrounds Henning Hraban Ramm
     [not found] ` <6faad9f00601141623x70ae39a9m11a0854a9045f418@mail.gmail.com>
2006-01-15  0:37   ` Henning Hraban Ramm
2006-01-15  8:03     ` Peter Münster
2006-01-15 11:17       ` Henning Hraban Ramm
2006-01-16 19:13         ` Peter Münster
2006-01-16 19:51           ` Hans Hagen
2006-01-16 20:15           ` Hans Hagen
2006-01-15 17:54 ` Hans Hagen
2006-01-15 19:13   ` 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).