* Beginner question. Chapter heading in words
@ 2012-11-10 12:38 Andrew Dowell
2012-11-10 13:03 ` Hans Hagen
2012-11-10 13:06 ` Hans Hagen
0 siblings, 2 replies; 9+ messages in thread
From: Andrew Dowell @ 2012-11-10 12:38 UTC (permalink / raw)
To: ntg-context
Hi
I've some experience with Latex (written a thesis in it)
but have just started to try ConteXt as my son wants me to typeset a
story he's written as an A5 book, and ConteXt seems to do that more
easily than Latex.
However, he wants the chapter headings to be on the form:
Chapter One
This is the Name of the First Chapter
ie. with the chapter number in words, centred on the page, and then
the title of the chapter centred below it. (By default it seems to do it
as a numeral and then the title on the the same line)
He'd also like the title of the book as the header for even pages
and the title of the chapter as a header for odd side pages.
I've looked through the manual but can't find obvious instructions
as to how to do this.
Thanks for any suggestions.
Andrew
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 12:38 Beginner question. Chapter heading in words Andrew Dowell
@ 2012-11-10 13:03 ` Hans Hagen
2012-11-10 13:37 ` Marco Patzer
2012-11-10 13:06 ` Hans Hagen
1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2012-11-10 13:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 11/10/2012 1:38 PM, Andrew Dowell wrote:
>
> Chapter One
>
> This is the Name of the First Chapter
\setuppapersize
[A5]
\setupheadertexts
[][chapter]
[\getvariable{document}{title}][]
\setuppagenumbering
[alternative=doublesided,
location=footer]
\unexpanded\def\MyChapterTitle#1#2%
{\framed
[offset=overlay,
frame=off,
width=\textwidth,
align={middle,lohi}]
{#1\blank#2}}
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
numberstyle=\bfb]
\setuplabeltext
[chapter=Chapter~]
\startdocument[title=MyTitle]
\startchapter[title=First]
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=Second]
\dorecurse{10}{\input ward\par}
\stopchapter
\stopdocument
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 12:38 Beginner question. Chapter heading in words Andrew Dowell
2012-11-10 13:03 ` Hans Hagen
@ 2012-11-10 13:06 ` Hans Hagen
1 sibling, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2012-11-10 13:06 UTC (permalink / raw)
To: mailing list for ConTeXt users
Maybe add
\setupbodyfont
[punknova]
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 13:03 ` Hans Hagen
@ 2012-11-10 13:37 ` Marco Patzer
2012-11-10 13:43 ` Marco Patzer
0 siblings, 1 reply; 9+ messages in thread
From: Marco Patzer @ 2012-11-10 13:37 UTC (permalink / raw)
To: ntg-context
2012-11-10 Hans Hagen:
> On 11/10/2012 1:38 PM, Andrew Dowell wrote:
> >
> > Chapter One
> >
> > This is the Name of the First Chapter
>
I assume the OP was looking for a way to convert a counter to the
corresponding English word:
\defineconversion
[words]
[One, Two, Three, Four, Five]
\definecounter [mycount]
\setupcounter [mycount] [numberconversion=words]
\starttext
\dorecurse{5}{%%
\incrementcounter [mycount]
\convertedcounter [mycount]}
\stoptext
Maybe there is a conversion built-in that does this automatically
without having to define the words yourself.
Marco
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 13:37 ` Marco Patzer
@ 2012-11-10 13:43 ` Marco Patzer
2012-11-11 12:24 ` Andrew Dowell
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Marco Patzer @ 2012-11-10 13:43 UTC (permalink / raw)
To: ntg-context
2012-11-10 Marco Patzer:
> 2012-11-10 Hans Hagen:
>
> > On 11/10/2012 1:38 PM, Andrew Dowell wrote:
> > >
> > > Chapter One
> > >
> > > This is the Name of the First Chapter
> >
>
> I assume the OP was looking for a way to convert a counter to the
> corresponding English word:
>
> \defineconversion
> [words]
> [One, Two, Three, Four, Five]
I forgot to add how to hook this into Hans' example:
\defineconversion
[words]
[One, Two, Three, Four, Five]
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
conversion=words,
numberstyle=\bfb]
Marco
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 13:43 ` Marco Patzer
@ 2012-11-11 12:24 ` Andrew Dowell
2012-11-11 12:58 ` Andrew Dowell
2012-11-11 13:22 ` Hans Hagen
2 siblings, 0 replies; 9+ messages in thread
From: Andrew Dowell @ 2012-11-11 12:24 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 3312 bytes --]
On 10/11/12 13:43, Marco Patzer wrote:
> 2012-11-10 Marco Patzer:
>
>> 2012-11-10 Hans Hagen:
>>
>>> On 11/10/2012 1:38 PM, Andrew Dowell wrote:
>>>> Chapter One
>>>>
>>>> This is the Name of the First Chapter
>> I assume the OP was looking for a way to convert a counter to the
>> corresponding English word:
>>
>> \defineconversion
>> [words]
>> [One, Two, Three, Four, Five]
> I forgot to add how to hook this into Hans' example:
>
> \defineconversion
> [words]
> [One, Two, Three, Four, Five]
>
> \setuphead
> [chapter]
> [header=high,
> command=\MyChapterTitle,
> style=\bfc,
> conversion=words,
> numberstyle=\bfb]
Thanks for your quick and helpful replies Marco and Hans.
I've not quite managed to get it working yet.
I also forgot to mention that I wanted it A5 2up on A4. I thought I'd
got that sorted using
\setuppapersize [A5][A4]
\setuparranging [2UP,rotated,doublesided]
\setuppagenumbering [alternative=doublesided]
\setuplayout [margin=0pt,width=fit]
\setupbodyfont [lbr,12pt]
from the manual (page 55), but on closer inspection of the output seems
to scramble the chapters. My test setup has four chapters. The output
labels the first chapter 'Chapter 1', the second chapter 'Chapter 4',
the third chapter 'Chapter 2' and the forth chapter 'Chapter 3'.
Yes I did want the chapters to be numbered as words but I can't get
Marco's modification to work. It would be useful if there was a build
in conversion without having to write out the words as Jamie's book has
21 chapters!
I've tried various permutations including
\incrementcounter [mycount]
\convertedcounter [mycount]
in each chapter but none of the ones I tried work.
(I also tried including the dorecurse, but presume that was for testing)
I'm not sure if Han's example was supposed to be a stand alone or some
sort of style file. I tried running ConteXt on it but it stopped half
way through. I was using the the set up suggested in the manual of
having a project file, and environment file, a product file and
components. That may be unnecessary complication but I thought I'd just
follow the instructions till I understand it better.
I put your formatting suggestions into my environment file (attached).
Thanks for the suggestion of punknova Hans, it might come in sometime
but Jamie wants it to look as much like a proper book as possible.
He's also telling me he wants the pages arranged as
sheet one
side one
page4 p1
side two
p2 p3
sheet two
side one
p8 p5
side two
p6 p7
etc
so that the folded A4's bind next to each other, rather than in each
other as the format I'm using at the moment gives.
I've also attached my product, project and test component files
Thanks again
Andrew
>
> Marco
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
[-- Attachment #2: envbookk.tex --]
[-- Type: text/x-tex, Size: 939 bytes --]
\startenvironment env2bookk
\setuppapersize [A5][A4]
\setuparranging [2UP,rotated,doublesided]
\setuppagenumbering [alternative=doublesided]
\setuplayout [margin=0pt,width=fit]
\setupbodyfont [lbr,12pt]
\setupheadertexts
[][chapter]
[\getvariable{document}{title}][]
\setuppagenumbering
[alternative=doublesided,
location=footer]
\unexpanded\def\MyChapterTitle#1#2%
{\framed
[offset=overlay,
frame=off,
width=\textwidth,
align={middle,lohi}]
{#1\blank#2}}
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
numberstyle=\bfb]
\setuplabeltext
[chapter=Chapter~]
\defineconversion
[words]
[One, Two, Three, Four, Five]
\definecounter [mycount]
\setupcounter [mycount] [numberconversion=words]
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
conversion=words,
numberstyle=\bfb]
\stopenvironment
[-- Attachment #3: prds2.tex --]
[-- Type: text/x-tex, Size: 121 bytes --]
\startproduct prds2
\project projbook
%\component pt1
\component test4
%\component c_article_by_me
% ...
\stopproduct
[-- Attachment #4: projbook.tex --]
[-- Type: text/x-tex, Size: 225 bytes --]
\startproject projbook
%\environment envbook % only mentioned here!
\environment envbookkk
\product prds2
%\product prd_year2004-02
%\product prd_year2004-03
%\product prd_year2004-04
%\product tableofcontent
\stopproject
[-- Attachment #5: test4.tex --]
[-- Type: text/x-tex, Size: 575 bytes --]
\startcomponent pt1
\product prds2 % but you can use it in other products anyway
\project projbook
%\title{Editorial}
%Jamie and Dad and the Teddy Train.
% Chapter One
\startchapter[title=First]
one
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=Second]
two
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=third]
three
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=fourth]
four
\dorecurse{10}{\input ward\par}
\stopchapter
\stopcomponent pt1
[-- Attachment #6: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 13:43 ` Marco Patzer
2012-11-11 12:24 ` Andrew Dowell
@ 2012-11-11 12:58 ` Andrew Dowell
2012-11-11 13:22 ` Hans Hagen
2 siblings, 0 replies; 9+ messages in thread
From: Andrew Dowell @ 2012-11-11 12:58 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 10/11/12 13:43, Marco Patzer wrote:
> 2012-11-10 Marco Patzer:
>
>> 2012-11-10 Hans Hagen:
>>
>>> On 11/10/2012 1:38 PM, Andrew Dowell wrote:
>>>> Chapter One
>>>>
>>>> This is the Name of the First Chapter
>> I assume the OP was looking for a way to convert a counter to the
>> corresponding English word:
>>
>> \defineconversion
>> [words]
>> [One, Two, Three, Four, Five]
> I forgot to add how to hook this into Hans' example:
>
> \defineconversion
> [words]
> [One, Two, Three, Four, Five]
>
> \setuphead
> [chapter]
> [header=high,
> command=\MyChapterTitle,
> style=\bfc,
> conversion=words,
> numberstyle=\bfb]
Thanks for your quick and helpful replies Marco and Hans.
I've not quite managed to get it working yet.
I also forgot to mention that I wanted it A5 2up on A4. I thought I'd
got that sorted using
\setuppapersize [A5][A4]
\setuparranging [2UP,rotated,doublesided]
\setuppagenumbering [alternative=doublesided]
\setuplayout [margin=0pt,width=fit]
\setupbodyfont [lbr,12pt]
from the manual (page 55), but on closer inspection of the output seems
to scramble the chapters. My test setup has four chapters. The output
labels the first chapter 'Chapter 1', the second chapter 'Chapter 4',
the third chapter 'Chapter 2' and the forth chapter 'Chapter 3'.
Yes I did want the chapters to be numbered as words but I can't get
Marco's modification to work. It would be useful if there was a build
in conversion without having to write out the words as Jamie's book has
21 chapters!
I've tried various permutations including
\incrementcounter [mycount]
\convertedcounter [mycount]
in each chapter but none of the ones I tried work.
(I also tried including the dorecurse, but presume that was for testing)
I'm not sure if Han's example was supposed to be a stand alone or some
sort of style file. I tried running ConteXt on it but it stopped half
way through. I was using the the set up suggested in the manual of
having a project file, and environment file, a product file and
components. That may be unnecessary complication but I thought I'd just
follow the instructions till I understand it better.
I put your formatting suggestions into my environment file (pasted below).
Thanks for the suggestion of punknova Hans, it might come in sometime
but Jamie wants it to look as much like a proper book as possible.
He's also telling me he wants the pages arranged as
sheet one
side one
page4 p1
side two
p2 p3
sheet two
side one
p8 p5
side two
p6 p7
etc
so that the folded A4's bind next to each other, rather than in each
other as the format I'm using at the moment gives.
I've pasted my environment and test component files below (I tried
attaching them but then realised the attachments Hans sent me were off list)
Thanks again
Andrew
Here's my environment file
\startenvironment env2bookk
\setuppapersize [A5][A4]
\setuparranging [2UP,rotated,doublesided]
\setuppagenumbering [alternative=doublesided]
\setuplayout [margin=0pt,width=fit]
\setupbodyfont [lbr,12pt]
\setupheadertexts
[][chapter]
[\getvariable{document}{title}][]
\setuppagenumbering
[alternative=doublesided,
location=footer]
\unexpanded\def\MyChapterTitle#1#2%
{\framed
[offset=overlay,
frame=off,
width=\textwidth,
align={middle,lohi}]
{#1\blank#2}}
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
numberstyle=\bfb]
\setuplabeltext
[chapter=Chapter~]
\defineconversion
[words]
[One, Two, Three, Four, Five]
\definecounter [mycount]
\setupcounter [mycount] [numberconversion=words]
\setuphead
[chapter]
[header=high,
command=\MyChapterTitle,
style=\bfc,
conversion=words,
numberstyle=\bfb]
\stopenvironment
And my test component file:
\startcomponent pt1
\product prds2 % but you can use it in other products anyway
\project projbook
\startchapter[title=First]
one
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=Second]
two
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=third]
three
\dorecurse{10}{\input ward\par}
\stopchapter
\startchapter[title=fourth]
four
\dorecurse{10}{\input ward\par}
\stopchapter
\stopcomponent pt1
>
> Marco
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-10 13:43 ` Marco Patzer
2012-11-11 12:24 ` Andrew Dowell
2012-11-11 12:58 ` Andrew Dowell
@ 2012-11-11 13:22 ` Hans Hagen
2012-11-12 13:27 ` Sietse Brouwer
2 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2012-11-11 13:22 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 11/10/2012 2:43 PM, Marco Patzer wrote:
> 2012-11-10 Marco Patzer:
>
>> 2012-11-10 Hans Hagen:
>>
>>> On 11/10/2012 1:38 PM, Andrew Dowell wrote:
>>>>
>>>> Chapter One
>>>>
>>>> This is the Name of the First Chapter
>>>
>>
>> I assume the OP was looking for a way to convert a counter to the
>> corresponding English word:
>>
>> \defineconversion
>> [words]
>> [One, Two, Three, Four, Five]
>
> I forgot to add how to hook this into Hans' example:
>
> \defineconversion
> [words]
> [One, Two, Three, Four, Five]
>
> \setuphead
> [chapter]
> [header=high,
> command=\MyChapterTitle,
> style=\bfc,
> conversion=words,
> numberstyle=\bfb]
I've added
conversion=Words (and words)
(currently english only)
(probably needs testing)
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question. Chapter heading in words
2012-11-11 13:22 ` Hans Hagen
@ 2012-11-12 13:27 ` Sietse Brouwer
0 siblings, 0 replies; 9+ messages in thread
From: Sietse Brouwer @ 2012-11-12 13:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
* looking for a place on the wiki were conversions are documented, I
found http://wiki.contextgarden.net/Command/convertnumber. Seems fine.
(Conversion and Conversions redirects there now.)
* words and Words are now documented on that page, too.
Hans: while I was there, I found a bug in the month conversion.
In core-con.mkiv, the `month` conversion calls `\monthlong`, which
calls the Lua command.month. But that prints the number of the current
month; \monthlong should call command.monthname, instead.
% core-con.mkiv, line 204
-\def\monthlong #1{\ctxcommand{month(#1)}}
+\def\monthlong #1{\ctxcommand{monthname(#1)}}
\def\monthshort#1{\ctxcommand{monthmnem(#1)}}
Cheers,
Sietse
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-12 13:27 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-10 12:38 Beginner question. Chapter heading in words Andrew Dowell
2012-11-10 13:03 ` Hans Hagen
2012-11-10 13:37 ` Marco Patzer
2012-11-10 13:43 ` Marco Patzer
2012-11-11 12:24 ` Andrew Dowell
2012-11-11 12:58 ` Andrew Dowell
2012-11-11 13:22 ` Hans Hagen
2012-11-12 13:27 ` Sietse Brouwer
2012-11-10 13:06 ` Hans Hagen
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).