ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Symmetrical layer positioning?
@ 2007-07-16 15:29 Giuseppe Bilotta
  2007-07-16 15:45 ` Aditya Mahajan
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2007-07-16 15:29 UTC (permalink / raw)
  To: ntg-context

Hello all,

is there a "secret power switch" to tell ConTeXt that a
particular layer has different positioning depending on
wether it's on a left or right page?

I can of course do it manually, either by changing the layer
position on each page or by using two layers instead of one,
but I wanted to know if there was a more straightforward way
that I was missing.

-- 
Giuseppe "Oblomov" Bilotta

___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Symmetrical layer positioning?
  2007-07-16 15:29 Symmetrical layer positioning? Giuseppe Bilotta
@ 2007-07-16 15:45 ` Aditya Mahajan
  2007-07-16 16:41   ` Giuseppe Bilotta
  0 siblings, 1 reply; 6+ messages in thread
From: Aditya Mahajan @ 2007-07-16 15:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, 16 Jul 2007, Giuseppe Bilotta wrote:

> Hello all,
>
> is there a "secret power switch" to tell ConTeXt that a
> particular layer has different positioning depending on
> wether it's on a left or right page?

You can possible use setups and use \doifoddpageelse to set the 
layers. See

http://archive.contextgarden.net/thread/20061102.171506.2fa793e2.en.html

> I can of course do it manually, either by changing the layer
> position on each page or by using two layers instead of one,
> but I wanted to know if there was a more straightforward way
> that I was missing.

Here is an example of using two different layers:

http://wiki.contextgarden.net/Alternating_backgrounds_and_repeating_layers

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Symmetrical layer positioning?
  2007-07-16 15:45 ` Aditya Mahajan
@ 2007-07-16 16:41   ` Giuseppe Bilotta
  2007-07-17  1:31     ` Giuseppe Bilotta
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2007-07-16 16:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Monday, July 16, 2007 Aditya Mahajan wrote:

> On Mon, 16 Jul 2007, Giuseppe Bilotta wrote:

>> Hello all,
>>
>> is there a "secret power switch" to tell ConTeXt that a
>> particular layer has different positioning depending on
>> wether it's on a left or right page?

> You can possible use setups and use \doifoddpageelse to set the
> layers. See

> http://archive.contextgarden.net/thread/20061102.171506.2fa793e2.en.html

Thanks a lot. I don't know if using presets is actually
going to reduce the coding, though.

In the mean time, I've found that layers have a doublesided
option. This apparently allows you to override the
left/right settings of a layer, so I tried

\definelayer[title][
  x=\dimexpr\backspace+\wdall-\wdtit,
  y=\topspace,
  width=\wdtit,
  height=\httit,
  state=repeat,
  doublesided=true,
]

\setuplayer[lefttitle][
  x=\backspace,
]

\definelayer[desc][
  x=\backspace,
  y=\topspace,
  width=\wddesc,
  height=\htdesc,
  state=repeat,
  doublesided=true,
]

\setuplayer[leftdesc][
  x=\dimexpr\backspace+\wdall-\wddesc,
]

\definelayer[figs][
  x=\dimexpr\backspace+\wdall-\wdfig,
  y=\dimexpr\topspace+\makeupheight-\htfig,
  width=\wdfig,
  height=\htfig,
]

\setuplayer[leftfigs][
  x=\backspace,
]

\setupbackgrounds[page][background={color,title,desc,figs},backgroundcolor=elux-ultralight]


However, the 'main' setup is always used, the left one is
never used. Am I doing something wrong?

-- 
Giuseppe "Oblomov" Bilotta

___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Symmetrical layer positioning?
  2007-07-16 16:41   ` Giuseppe Bilotta
@ 2007-07-17  1:31     ` Giuseppe Bilotta
  2007-07-17  6:57       ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Giuseppe Bilotta @ 2007-07-17  1:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Monday, July 16, 2007 Giuseppe Bilotta wrote:

> Monday, July 16, 2007 Aditya Mahajan wrote:

>> On Mon, 16 Jul 2007, Giuseppe Bilotta wrote:

>>> Hello all,
>>>
>>> is there a "secret power switch" to tell ConTeXt that a
>>> particular layer has different positioning depending on
>>> wether it's on a left or right page?

>> You can possible use setups and use \doifoddpageelse to set the
>> layers. See

