Hi,

I'm re-posting my previous reply to a request from Wolfgang Schuster to supply
an example that exhibits the problem of headers at page bottom.  In my previous
reply the attached example was more or less obscurely hidden in a link at the
bottom of the Digest.

This time I included the example in the e-mail -- it's a bit long I'm afraid.


Here's an example of a ConTeXt file where a header occurs at page bottom.
The subsection named "Perl snippet" occurs at the bottom of page 2, followed
by framed text on page 3. It would be much nicer if the header would be
written on page 3. Note: I extracted this example from a real-life text; for some reason
the frames in the example are drawn wrongly, but this is beside the point.

Run the example with texexec --pdf test.tex

These are the outputs of pdfetex --version and texexec --version on my system (Fedora Core 6):

              texexec : TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005
              texutil : TeXUtil 9.0.0 - ConTeXt / PRAGMA ADE 1992-2004
                  tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
              context : ver: 2005.01.31
              cont-en : ver: 2005.01.31  fmt: 2009.1.26  mes: english

              pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4)
              kpathsea version 3.5.4


  --------------------------------  Example  --------------------------------- 


\def\Doctitle{
  Yoyo reference guide
}

\def\Author{
  Flavius Aurelius
}

\def\Copyrightyear{
  2023
}

\def\Revision{
  (revision 0.1)
}

\def\Footertext{
  {\copyright} {\Copyrightyear} Yoyomatic {\Revision}
}

\installlanguage[en]

%------------------------------  Set papersize  --------------------------------
\setuppapersize[A4]

%--------------------------  Define layout geometry  ---------------------------
\definelayout[myCustomLayout][
 header=10mm,                    % height of header
 footer=10mm,                    % height of footer
 topspace=8mm,                   % space above header
 bottomspace=\topspace,          % space below footer
 backspace=25mm,
 cutspace=20mm,
 width=middle,
 height=middle,
 marking=on,                     % enable the marking of text
 grid=no,
]

\setuplayout[myCustomLayout]

% Experimental
\definelayout[TitlePageLayout][header=0pt,
                   footer=0pt,
                   backspace=0.25\paperwidth,
                   topspace=0.25\paperheight]

\definestartstop
  [TitlePageLayout]
  [before={\setuplayout[TitlePageLayout]},
   after={\page[left]\setuplayout[reset]}]

%------------------------------  Page numbering  -------------------------------
\setuppagenumbering [alternative=doublesided,
                     location={footer,right},  % where should page number appear
                     left={Page }]             % text to the left of page number

%------------------------------  Custom colors  --------------------------------
\setupcolors[state=start]
\definecolor[DarkYellow] [r=0.5,g=0.5,b=0.1]
\definecolor[LightYellow][r=1.0,g=1.0,b=0.8]
\definecolor[LightBlue]  [r=0.1,g=0.1,b=1.0]
\definecolor[VeryLightBlue]  [r=0.9,g=0.9,b=1.0]
\definecolor[DarkBlue]   [r=0.0,g=0.0,b=0.4]
\definecolor[LightBlack] [r=0.4,g=0.4,b=0.4]
\definecolor[DarkWhite]  [r=0.8,g=0.8,b=0.9]

%-------------------------  Custom font definitions  ---------------------------
% Define custom fonts for title, chapter etc.
\definebodyfont [10pt,11pt,12pt][rm][chapterFont=SansBold at 36pt,
                                     sectionFont=SansBold at 24pt,
                                     subsectionFont=SansBold at 24pt,
                                     subsubsectionFont=SansBold at 18pt,
                                     titleFont=SansBold at 36pt]

% The following setup defines the attributes for drawing horizontal lines
% across the page. These lines are drawn with macros \thinline and \hairline.
%\setupthinrules[color=black,rulethickness=0.5mm]
\setupthinrules[color=black]


\setuphead[title]        [style=\titleFont,
                          color=black]
\setuphead[chapter]      [before=\crlf, % insert empty line before chapter title
                          style=\chapterFont,
                          color=black,
                          prefix=+]
\setuphead[section]      [before=\crlf,
                          style=\sectionFont,
                          color=black,
                          prefix=+]
