[NTG-context] Newbie questions

Thomas Moore tmoore at pomona.edu
Wed Jun 28 20:36:39 CEST 2006


On Jun 25, 2006, at 9:54 AM, Hans Hagen wrote:

> Mojca Miklavec wrote:
>>
>> ....Hoping that someone can fix at least one of the solutions  
>> above to
>> work as intended,
>>
>
> ok, here is a trick: ....
> now, the left right page problem is up to you ... keep in mind that  
> we have
>
> \setupbackgrounds
>   [leftpage]
>   [...]
>
> \setupbackgrounds
>   [rightpage]
>   [...]
Thanks, Mojca, for your ideas! Special thanks to Hans, whose solution  
seemed efficient and worked like a charm (after I made one minor  
fix). I have attached to the end of this message code that works well  
on *either* right pages *or* left pages. Now I'd like to extend the  
code so that it would work on *both* kinds of pages. But my  
experimentation has raised the following questions:

1. When I change the \setupbackgrounds [page][background=thepage] in  
the code shown below to \setupbackgrounds [rightpage] 
[background=thepage], I expected that the left page would have no  
header and the right page would have the appropriate header. However,  
when I do this, I get two superimposed headers with different lengths  
on right pages (and nothing, as expected, on left pages). Why do I  
get *two* headers on the right page?

2. I also do not understand \startsetups command, which I could not  
find in the ConTexT manual or in the online summary of ConTexT  
commands. It looks like the purpose of this command is to put a  
wrapper around the \setlayerframed command so that it can be used in  
the \setupheadertexts command. Is this right?  Also:

    a.  I guess that I don't understand why the \setlayerframed  
command could not be used directly in the \setupheadertexts command:  
why do we need the wrapper?

    b.  And why this particular wrapping command? (\startfoo ...  
\stopfoo doesn't work.)

    c.  Also, I am assuming that the colon is simply part of the name  
assigned to this setup and has no other significance: is this right?

3. So, my guess (once problem 1 is fixed), is that I will define  
*two* layers (one for right pages and one for left pages), and do a  
\setupbackground [rightpage][background=therightpage] and a  
\setupbackground[leftpage][background=theleftpage]. But I don't know  
what to do inside the \startsetup ... \stopsetup. Do I have a pair of  
\setlayerframed statements? Do I surround this pair with something  
like an if onRightPage ... if onLeftPage statement? Or do I put the  
if-then statements *inside* the \setlayerframed statement?

Thanks for any help...

Tom

Code follows:

\usemodule[amsl]
\usemodule[newmat]

\setuppapersize[letter]
\setuppagenumbering
	[alternative=doublesided]
\setuplayout
	[backspace=1.0in,
	topspace=0.5in,
	width=4.5in,
	height=9.5in,
	rightmargin=2.35in,
	rightmargindistance=0.15in,
	leftmargin=0in,
	leftmargindistance=0in,
	header=0.5 in,
	footer=0in]

\definelayer
   [thepage]
   %[hoffset=\the\dimexpr\cutspace-\leftmarginwidth- 
\leftmargindistance\relax,  % for left pages
   [hoffset=\the\dimexpr\backspace\relax,  % for right pages
    voffset=\topspace,
    width=\paperwidth,
    height=\paperheight]

\setupbackgrounds
   [page]
   [background=thepage]

\startsetups page:setup

\setlayerframed
   [thepage]
   [preset=lefttop]
%  [width=\dimexpr\textwidth+\leftmarginwidth+\leftmargindistance 
\relax,  % for left pages
   [width=\dimexpr\textwidth+\rightmarginwidth+\rightmargindistance 
\relax, % for right pages
    rulethickness=1pt,
    frame=off,
    bottomframe=on]
% {\pagenumber\hfill\getmarking[chapter][first]}  % for left pages
   {\getmarking[chapter][first]\hfill\pagenumber}  % for right pages
\stopsetups

\setupheadertexts
   [\setups{page:setup}]
	
\starttext
\chapter{Test}
This is a test of some math stuff. $0 = g_{\mu\nu}dx^\nu dx^\nu$.
\dorecurse{10}{\input knuth}

\showlayout
\stoptext


More information about the ntg-context mailing list