>> http://archive.contextgarden.net/thread/20061102.171506.2fa793e2.en.html

> Thanks a lot. I don't know if using presets is actually
> going to reduce the coding, though.

> In the mean time, I've found that layers have a doublesided
> option. This apparently allows you to override the
> left/right settings of a layer, so I tried

> \definelayer[title][
>   x=\dimexpr\backspace+\wdall-\wdtit,
>   y=\topspace,
>   width=\wdtit,
>   height=\httit,
>   state=repeat,
>   doublesided=true,
> ]

> \setuplayer[lefttitle][
>   x=\backspace,
> ]

> \definelayer[desc][
>   x=\backspace,
>   y=\topspace,
>   width=\wddesc,
>   height=\htdesc,
>   state=repeat,
>   doublesided=true,
> ]

> \setuplayer[leftdesc][
>   x=\dimexpr\backspace+\wdall-\wddesc,
> ]

> \definelayer[figs][
>   x=\dimexpr\backspace+\wdall-\wdfig,
>   y=\dimexpr\topspace+\makeupheight-\htfig,
>   width=\wdfig,
>   height=\htfig,
> ]

> \setuplayer[leftfigs][
>   x=\backspace,
> ]

> \setupbackgrounds[page][background={color,title,desc,figs},backgroundcolor=elux-ultralight]


> However, the 'main' setup is always used, the left one is
> never used. Am I doing something wrong?

Apparently, I mistook what the doublesided option does for
layers. I've currently solved the problem in the following
way:

\unexpanded\def\titlexpos{%
  \ifodd\realpageno\dimexpr\wdinside+\wdall-\wdtit\else\wdinside\fi
}

\definelayer[title][
  x=\titlexpos,
  y=\topspace,
  width=\wdtit,
  height=\httit,
]

\unexpanded\def\descxpos{%
  \ifodd\realpageno\wdinside\else\dimexpr\wdinside+\wdall-\wddesc\fi
}

\definelayer[desc][
  x=\descxpos,
  y=\topspace,
  width=\wddesc,
  height=\htdesc,
]

\unexpanded\def\figsxpos{%
  \ifodd\realpageno\dimexpr\backspace+\wdall-\wdfig\else\wdinside\fi
}

\definelayer[figs][
  x=\figsxpos,
  y=\dimexpr\topspace+\makeupheight-\htfig,
  width=\wdfig,
  height=\htfig,
]

\setupbackgrounds[page][background={color,title,desc,figs},backgroundcolor=elux-ultralight]


However, this solution doesn't strike me as particularly
elegant. I've seen in page-lyr.tex that support for
left/right layers is currently in progress, but if I read
the code correctly it just creates three layers (name,
leftname, rightname) and they have to be filled
individually. It would be nice to have a simpler interface
to repeated layers with position recalculated on each page.

-- 
Giuseppe "Oblomov" Bilotta