\setuphead[subsection]   [before=\crlf,
                          style=\subsectionFont,
                          color=black,
                          prefix=+]
\setuphead[subsubsection][before=\crlf,
                          style=\subsubsectionFont,
                          color=black,
                          prefix=+]

\definehead[myhead][section]
\setuphead[myhead] [before=\crlf,
                    page=yes, % start on new page
                    number=no,
                    style=\subsectionFont,
                    color=black]

\definehead[submyhead][myhead]
\setuphead[submyhead] [page=no, % don't start on new page
                       before={\testpage[3]\blank}, % start on new page if less
                                                    % than ... lines fit on the
                                                    % current page
                       style=\subsubsectionFont,
                       color=black]

%---------------------------  Headers and footers  -----------------------------
\setupheader[text][after=\hairline]
\setupfooter[text][before=\hairline]
\setupheadertexts[chapter][\Doctitle]
\setupfootertexts[text][\midaligned{\Footertext}][pagenumber]

%-----------------------  Attributes for framed texts  -------------------------
\setupframedtexts[width=fit,
                  height=fit,
                  offset=0mm,
                  location=middle,
                  bodyfont=12pt,
                  framecorner=rectangular,
                  framecolor=DarkYellow,
                  background=color,
                  backgroundcolor=LightYellow]
\setupframed[width=fit,
             height=fit,
             offset=2mm,
             location=middle,
             bodyfont=12pt,
             framecorner=rectangular,
             framecolor=DarkYellow,
             background=color,
             backgroundcolor=LightYellow]


% This is a better framed text -- it breaks over pages:
\definetextbackground[FramedText][
                      location=paragraph,
                      rulethickness=0.5pt,
                      framecolor=DarkYellow,
                      background=color,
                      backgroundcolor=LightYellow,
                      leftoffset=0.5\bodyfontsize,
                      rightoffset=0.5\bodyfontsize,
                      topoffset=1.0\bodyfontsize,
                      bottomoffset=1.0\bodyfontsize,
                      before={\testpage[3]}, % test if 3 lines fit on current
                                             % page, otherwise go to next page
                      frame=on]

%-------------------------  Attributes for footnotes  --------------------------
\setupfootnotes[rule=off,background=color,backgroundcolor=white]
\setupfootnotedefinition[background=color,backgroundcolor=red]

%----------------------  Attributes for verbatim texts  ------------------------
%
% This is meant for verbatim text and code examples.
\setuptyping[margin=3mm,
             space=off,               % Do not show space characters explicitely
             color=DarkBlue,          % Color of verbatim text
             before={\startFramedText}, % Draw verbatim text on a background
             after={\stopFramedText}, ]

\setupbackground[background=color,backgroundcolor=LightYellow]


%-----------------------------  Table attributes  ------------------------------
\setupcaption[table][location=bottom]
\setuptables[rulethickness=0.1mm,rulecolor=LightBlack,background=color,backgroundcolor=red]

% Experimental (splitting does not work in combination with placeTABLE)
\setupTABLE[split=yes]
\setupTABLE[row][each][background=none,frame=off]
\setupTABLE[column][each][frame=on,bottomframe=off,topframe=off]
\setupTABLE[column][first][leftframe=off]
\setupTABLE[column][last][rightframe=off]
\setupTABLE[row][first][bottomframe=on,
                        background=color,backgroundcolor=VeryLightBlue]
\setupTABLE[row][last][bottomframe=on]
\definefloat[TABLE][TABLEs]
\setupfloat[TABLE][location=middle]


%-------------------------  Set up table of contents  --------------------------
\setupheadtext[content={Table of Contents}]  % The title
\definecombinedlist [ToC][chapter,section,subsection,myhead][
                          placehead=yes, criterium=all]
\setupcombinedlist[ToC][interaction=all,alternative=c]
\def\placeToC{\crlf\chapter{Table of Contents}\crlf\placecombinedlist[ToC]}





\starttext
\chapter{Reference}

\section{Overview}

