Chapter numbers in the right margin
Hi all, Does anyone have a setuphead snipit and definition to place a large chapter number in the right margin of the page on the first page of each chapter? I believe this should be similar (but simplier) than what is done in 'ConTeXt an Excursion' but I wasn't able to find a definition for that. I'd be quite willing to put this up on the wiki when I figure it out... What I have so far doesn't really lead to much flexibility in terms of positioning. I'd like to be able to set both the horizontal and vertical position of the chapter number. I'd also like to have the number shift vertically downwards for each new chapter. \def\MyChapterText#1{#1 \inright{ \switchtobodyfont[MyTitling, 72pt] \rm \headnumber[chapter] } } \setuphead [Topic, chapter] [textcommand=\MyChapterText, style={\switchtobodyfont[MyTitling, 16pt]\sc}, color=black, number=no, page=right, continue=no, header=empty, before=\vbox to 4cm\bgroup, after=\vss\egroup] Many thanks, Randall
Randall Skelton wrote:
Hi all,
Does anyone have a setuphead snipit and definition to place a large chapter number in the right margin of the page on the first page of each chapter? I believe this should be similar (but simplier) than what is done in 'ConTeXt an Excursion' but I wasn't able to find a definition for that. I'd be quite willing to put this up on the wiki when I figure it out...
What I have so far doesn't really lead to much flexibility in terms of positioning. I'd like to be able to set both the horizontal and vertical position of the chapter number. I'd also like to have the number shift vertically downwards for each new chapter.
\def\MyChapterText#1{#1 \inright{ \switchtobodyfont[MyTitling, 72pt] \rm \headnumber[chapter] } }
\setuphead [Topic, chapter] [textcommand=\MyChapterText, style={\switchtobodyfont[MyTitling, 16pt]\sc}, color=black, number=no, page=right, continue=no, header=empty, before=\vbox to 4cm\bgroup, after=\vss\egroup]
Many thanks, Randall _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
From cont-eni.pdf, chapter Text elements: \setuphead[...][..,..=..,..] : command \command#1#2 numbercommand \command#1 textcommand \command#1 : Use textcommand only for text, numbercommand only for number, command for both; you can see some examples in section Variations in titles .
Use textcommand only for text, numbercommand only for number, command for both; you can see some examples in section Variations in titles .
Thanks for the reply. The problem with separating the text and number is that the space separating the text and number still appears in the chapter text. On a similar note, why doesn't 'show makeup' display the right margin number? \def\MyChapterNumberText#1{ \inright{\begingroup \midaligned{#1} \endgroup} } \def\MyChapterText#1{ \begingroup \leftaligned{#1} \endgroup } \setuphead [Topic, chapter] [numbercommand=\MyChapterNumberText, textcommand=\MyChapterText, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, before=\vbox to 3cm\bgroup, after=\vss\egroup] \starttext %\showmakeup \chapter{This is a Chapter Title} \input tufte \section{This is a section title} \input tufte \par \input knuth \par \subsection{This is a sub-section title} \input tufte \par \input knuth \par \stoptext
Randall Skelton wrote:
Use textcommand only for text, numbercommand only for number, command for both; you can see some examples in section Variations in titles .
Thanks for the reply.
The problem with separating the text and number is that the space separating the text and number still appears in the chapter text. On a similar note, why doesn't 'show makeup' display the right margin number?
May be I do not understand you but you introduce spaces yourself in your \My... Write % at the end of lines as shown:
\def\MyChapterNumberText#1{ \def\MyChapterNumberText#1{% \inright{\begingroup \midaligned{#1} \midaligned{#1}% \endgroup} \endgroup}% }
\def\MyChapterText#1{ \def\MyChapterText#1{% \begingroup \leftaligned{#1} \leftaligned{#1}% \endgroup }
Depends in which mode (horizontal, vertical) your code occures. (If \midaligned expands to \ignorespaces at the end then % is not needed there.) vit
\setuphead [Topic, chapter] [numbercommand=\MyChapterNumberText, textcommand=\MyChapterText, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, before=\vbox to 3cm\bgroup, after=\vss\egroup]
\starttext
%\showmakeup
\chapter{This is a Chapter Title} \input tufte
\section{This is a section title} \input tufte \par \input knuth \par
\subsection{This is a sub-section title} \input tufte \par \input knuth \par
\stoptext _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Vít Zýka --- http://typokvitek.com Automatic document typesetting Automaticka sazba dokumentu -- --
Randall Skelton wrote:
Use textcommand only for text, numbercommand only for number, command for both; you can see some examples in section Variations in titles .
Thanks for the reply.
The problem with separating the text and number is that the space separating the text and number still appears in the chapter text. On a similar note, why doesn't 'show makeup' display the right margin number?
\def\MyChapterNumberText#1{ \inright{\begingroup \midaligned{#1} \endgroup} }
\def\MyChapterText#1{ \begingroup \leftaligned{#1} \endgroup }
\setuphead [Topic, chapter] [numbercommand=\MyChapterNumberText, textcommand=\MyChapterText, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, before=\vbox to 3cm\bgroup, after=\vss\egroup]
\starttext
%\showmakeup
\chapter{This is a Chapter Title} \input tufte
\section{This is a section title} \input tufte \par \input knuth \par
\subsection{This is a sub-section title} \input tufte \par \input knuth \par
\stoptext _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Sorry Randall; i'm sure that i don't understand what you want. Maybe next code can help you... \def\MyChapterCommand#1#2{% \hbox to \textwidth{#1\hss #2}% } % or perhaps % %\def\MyChapterCommand#1#2{% %\hbox to \textwidth{\llap{#1}\hss #2}% %} \setuphead [Topic, chapter] [%numbercommand=\MyChapterNumberText, %textcommand=\MyChapterText, command={\MyChapterCommand}, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, before=\vbox to 3cm\bgroup, after=\vss\egroup] luigi
Randall Skelton wrote:
Use textcommand only for text, numbercommand only for number, command for both; you can see some examples in section Variations in titles .
Thanks for the reply.
The problem with separating the text and number is that the space separating the text and number still appears in the chapter text. On a similar note, why doesn't 'show makeup' display the right margin number?
\def\MyChapterNumberText#1{ \inright{\begingroup \midaligned{#1} \endgroup} }
\def\MyChapterText#1{ \begingroup \leftaligned{#1} \endgroup }
\setuphead [Topic, chapter] [numbercommand=\MyChapterNumberText, textcommand=\MyChapterText, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, before=\vbox to 3cm\bgroup, after=\vss\egroup]
\starttext
%\showmakeup
\chapter{This is a Chapter Title} \input tufte
\section{This is a section title} \input tufte \par \input knuth \par
\subsection{This is a sub-section title} \input tufte \par \input knuth \par
\stoptext
in addition to other answers (please submit to wiki) %%%% no need for dunny \begingroups and spaces \def\MyChapterNumberText#1% {\inright{\midaligned{#1}}} \def\MyChapterText#1% {\leftaligned{#1}} %%%% set distance to 0pt (distance between number and text) \setuphead [Topic,chapter] [numbercommand=\MyChapterNumberText, textcommand=\MyChapterText, numberstyle={\switchtobodyfont[48pt]}, textstyle={\switchtobodyfont[12pt]}, color=black, number=yes, page=right, continue=no, header=empty, distance=0pt, % no number before it before=\vbox to 3cm\bgroup, after=\vss\egroup] %%%% an alternativ eis to set alternative=command and alike, but more fun is to hook in your own handler %%%% undocumented -) \definemarginline[MyOuter] [location=outer,width=\outermarginwidth] \def\MyPlaceHead#1#2{\vbox{\MyOuter{\midaligned{#1}}#2}} \defineheadplacement[MyHead][vertical]#1#2{\MyPlaceHead{#1}{#2}} \setuphead[chapter][alternative=MyHead] %%%% you rexample \starttext \showframe \chapter{This is a Chapter Title} \input tufte \section{This is a section title} \input tufte \par \input knuth \par \subsection{This is a sub-section title} \input tufte \par \input knuth \par \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Many thanks to all who have offerred help with this. I'll submit these and a few more examples to the wiki after the Easter break. Cheers, Randall
participants (4)
-
Hans Hagen
-
luigi.scarso
-
Randall Skelton
-
Vit Zyka