ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Chapter numbers in the right margin
@ 2005-03-22  5:14 Randall Skelton
  2005-03-22  6:21 ` luigi.scarso
  0 siblings, 1 reply; 8+ messages in thread
From: Randall Skelton @ 2005-03-22  5:14 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-22  5:14 Chapter numbers in the right margin Randall Skelton
@ 2005-03-22  6:21 ` luigi.scarso
  2005-03-22 15:50   ` Randall Skelton
  0 siblings, 1 reply; 8+ messages in thread
From: luigi.scarso @ 2005-03-22  6:21 UTC (permalink / raw)


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 .

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-22  6:21 ` luigi.scarso
@ 2005-03-22 15:50   ` Randall Skelton
  2005-03-22 16:25     ` Vit Zyka
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Randall Skelton @ 2005-03-22 15:50 UTC (permalink / raw)


> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-22 15:50   ` Randall Skelton
@ 2005-03-22 16:25     ` Vit Zyka
  2005-03-22 16:58     ` luigi.scarso
  2005-03-23 18:56     ` Hans Hagen
  2 siblings, 0 replies; 8+ messages in thread
From: Vit Zyka @ 2005-03-22 16:25 UTC (permalink / raw)


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 --
--

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-22 15:50   ` Randall Skelton
  2005-03-22 16:25     ` Vit Zyka
@ 2005-03-22 16:58     ` luigi.scarso
  2005-03-23 18:56     ` Hans Hagen
  2 siblings, 0 replies; 8+ messages in thread
From: luigi.scarso @ 2005-03-22 16:58 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-22 15:50   ` Randall Skelton
  2005-03-22 16:25     ` Vit Zyka
  2005-03-22 16:58     ` luigi.scarso
@ 2005-03-23 18:56     ` Hans Hagen
  2005-03-23 19:15       ` luigi.scarso
  2 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2005-03-23 18:56 UTC (permalink / raw)


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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-23 18:56     ` Hans Hagen
@ 2005-03-23 19:15       ` luigi.scarso
  2005-03-24  2:47         ` Randall Skelton
  0 siblings, 1 reply; 8+ messages in thread
From: luigi.scarso @ 2005-03-23 19:15 UTC (permalink / raw)


Hans Hagen wrote:

> in addition to other answers

Sorry, mybe the time or a my bad day, i don't understand
Do you refer to  my answers ?
If yes

> (please submit to wiki)

how to ?

(....a my bad day,maybe tomorrow will be better....)

luigi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Chapter numbers in the right margin
  2005-03-23 19:15       ` luigi.scarso
@ 2005-03-24  2:47         ` Randall Skelton
  0 siblings, 0 replies; 8+ messages in thread
From: Randall Skelton @ 2005-03-24  2:47 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-03-24  2:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-22  5:14 Chapter numbers in the right margin Randall Skelton
2005-03-22  6:21 ` luigi.scarso
2005-03-22 15:50   ` Randall Skelton
2005-03-22 16:25     ` Vit Zyka
2005-03-22 16:58     ` luigi.scarso
2005-03-23 18:56     ` Hans Hagen
2005-03-23 19:15       ` luigi.scarso
2005-03-24  2:47         ` Randall Skelton

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).