header/footer suppression
I can't get both a blank page inserted whenever a chapter finishes on an odd page and also suppress my header on the first page of a chapter. Here's my minimal example: ----- % output=pdftex \starttext \setuphead [chapter] [before={\page\ifodd\realpageno\else\page[empty]\fi\page[right]}, header=empty] \setupheadertexts [chapter] \setuppagenumbering[alternative=doublesided, option=doublesided] \chapter {test} \dorecurse{10}{\input tufte } \chapter {test} \dorecurse{10}{\input tufte } \chapter {test} \dorecurse{10}{\input tufte } \stoptext -----
Guy Worthington
I can't get both a blank page inserted whenever a chapter finishes on an odd page and also suppress my header on the first page of a chapter.
perhaps this hack will help you?
% output=pdftex \starttext
\setuphead [chapter] [page=yes,before={\ifodd\realpageno\else\page[empty]\noheaderandfooterlines\fi}, ]
\setupheadertexts [chapter] \setuppagenumbering[alternative=doublesided, option=doublesided]
what is this option=...? [...] Patrick
Patrick Gundlach wrote:
Guy Worthington wrote
How can I get both a blank page inserted whenever a chapter finishes on an odd page, and also suppress my header on the first page of a chapter.
before={\ifodd\realpageno\else\page[empty]\noheaderandfooterlines\fi},
Thanks Patrick, the next specification is that I have a footer. ----- % output=pdftex \definetext[chapter][footer][pagenumber] % page on which chapters begin \setuphead [chapter] [page=right, header=empty, footer=chapter, % before={\page\ifodd\realpageno\else\page[empty]\fi\page[right]}, ] \setupheadertexts [chapter] \setuppagenumbering[alternative=doublesided] \starttext \chapter {test} \dorecurse{10}{\input tufte } \chapter {test} \dorecurse{10}{\input tufte } \chapter {test} \dorecurse{10}{\input tufte } \stoptext -----
\setuppagenumbering[alternative=doublesided, option=doublesided]
what is this option=...?
is used to produce an even number of pages, so if you count ever page in the book then the number of recto and verso pages are exactly equal.
Guy Worthington
Thanks Patrick, the next specification is that I have a footer.
Sorry, but I don't get what you are trying to achieve (it is too early for me, I guess). One thing that is clear: You want to start chapters on an odd (right) page. On this page, what should be in the header/footer? On the page before that, if it is empty, what do you want there? And how should the header and footer look like on a regular page? [...]
\setupheadertexts [chapter]
this has no effect here (pagenumber is in the center of the header). Try \setuppagenumbering[location=]. Patrick
Patrick Gundlach wrote:
Sorry, but I don't get what you are trying to achieve (it is too early for me, I guess).
You've a good success rate -- first time you haven't read my mind.
One thing that is clear: You want to start chapters on an odd (right) page.
Yep.
On this page, what should be in the header/footer?
The page number should be centered in the footer. The header is empty.
On the page before that, if it is empty, what do you want there?
Nothing. A completely blank page.
And how should the header and footer look like on a regular page?
The footer is empty. The header contains the page number next to the outside margin.
Patrick, I'm posting my environment (on the offchance it might help you read my mind). It's still very rough. ----- %% environment file EnvironmentISOLayout.tex \startenvironment EnvironmentISOLayout \autoloadmapfilestrue %% pagelayout lucida-brightISOLayout (double page) \usetypescript [serif] [hanging] [thanh] \setupencoding [default=texnansi] \setupbodyfont [cmr,14.4pt] \setupalign [hanging] \def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}} \setuplayout [width=2.5\wd0, header=\lineheight, footer=\lineheight, height=\GoldenRatio\makeupwidth, headerdistance=\dimexpr( (\makeupheight - 35\lineheight - \headerheight - \footerheight) /2), footerdistance=\headerdistance, backspace=\dimexpr(\makeupwidth/7), topspace=\dimexpr(\makeupwidth/7)] %% global stuff \setupcolors[state=start] \setuppagenumbering[alternative=doublesided, option=doublesided, location={header,marginedge}] \setupbackgrounds [header][text] % header line spans just the text block [frame=on,topframe=off,leftframe=off,rightframe=off] %% chapter head layout \setuplist [section] [style=boldslanted, align=right, interaction=all, symbol=1, width=1em, pagenumber=no, before=, after=] \definetext[chapter][footer][pagenumber] % page on which chapters begin \setuphead [chapter] [page=, header=empty, % suppress header at start of chapter footer=chapter, % footer at start of chapter numberstyle=ChapterTitleNumberFont, textstyle=ChapterTitleTextFont alternative=command, command=\ContentsHead, prefix=+, before={\page\ifodd\realpageno\else\page[empty]\fi\page[right]}, after={\blank[2*big]}] \definefont [ChapterTitleTextFont][Serif at 24.9pt] \definefont [ChapterTitleNumberFont][SerifBold at 40pt] \def\ContentsHead#1#2% {\setupframed [frame=off]% \framed [width=\hsize,offset=overlay] {\placesidebyside {\doifmodeelse{*sectionnumber} {\framed [width=.6\hsize,offset=1em,strut=no,align=right, background=screen] {\vi In this chapter: \blank \placelist [section][criterium=chapter]}} {\framed [width=.6\hsize]{}}} % dummy {\framed [width=.4\hsize,strut=no,align=left] %% Typeset Chapter Number {\hbox{\vbox to 24.9pt{% height ChapterTitleTextFont \vss #1}}} \vfilll} }% %% Typeset Chapter Title \llap{\lower24.9pt\hbox{#2\hskip0.5em}}} %% sectionblocks \startsectionblockenvironment[frontpart] \setupheadertexts [{\getmarking[chapter][first]}] [] % an optional second arg let you specify what specific mark you want [] % \getmarking[section][first last previous both all] [{\getmarking[chapter][first]}] \setuppagenumbering [conversion=romannumerals] \stopsectionblockenvironment \startsectionblockenvironment[bodypart] \setupheadertexts [Chapter {\getmarking[chapternumber][first]}. {\getmarking[chapter][first]}] [] [] [{\getmarking[section][first]}] \setuppagenumber [number=1] \stopsectionblockenvironment \setuphead [section] [number=no, style=\tfa] \setuphead [subsection] [style=bold] \setuphead [subsubsection] [style=italic] %% paragraph layout \setupwhitespace [medium] \setupindenting [medium] %% pretty printing \definetype [typeXML] [option=XML,palet=graypretty,style=\ix] \definetype [typeJV] [option=JV,palet=graypretty,style=\ix] \setuptyping [XML] [palet=graypretty,style=\ix] \setuptyping [typing] [palet=graypretty, style=\ix] %% urls \setupurl [style=smalltype] % Bug in ConTeXt \unprotect \def\preparethenumber#1#2#3% {\??id#1} \number \result {\doifelsevaluenothing{#1\c!scheider} {\let\numberseparator\empty \let#3#2} {\edef\numberseparator{\getvalue{#1\c!scheider}}% \edef#3{\@EA\separatednumber\@EA{#2}}}} % hm, etex \protect \definesymbol[MySep][--] \defineenumeration [example] [location=serried, text=Example, before=\blank, after=\blank, way=bychapter, style=italic, separator={\symbol[MySep]}] \setupcaptions [style=italic, separator={\symbol[MySep]}, align=right] % visual debuggers \showframe \version[temporary] \stopenvironment %%% Local Variables: %%% mode:context %%% End: ----- You can run it with a fairly simple test file ----- \environment EnvironmentISOLayout \starttext \startbodymatter \chapter {test} \section {test} \dorecurse{10}{\input tufte } \section {test} \dorecurse{12}{\input tufte } \chapter {test} \section {test} \dorecurse{10}{\input tufte } \stopbodymatter \stoptext ----- If you compile this, you'll notice that on the very first page I have a header, I don't want the header, I want a footer with the page number.
Guy Worthington
You've a good success rate -- first time you haven't read my mind.
perhaps I anticipated that the problem would give me a headache. Your wish is beyond my ConTeXt knowlege. Ask me again in a year :) One problem is that with \setuphead[chapter][page=yes] the chapter can start on an even page. On that page the setup from \definetext[chapter]... is taken. Then, with my previously suggested hack, ConTeXt goes to the next page. There you have to setup your header/footer manually, but reset it again on next page. With [page=right] ConTeXt has no way(?) of knowing that it should leave the even page blank. I suggest that "we" add a new keyword to setuphead (no idea what to name it, perhaps skippages=blank) and Hans does some miracle-coding in \dohandelpaginaafB (or wherever). And/or: we could use a keyword in setupheader,setupfooter,...: state=once. This way we could setup a headertext and don't have to worry about it on next page. Patrick But there is probably a) a switch already in ConTeXt, that I haven't seen or b) Hans has just needed such code, so it is already in the pre-beta ...
At 04:47 PM 3/29/2003 +0800, you wrote:
Patrick Gundlach wrote:
Guy Worthington wrote
How can I get both a blank page inserted whenever a chapter finishes on an odd page, and also suppress my header on the first page of a chapter.
before={\ifodd\realpageno\else\page[empty]\noheaderandfooterlines\fi},
\doifoddpageelse{...}{...} this one compensates for shifted pages and is fully expandable There is a cleaner solution: \unprotect % more tolerancy needed \def\dohandelpaginaafB#1% {\doifvaluesomething{\??ko#1\c!pagina} {\def\resetcurrentsectionmarks% toegevoegd, zie \pagina {\resetsectionmarks{\previoussection\@@sectie}}% \pagina[\getvalue{\??ko#1\c!pagina}]% \dohandelpaginaafBB{#1}\v!hoofd\c!hoofd \dohandelpaginaafBB{#1}\v!tekst\c!tekst \dohandelpaginaafBB{#1}\v!voet \c!voet}} % we install a few page handler keys \installpagebreakhandler \v!hoofd {\doifnotvalue{\??tk\v!hoofd\c!status}\v!stop {\setupheader[\c!status=\v!leeg]}} \installpagebreakhandler \v!voet {\doifnotvalue{\??tk\v!voet\c!status}\v!stop {\setupfooter[\c!status=\v!leeg]}} \protect now we can define a new page break: \definepagebreak [chapter] [yes,header,right] look how much cleaner this looks: \setuphead [chapter] [page=chapter, header=empty, footer=chapter] 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 -------------------------------------------------------------------------
Hans Hagen
now we can define a new page break:
\definepagebreak [chapter] [yes,header,right]
what is this header keyword?
look how much cleaner this looks:
\setuphead [chapter] [page=chapter, header=empty, footer=chapter]
this is pretty cool! Is it documented somewhere? (besides \def\...) Patrick
At 09:04 AM 3/31/2003 +0200, Patrick Gundlach wrote:
[...]
now we can define a new page break:
\definepagebreak [chapter] [yes,header,right]
what is this header keyword?
it triggered the hander defined in [...] (\v!hoofd -> hoofd|header|...)
look how much cleaner this looks:
\setuphead [chapter] [page=chapter, header=empty, footer=chapter]
this is pretty cool! Is it documented somewhere? (besides \def\...)
since the header key is defined here, it's not yet documented -) \definepagebreak is already there foe some time and not documented (\definepagabreak, \defineblank, \definecolumnbreal ...) This permits things like: first version of doc: \definepagebreak[version1] [yes] .... \page[version1] -> pagebreak second version of doc: \definepagebreak[version1][] .... \page[version1] -> ignored \define[agebreak[version2][yes] .... \page[version2] -> pagebreak 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 -------------------------------------------------------------------------
Hans Hagen wrote
Patrick Gundlach wrote:
Guy Worthington wrote:
You've a good success rate -- first time you haven't read my mind.
perhaps I anticipated that the problem would give me a headache.
:-)
[pithy summary of my problem; consults crystal ball and exclaims]
But there is probably a) a switch already in ConTeXt, that I haven't seen or b) Hans has just needed such code, so it is already in the pre-beta ...
[Hans Hagen posts a simple interface, that's hiding complex code.]
Thanks Hans the interface is clean and easy to use. Here is my environment file (Please, if anyone finds my posting of my full environment annoying, please say so, and I'll refrain from doing it.) ------------------------- %% environment file \startenvironment EnvironmentISOLayout %%----- % Bugs and enhancements in ConTeXt \unprotect \def\preparethenumber#1#2#3% {\??id#1} \number \result {\doifelsevaluenothing{#1\c!scheider} {\let\numberseparator\empty \let#3#2} {\edef\numberseparator{\getvalue{#1\c!scheider}}% \edef#3{\@EA\separatednumber\@EA{#2}}}} % hm, etex % more tolerancy needed \def\dohandelpaginaafB#1% {\doifvaluesomething{\??ko#1\c!pagina} {\def\resetcurrentsectionmarks% toegevoegd, zie \pagina {\resetsectionmarks{\previoussection\@@sectie}}% \pagina[\getvalue{\??ko#1\c!pagina}]% \dohandelpaginaafBB{#1}\v!hoofd\c!hoofd \dohandelpaginaafBB{#1}\v!tekst\c!tekst \dohandelpaginaafBB{#1}\v!voet \c!voet}} % we install a few page handler keys \installpagebreakhandler \v!hoofd {\doifnotvalue{\??tk\v!hoofd\c!status}\v!stop {\setupheader[\c!status=\v!leeg]}} \installpagebreakhandler \v!voet {\doifnotvalue{\??tk\v!voet\c!status}\v!stop {\setupfooter[\c!status=\v!leeg]}} \protect %%----- \autoloadmapfilestrue %% pagelayout lucida-brightISOLayout (double page) \usetypescript [serif] [hanging] [thanh] \setupencoding [default=texnansi] \setupbodyfont [cmr,14.4pt] \setupalign [hanging] \def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}} \setuplayout [width=2.5\wd0, header=\lineheight, footer=\lineheight, height=\GoldenRatio\makeupwidth, headerdistance=\dimexpr( (\makeupheight - 35\lineheight - \headerheight - \footerheight) /2), footerdistance=\headerdistance, backspace=\dimexpr(\makeupwidth/7), topspace=\dimexpr(\makeupwidth/7)] %% global stuff \setupcolors[state=start] \setuppagenumbering[alternative=doublesided, % option=doublesided, location={header,marginedge}] %% chapter head layout \setuplist [section] [style=boldslanted, align=right, interaction=all, symbol=1, width=1em, pagenumber=no, before=, after=] \definepagebreak % now we can define a new page break: [chapter] [yes,header,right] \definetext[chapter][footer][pagenumber] % page on which chapters begin \setuphead [chapter] [page=chapter, header=empty, % suppress header at start of chapter footer=chapter, % footer at start of chapter numberstyle=ChapterTitleNumberFont, textstyle=ChapterTitleTextFont alternative=command, command=\ContentsHead, prefix=+, after={\blank[2*big]}] \definefont [ChapterTitleTextFont][Serif at 24.9pt] \definefont [ChapterTitleNumberFont][SerifBold at 40pt] \def\ContentsHead#1#2% {\setupframed [frame=off]% \framed [width=\hsize,offset=overlay] {\placesidebyside {\doifmodeelse{*sectionnumber} {\framed [width=.6\hsize,offset=1em,strut=no,align=right, background=screen] {\vi In this chapter: \blank \placelist [section][criterium=chapter]}} {\framed [width=.6\hsize]{}}} % dummy {\framed [width=.4\hsize,strut=no,align=left] %% Typeset Chapter Number {\hbox{\vbox to 24.9pt{% height ChapterTitleTextFont \vss #1}}} \vfilll} }% %% Typeset Chapter Title \llap{\lower24.9pt\hbox{#2\hskip0.5em}}} %% sectionblocks (headers and footers) \setupheader [text] [style=\sc, before={\inframed[width=\makeupwidth, frame=off, bottomframe=on]\bgroup}, after=\egroup] \startsectionblockenvironment[frontpart] \setupheadertexts [{\getmarking[chapter][first]}] [] % an optional second arg let you specify what specific mark you want [] % \getmarking[section][first last previous both all] [{\getmarking[chapter][first]}] \setuppagenumbering [conversion=romannumerals] \stopsectionblockenvironment \startsectionblockenvironment[bodypart] \setupheadertexts [Chapter {\getmarking[chapternumber][first]}. {\getmarking[chapter][first]}] [] [] [{\getmarking[section][first]}] \setuppagenumber [number=1] \stopsectionblockenvironment \setuphead [section] [number=no, style=\tfa] \setuphead [subsection] [style=bold] \setuphead [subsubsection] [style=italic] %% paragraph layout \setupwhitespace [medium] \setupindenting [medium] %% pretty printing \definetype [typeXML] [option=XML,palet=graypretty,style=\ix] \definetype [typeJV] [option=JV,palet=graypretty,style=\ix] \setuptyping [XML] [palet=graypretty,style=\ix] \setuptyping [typing] [palet=graypretty, style=\ix] %% urls \setupurl [style=smalltype] \definesymbol[MySep][--] \defineenumeration [example] [location=serried, text=Example, before=\blank, after=\blank, way=bychapter, style=italic, separator={\symbol[MySep]}] \setupcaptions [style=italic, separator={\symbol[MySep]}, align=right] % visual debuggers % \showframe % \version[temporary] \stopenvironment %%% Local Variables: %%% mode:context %%% End: ------------------------- and a driver: ------------------------- \environment EnvironmentISOLayout \starttext \startbodymatter \chapter {test} \section {test} \dorecurse{10}{\input tufte } \section {test} \dorecurse{12}{\input tufte } \chapter {test} \section {test} \dorecurse{10}{\input tufte } \stopbodymatter \stoptext ------------------------- PS. Sorry for taking so long to reply, my computer was hit by lightning and it's taken a while to reload my system from backups.
participants (3)
-
Guy Worthington
-
Hans Hagen
-
Patrick Gundlach