\myhead{Tiytiiiiuytiii}
\starttyping

  zxzzzz zxzAzzIzzzxzzz
           zxzzzz zxzzzzzzzz
           zxzzzz zzzzzzzzz
           zzzzzz zzzzxzzzzxzz
           zzzzzz zzzzzz
           zzzzzz zzzxzzzz
           zzzyzz z-zzxzzzxzzzz
           zzzyzz z-zzxzzzxzzzz
\stoptyping


\submyhead{Ejhgfjgjgjn}

Azzz xz zzzzxzzz zz zzzzzzzzz zz zxzzzzzzzz zxzzzz $<$zzzzz$>$zzzzxzzzzxzz$<$/zzzzz$>$
zzzz x zzxzzzzzzxzzzz zz zzzzzz, zzzxzzzz xzz zzxzzzxzzzz.  Azzzzzzz zxzzzz zzz
zzzzzz xzz \type{M0}, \type{MX} xzz \type{MY}.  Azzzzzzz zxzzzz zzz zzzxzzzz xzz \type{R0}, \type{R90}, \type{R180} xzz
\type{R270}.  Azzzzzzz zxzzzz zzz z-, xzz z-zzxzzzxzzzz xzz xzz zzzyzz zxzzz. Tzz
zzxzzzxzzzz zz zzzxzzzz zz zzz zxzzzzzzzz'z zzzzzz.  Tzz zzzzxzzz zxzz zzzzzzzzz
zzzzzz zzz zzzzz zzz zz $<$zzzzz$>$zxzzzzzzzz$<$/zzzzz$>$. Az zzzzz zzzzzz zz zzzzzzzxz
zxzzz xzz zzzzz, zz zzzz zzz zzzzxzzz zxzz zz zzzxzzz.  Iz xz zzzzxzzz zz zzz
zzzzzzz zz x zxzzzz zz zzzxzzz, zzz zxzzzz zz zzz zzzzxzzz zz zzzz xz zzz
zzzzzzz.

\submyhead{Python snippet}
\starttyping

  # Azz x zzzz "B" zz zzz zxzzzz, zzzzz zz zxzzzz zz zzz zzzzzzz
  zzz zxzzzz [zxzLzxzCzz zzz/zz.zzz]
  zzz zzzzzzz [zxzTzzCzzz $zxzzzz]
  zz [zxzzz {zxzAzzCzzz $zxzzzz "B"} zzzzzzz] {
      # zzzzz zzzzzzzz, zzzz zzzzzz!
      zzzz $zzzzzzz
      zzzz
  } zzzz {
      # zzzz xzzzz zz, xzz zzzzxzzz
      zz [zxzzz {zxzAzzIzzzxzzz $zzzzzzz $zzzzzzz "I0" M0 R0 0 0} zzzzzzz ]
  {
          # zzzzz zzzzzzzz, zzzzxzzz zxzz zzzzzz!
          zzzz $zzzzzzz
          zzzz
      }
  }
\stoptyping


\submyhead{Perl snippet}
\starttyping

  # Azz x zzzz "B" zz zzz zxzzzz, zzzzz zz zxzzzz zz zzz zzzzzzz
  zzz zzzzzz;
  zzz zxzzzzzzzy;
  zz $zxzzzz = zxzLzxzCzz("zzz/zz.zzz");
  zz $zzzzzzz = zxzTzzCzzz($zxzzzz);
  zz $zzzzzzz;
  zzxz { $zzzzzzz = zxzAzzCzzz($zxzzzz,"B") };
  zz ($@) {
      # zzzzz zzzzzzzz, zzzz zzzzzz!
      zzz $@;
  } zzzz {
      # zzzz xzzzz zz, xzz zzzzxzzz
      zz $zzzzzzz;
    zzxz { $zzzzzzz =
  zxzAzzIzzzxzzz($zzzzzzz,$zzzzzzz,"I0","M0","R0",0,0); };
      zz ($@) {
          # zzzzz zzzzzzzz, zzzzxzzz zxzz zzzzzz!
          zzz $@;
  }
\stoptyping

\stoptext

  -----------------------------  End of example  ----------------------------- 

Thanks in advance,

Jos