The following example computes page numbers correctly, places the correct
entries into the TOC, and produces the desired page headers on the first
pages of chapters. However, there are some things it doesn't do properly:

1. It puts headers on blank pages at the ends of chapters even after I
inserted the code that takes care of that problem.

2. It seems to ignore some commands or wait until the next chapter to
implement them. An example is the header on page vi. It's supposed to read
vi............................Contents

3. It seems that commands in the \startsectionenvironment  frontmatter block
are ignored or overridden by commands that are for the body part. That is
why I have so many setup commands ib the \starttext section.



%figure on left - chapter number and title on right
\def\MyChapterCommandM#1#2% #1 is number, #2 is text
   {\startfiguretext[left]{none}
     {\externalfigure[cow][width=.2\textwidth]}
     {\framed[frame=off,align=middle,width=broad]
     {\switchtobodyfont[15pt] #1\\\blank[small] #2}}
    \stopfiguretext}

%no figure on left - chapter number and title on right
\def\MyFrontMatterCommandM#1#2% #1 is number, #2 is text
     {\framed[frame=off,align=middle,width=broad]
     {\switchtobodyfont[15pt] #1\\\blank[small] #2}}

%eliminate headers on blank page at end of chapter
\definepagebreak[mychapterpagebreak][yes,header,next]

%put pagenumber on bottom of first page of chapter
\definetext[chapter][footer][pagenumber]
\setuphead[chapter][header=high,footer=chapter,page=right]
\setuppagenumbering[location=]


\startsectionblockenvironment[frontpart]

\definehead[mycontenttitle][chapter]
\setuphead[mycontenttitle]
 [command=\MyFrontMatterCommandM, number=no,textstyle=\ss\bf,
header=empty,footer=empty,page=mychapterpagebreak,
  numbercommand=\ss\bf\em\tfd,after=\vskip 0.5in
\placeinitial  %comment out this line to eliminate drop capitals
] 

\stopsectionblockenvironment

\startsectionblockenvironment[bodypart]
\setupheadertexts
[chapter][pagenumber][pagenumber][Content Example]

\setuphead[chapter][page=mychapterpagebreak]

\setuphead[chapter]
 [command=\MyChapterCommandM,textstyle=\ss\bf,  
  header=empty,footer=empty,page=mychapterpagebreak,
  numbercommand=\ss\bf\em\tfd,after=\vskip 0.5in,before=\vskip 1.0in
\placeinitial  %comment out this line to eliminate drop capitals
] 

\stopsectionblockenvironment

\startsectionblockenvironment[appendix]

\setupsectionblock[appendix][page=appendicespagebreak] 

\stopsectionblockenvironment

\starttext 

\startfrontmatter

\setuppagenumbering[state=start,alternative=doublesided,conversion=romannume
rals]

Some random text to occupy front matter pages.
\blank[medium]
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\page[right]


%\starthiding
\setuphead[title]
 [command=\MyFrontMatterCommandM, number=no,textstyle=\ss\bf,
header=empty,footer=pagenumber,page=mychapterpagebreak,
  numbercommand=\ss\bf\em\tfd,after=\vskip 0.5in
\placeinitial  %comment out this line to eliminate drop capitals
] 
\setupheadertexts
[Contents][pagenumber][pagenumber][Contents]

\title{Content}

%\stophiding

%\mycontenttitle{Content}  %displays Contents but drops the TOC

\placecontent[alternative=c]

\blank[medium]
Random text added to push TOC onto a second page to test page headers.
\blank[medium]

\input knuth
\input knuth
\input knuth
\input knuth

\setupheadertexts
[chapter][pagenumber][pagenumber][Content Example]

\setuphead[chapter]
 [command=\MyFrontMatterCommandM, number=no,textstyle=\ss\bf,
header=empty,footer=pagenumber,page=mychapterpagebreak,
  numbercommand=\ss\bf\em\tfd,after=\vskip 0.5in
\placeinitial  %comment out this line to eliminate drop capitals
] 

\chapter{Preface}
\input knuth
\page[right]

%switch from lower case Roman numberals to Arabic numbers
\setuppagenumbering[state=start,alternative=doublesided,conversion=numbers]
\setuppagenumber[state=start,number=1]

\setuphead[chapter]
 [command=\MyChapterCommandM,textstyle=\ss\bf,
  header=empty,footer=pagenumber,page=mychapterpagebreak,
  numbercommand=\ss\bf\em\tfd,after=\vskip 0.5in,before=\vskip 1.0in
 \placeinitial  %comment out this line to eliminate drop capitals
] 

\chapter{Introduction}
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth

\stopfrontmatter

\startbodymatter

\chapter{Chapter One}
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth
\input knuth

\chapter{Chapter Two}
\input knuth
\stopbodymatter

\startappendices

\page[stop]

\stopappendices

\stoptext

Tom Benjey
717-258-9733 voice
717-243-0074 fax
Twitter: @TomBenjey






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

Reply via email to