ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Setting up chapter.
@ 2005-07-11 17:12 John R. Culleton
  2005-07-11 21:34 ` Stuart Jansen
  0 siblings, 1 reply; 8+ messages in thread
From: John R. Culleton @ 2005-07-11 17:12 UTC (permalink / raw)


I am trying to set up chapter heads a certain way and my code
keeps getting uglier. Here are the specs:

1. Chapter number centered, with decorations on either side.
2. Chapter title centered below chapter number.
3. Additional decoration centered below chapter title.
4. Both number and text show up in TOC in normal Context manner.

Can this be done easily using the normal chapter macro or should
I do it all from scratch? (If I roll my own I worry about getting
info to the TOC.)
-- 
John Culleton

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

* Re: Setting up chapter.
  2005-07-11 17:12 Setting up chapter John R. Culleton
@ 2005-07-11 21:34 ` Stuart Jansen
  2005-07-12  8:32   ` John R. Culleton
  0 siblings, 1 reply; 8+ messages in thread
From: Stuart Jansen @ 2005-07-11 21:34 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 1437 bytes --]

On Mon, 2005-07-11 at 17:12 +0000, John R. Culleton wrote:
> I am trying to set up chapter heads a certain way and my code
> keeps getting uglier. Here are the specs:
> 
> 1. Chapter number centered, with decorations on either side.
> 2. Chapter title centered below chapter number.
> 3. Additional decoration centered below chapter title.
> 4. Both number and text show up in TOC in normal Context manner.
> 
> Can this be done easily using the normal chapter macro or should
> I do it all from scratch? (If I roll my own I worry about getting
> info to the TOC.)

I am doing something like that now. Sorry the example isn't very pretty,
had to rip out parts that were specific to the font I'm using, but
should give you an idea of what you need to do.

=====
\unexpanded\def\chaptercase{\uppercase}
\def\mychapter#1#2%
{\setupframed[width=1.75in,align={right,broad},frame=off]\vbox{% 

\framed{\setupbodyfont[18pt]\setupinterlinespace[height=0,depth=0]Chapter}%
 \framed{\setupbodyfont[36pt]\setupinterlinespace[height=.1,depth=0]#1}%
\godown[-1ex]\framed{\setupbodyfont[24pt]\setupinterlinespace[line=2ex]#2\par}%
}}
\setuphead
  [chapter]
  [command=\mychapter,textcommand=\chaptercase,
   textstyle=\sl,numberstyle=\bf]
\starttext
\placelist[chapter,section][criterium=all,alternative=b]
\chapter{foo}
\chapter{bar}
\stoptext
=====


-- 
Stuart Jansen <sjansen@gurulabs.com>
Guru Labs, L.C.

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Setting up chapter.
  2005-07-11 21:34 ` Stuart Jansen
@ 2005-07-12  8:32   ` John R. Culleton
  2005-07-12 13:05     ` Otared Kavian
  2005-07-12 13:15     ` luigi.scarso
  0 siblings, 2 replies; 8+ messages in thread
From: John R. Culleton @ 2005-07-12  8:32 UTC (permalink / raw)


On Monday 11 July 2005 09:34 pm, Stuart Jansen wrote:
> On Mon, 2005-07-11 at 17:12 +0000, John R. Culleton wrote:
> > I am trying to set up chapter heads a certain way and my code
> > keeps getting uglier. Here are the specs:
> >
> > 1. Chapter number centered, with decorations on either side.
> > 2. Chapter title centered below chapter number.
> > 3. Additional decoration centered below chapter title.
> > 4. Both number and text show up in TOC in normal Context manner.
> >
> > Can this be done easily using the normal chapter macro or should
> > I do it all from scratch? (If I roll my own I worry about getting
> > info to the TOC.)
>
> I am doing something like that now. Sorry the example isn't very pretty,
> had to rip out parts that were specific to the font I'm using, but
> should give you an idea of what you need to do.
>
> =====
Your example was very helpful. Using it, and with some more
RTFM, I came up with this configuration:

\setuphead[chapter][numbercommand=\numcommand,page=right,
header=none,textcommand=\texcommand,align=right]

\def\numcommand#1{\hfil\webo m\hfil\tfd#1\hfil\webo m\hfil\break}

\def\texcommand#1{\hfil #1 \hfil\crlf\deco}


My problem remains with the horizontal alignment of the chapter
text. I have tried left, right, normal, broad. All I want to do
is center it, per my specification 2 above. 

Webo is the webomints dingbat font. 
-- 
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

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

* Re: Setting up chapter.
  2005-07-12  8:32   ` John R. Culleton