___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Symmetrical layer positioning?
  2007-07-17  1:31     ` Giuseppe Bilotta
@ 2007-07-17  6:57       ` Wolfgang Schuster
  2007-07-17  9:52         ` Giuseppe Bilotta
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2007-07-17  6:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/7/17, Giuseppe Bilotta <gip.bilotta@iol.it>:
> Monday, July 16, 2007 Giuseppe Bilotta wrote:
>
> > Monday, July 16, 2007 Aditya Mahajan wrote:
>
> >> On Mon, 16 Jul 2007, Giuseppe Bilotta wrote:
>
> >>> Hello all,
> >>>
> >>> is there a "secret power switch" to tell ConTeXt that a
> >>> particular layer has different positioning depending on
> >>> wether it's on a left or right page?
>
> >> You can possible use setups and use \doifoddpageelse to set the
> >> layers. See
>
> >> http://archive.contextgarden.net/thread/20061102.171506.2fa793e2.en.html
>
> > Thanks a lot. I don't know if using presets is actually
> > going to reduce the coding, though.
>
> > In the mean time, I've found that layers have a doublesided
> > option. This apparently allows you to override the
> > left/right settings of a layer, so I tried
>
> > \definelayer[title][
> >   x=\dimexpr\backspace+\wdall-\wdtit,
> >   y=\topspace,
> >   width=\wdtit,
> >   height=\httit,
> >   state=repeat,
> >   doublesided=true,
> > ]
>
> > \setuplayer[lefttitle][
> >   x=\backspace,
> > ]
>
> > \definelayer[desc][
> >   x=\backspace,
> >   y=\topspace,
> >   width=\wddesc,
> >   height=\htdesc,
> >   state=repeat,
> >   doublesided=true,
> > ]
>
> > \setuplayer[leftdesc][
> >   x=\dimexpr\backspace+\wdall-\wddesc,
> > ]
>
> > \definelayer[figs][
> >   x=\dimexpr\backspace+\wdall-\wdfig,
> >   y=\dimexpr\topspace+\makeupheight-\htfig,
> >   width=\wdfig,
> >   height=\htfig,
> > ]
>
> > \setuplayer[leftfigs][
> >   x=\backspace,
> > ]
>
> > \setupbackgrounds[page][background={color,title,desc,figs},backgroundcolor=elux-ultralight]
>
>
> > However, the 'main' setup is always used, the left one is
> > never used. Am I doing something wrong?
>
> Apparently, I mistook what the doublesided option does for
> layers. I've currently solved the problem in the following
> way:

\definelayer[test][doublesided=yes]

\setlayer[test][odd][..,..=..,..]{content}

\setlayer[test][even][..,..=..,..]{content}

Wolfgang

> \unexpanded\def\titlexpos{%
>   \ifodd\realpageno\dimexpr\wdinside+\wdall-\wdtit\else\wdinside\fi
> }
>
> \definelayer[title][
>   x=\titlexpos,
>   y=\topspace,
>   width=\wdtit,
>   height=\httit,
> ]
>
> \unexpanded\def\descxpos{%
>   \ifodd\realpageno\wdinside\else\dimexpr\wdinside+\wdall-\wddesc\fi
> }
>
> \definelayer[desc][
>   x=\descxpos,
>   y=\topspace,
>   width=\wddesc,
>   height=\htdesc,
> ]
>
> \unexpanded\def\figsxpos{%
>   \ifodd\realpageno\dimexpr\backspace+\wdall-\wdfig\else\wdinside\fi
> }
>
> \definelayer[figs][
>   x=\figsxpos,
>   y=\dimexpr\topspace+\makeupheight-\htfig,
>   width=\wdfig,
>   height=\htfig,
> ]
>
> \setupbackgrounds[page][background={color,title,desc,figs},backgroundcolor=elux-ultralight]
>
>
> However, this solution doesn't strike me as particularly
> elegant. I've seen in page-lyr.tex that support for
> left/right layers is currently in progress, but if I read
> the code correctly it just creates three layers (name,
> leftname, rightname) and they have to be filled
> individually. It would be nice to have a simpler interface
> to repeated layers with position recalculated on each page.
>
> --
> Giuseppe "Oblomov" Bilotta
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Symmetrical layer positioning?
  2007-07-17  6:57       ` Wolfgang Schuster
@ 2007-07-17  9:52         ` Giuseppe Bilotta
  0 siblings, 0 replies; 6+ messages in thread
From: Giuseppe Bilotta @ 2007-07-17  9:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Tuesday, July 17, 2007 Wolfgang Schuster wrote:

> 2007/7/17, Giuseppe Bilotta <gip.bilotta@iol.it>:
>>
>> Apparently, I mistook what the doublesided option does for
>> layers. I've currently solved the problem in the following
>> way:

> \definelayer[test][doublesided=yes]

> \setlayer[test][odd][..,..=..,..]{content}

> \setlayer[test][even][..,..=..,..]{content}

Indeed, but if I want both sides to always have the same
content, I need to double-code every content insertion, or
write a macro to do that for me. It just moves the trickery
somewhere else :)

My expectation was that when \setlayer is used without
specification on a doublesided layer, it would set the
content for both sides. Alternatively, a way to specify
(even via presets) a position which is page-parity dependent
would be a good thing.

-- 
Giuseppe "Oblomov" Bilotta

___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2007-07-17  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-16 15:29 Symmetrical layer positioning? Giuseppe Bilotta
2007-07-16 15:45 ` Aditya Mahajan
2007-07-16 16:41   ` Giuseppe Bilotta
2007-07-17  1:31     ` Giuseppe Bilotta
2007-07-17  6:57       ` Wolfgang Schuster
2007-07-17  9:52         ` Giuseppe Bilotta

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