ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Guy Worthington <guyw@multiline.com.au>
Subject: Re: header/footer suppression
Date: 01 Apr 2003 21:17:24 +0800	[thread overview]
Message-ID: <u65py1hnf.fsf@multiline.com.au> (raw)
In-Reply-To: <87llyw10fj.fsf@gundla.ch>

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.

  parent reply	other threads:[~2003-04-01 13:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-28 11:58 Guy Worthington
2003-03-28 12:54 ` Patrick Gundlach
2003-03-29  8:47   ` Guy Worthington
2003-03-29  9:21     ` Patrick Gundlach
2003-03-29 12:28       ` Guy Worthington
2003-03-29 12:54         ` Guy Worthington
2003-03-29 14:39         ` Patrick Gundlach
2003-03-29 11:07     ` Hans Hagen
2003-03-31  7:04       ` Patrick Gundlach
2003-03-31  7:23         ` Hans Hagen
2003-04-01 13:17         ` Guy Worthington [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-01-24 19:07 Pierre Goossens
2001-01-24 19:38 ` Hans Hagen
2001-01-24 20:44   ` Pierre Goossens
2001-01-25  7:57     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u65py1hnf.fsf@multiline.com.au \
    --to=guyw@multiline.com.au \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).