@ 2005-07-12 13:05     ` Otared Kavian
  2005-07-12 13:15     ` luigi.scarso
  1 sibling, 0 replies; 8+ messages in thread
From: Otared Kavian @ 2005-07-12 13:05 UTC (permalink / raw)



On 12 juil. 2005, at 10:32, John R. Culleton wrote:
> [...]
> My problem remains with the horizontal alignment of the chapter
> text. I have tried left, right, normal, broad. All I want to do
> is center it, per my specification 2 above.

Hi John,

I think if in \setupframed at the beginning of the example (sent by  
Stuart Jansen) instead of

\def\mychapter#1#2%
{\setupframed[width=1.75in,align={right,broad},frame=off]\vbox{%

you say

\def\mychapter#1#2%
{\setupframed[width=\textwidth,align=middle,frame=off]\vbox{%

you get what you want.

Best regards: OK

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

* Re: Setting up chapter.
  2005-07-12  8:32   ` John R. Culleton
  2005-07-12 13:05     ` Otared Kavian
@ 2005-07-12 13:15     ` luigi.scarso
  2005-07-12 16:31       ` John R. Culleton
  1 sibling, 1 reply; 8+ messages in thread
From: luigi.scarso @ 2005-07-12 13:15 UTC (permalink / raw)


John R. Culleton wrote:

>On Monday 11 July 2005 09:34 pm, Stuart Jansen wrote:
>  
>
>>On Mon, 2005-07-11 at 17:12 +0000, John R. Culleton wrote:
>>    
>>
>>>I am trying to set up chapter heads a certain way and my code
>>>keeps getting uglier. Here are the specs:
>>>
>>>1. Chapter number centered, with decorations on either side.
>>>2. Chapter title centered below chapter number.
>>>3. Additional decoration centered below chapter title.
>>>4. Both number and text show up in TOC in normal Context manner.
>>>
>>>Can this be done easily using the normal chapter macro or should
>>>I do it all from scratch? (If I roll my own I worry about getting
>>>info to the TOC.)
>>>      
>>>
>>I am doing something like that now. Sorry the example isn't very pretty,
>>had to rip out parts that were specific to the font I'm using, but
>>should give you an idea of what you need to do.
>>
>>=====
>>    
>>
>Your example was very helpful. Using it, and with some more
>RTFM, I came up with this configuration:
>
>\setuphead[chapter][numbercommand=\numcommand,page=right,
>header=none,textcommand=\texcommand,align=right]
>
>\def\numcommand#1{\hfil\webo m\hfil\tfd#1\hfil\webo m\hfil\break}
>
>\def\texcommand#1{\hfil #1 \hfil\crlf\deco}
>
>
>My problem remains with the horizontal alignment of the chapter
>text. I have tried left, right, normal, broad. All I want to do
>is center it, per my specification 2 above. 
>
>Webo is the webomints dingbat font. 
>  
>
Maybe this can help you ?

\def\Command#1#2{\ruledvbox{\hbox to \textwidth{\hfill #1 \hfill}\\%
\hbox to \textwidth{\hfill #2 \hfill}\\%
\hbox to \textwidth{\hfill deco! \hfill}}}

\def\NCommand#1{\framed{#1}}% Insert here other stuff for decorate number

\def\TCommand#1{\framed{#1}}% Insert here other stuff for decorate text

\setuphead[chapter][command=\Command,numbercommand=\NCommand,textcommand=\TCommand]

Warning: \completecontent has a bizzarre look.


luigi

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

* Re: Setting up chapter.
  2005-07-12 13:15     ` luigi.scarso
@ 2005-07-12 16:31       ` John R. Culleton
  2005-07-13 17:37         ` John R. Culleton
  0 siblings, 1 reply; 8+ messages in thread
From: John R. Culleton @ 2005-07-12 16:31 UTC (permalink / raw)


On Tuesday 12 July 2005 01:15 pm, luigi.scarso wrote:
> John R. Culleton wrote:
> >On Monday 11 July 2005 09:34 pm, Stuart Jansen wrote:
> >>On Mon, 2005-07-11 at 17:12 +0000, John R. Culleton wrote:
> >>>I am trying to set up chapter heads a certain way and my code
> >>>keeps getting uglier. Here are the specs:
> >>>
> >>>1. Chapter number centered, with decorations on either side.
> >>>2. Chapter title centered below chapter number.
> >>>3. Additional decoration centered below chapter title.
> >>>4. Both number and text show up in TOC in normal Context manner.
> >>>
> >>>Can this be done easily using the normal chapter macro or should
> >>>I do it all from scratch? (If I roll my own I worry about getting
> >>>info to the TOC.)
> >>
> >>I am doing something like that now. Sorry the example isn't very pretty,
> >>had to rip out parts that were specific to the font I'm using, but
> >>should give you an idea of what you need to do.
> >>
> >>=====
> >
> >Your example was very helpful. Using it, and with some more
> >RTFM, I came up with this configuration:
> >
> >\setuphead[chapter][numbercommand=\numcommand,page=right,
> >header=none,textcommand=\texcommand,align=right]
> >
> >\def\numcommand#1{\hfil\webo m\hfil\tfd#1\hfil\webo m\hfil\break}
> >
> >\def\texcommand#1{\hfil #1 \hfil\crlf\deco}
> >
> >
> >My problem remains with the horizontal alignment of the chapter
> >text. I have tried left, right, normal, broad. All I want to do
> >is center it, per my specification 2 above.
> >
> >Webo is the webomints dingbat font.
>
> Maybe this can help you ?
>
> \def\Command#1#2{\ruledvbox{\hbox to \textwidth{\hfill #1 \hfill}\\%
> \hbox to \textwidth{\hfill #2 \hfill}\\%
> \hbox to \textwidth{\hfill deco! \hfill}}}
>
> \def\NCommand#1{\framed{#1}}% Insert here other stuff for decorate number
>
> \def\TCommand#1{\framed{#1}}% Insert here other stuff for decorate text
>
> \setuphead[chapter][command=\Command,numbercommand=\NCommand,textcommand=\T
>Command]
>
> Warning: \completecontent has a bizzarre look.
>
>
> luigi
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

Some interesting approaches here, for sure. I am hanging on to
these posts. 

I chickened out and did a plain TeX macro. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\Chap#1 #2.{\page[yes]
\ifodd\count0\else\noheaderandfooterlines\page[yes]\fi
\noheaderandfooterlines
\line{\hfil\webo m\hfil\lower
4.5pt\hbox{\it\tfd#1}\hfil\webo m\hfil}\blank[big]
\line{\tfc\hfil#2\hfil}
\blank[big]
\writetolist[chapter]{\tf #1}{\tf #2}
\deco
}

\def\deco{\blank\noindent\hfil\webo 4\hfil\break\blank \rm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
But when time permits I will play with the other approaches
mentioned. 


-- 
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

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

* Re: Setting up chapter.
  2005-07-12 16:31       ` John R. Culleton
@ 2005-07-13 17:37         ` John R. Culleton
  2005-07-14  5:35           ` luigi.scarso
  0 siblings, 1 reply; 8+ messages in thread
From: John R. Culleton @ 2005-07-13 17:37 UTC (permalink / raw)


On Tuesday 12 July 2005 04:31 pm, John R. Culleton wrote:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> But when time permits I will play with the other approaches
> mentioned.

Necessity overtook schedule. So I used the Jensen approach
(thanks) modified as recommended by Kavian (thanks) with a few
minor changes to suit my application. Herewith the final
product:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\numcommand#1{\hfil\webo m\tfd#1\webo m \hfil}
%\unexpanded\def\chaptercase{\uppercase}

\def\mychapter#1#2%
{\setupframed[width=\textwidth,align=middle,frame=off]\vbox{%
 \framed{\setupbodyfont[18pt]\setupinterlinespace[height=.1,depth=0]
#1}%
\framed{\setupbodyfont[15pt]\setupinterlinespace[line=2ex]#2\par}%
\deco\par}}

\setuphead[chapter][numbercommand=\numcommand,page=right,
header=high,
  command=\mychapter,%textcommand=\chaptercase,
   textstyle=\sl,numberstyle=\bf]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I kept the unused \chaptercase definition around just in case I
change my mind later on. 

This has been educational. Who says you can't teach an old dog
new tricks? 

-- 
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf

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

* Re: Setting up chapter.
  2005-07-13 17:37         ` John R. Culleton
@ 2005-07-14  5:35           ` luigi.scarso
  0 siblings, 0 replies; 8+ messages in thread
From: luigi.scarso @ 2005-07-14  5:35 UTC (permalink / raw)


John R. Culleton wrote:

>  
>
>This has been educational. Who says you can't teach an old dog
>new tricks? 
>
>  
>
Did you seen mag-0001.pdf (Hiding parts of section titles) ?
It has some useful hints.

luigi

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

end of thread, other threads:[~2005-07-14  5:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-11 17:12 Setting up chapter John R. Culleton
2005-07-11 21:34 ` Stuart Jansen
2005-07-12  8:32   ` John R. Culleton
2005-07-12 13:05     ` Otared Kavian
2005-07-12 13:15     ` luigi.scarso
2005-07-12 16:31       ` John R. Culleton
2005-07-13 17:37         ` John R. Culleton
2005-07-14  5:35           ` luigi.scarso

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