ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Centered multiline chapter title
@ 2012-12-17 20:29 hanak
  2012-12-18 10:30 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: hanak @ 2012-12-17 20:29 UTC (permalink / raw)
  To: ntg-context

Hello,

I need to format my chapters in the following way:

   - The chapters are centered (midaligned).

   - Some chapters are long, so they have to be multilined.

   - The chapter title should be in capital letters, but in the header should it be without capitalisation.

   - When the chapter title is multilined, only the first line should appear in the header, followed by "...",
     the same in TOC

   - When the chapter title is multilined, I want to choose the point of line break with "\\"
   

So something like this:

  \chapter{FIRST CHAPTER TITLE}  (in the header and TOC will be "First chapter title")

  \chapter{SECOND CHAPTER TITLE \\ WHICH IS VERY VERY VERY LONG} (in the header and TOC will be "Second chapter title...")


I tried the following setup for the chapter:  

\setuphead
  [chapter]
  [after={\blank[2*line,fixed]},
   header=empty,
   textcommand=\midaligned,
   style={\chapterfont\WORD},
   sectionset=none,
   indentnext=no
  ]


But when I try to process the file, I will get the following error:

    structure       > sectioning > chapter @ level 2 : 0.1 -> Second chapter title \\ which is very very very looong
    ! Missing } inserted.
     
    system          > tex > error on line 1 in file test.tex: Missing  ...
     
     1 >>  \environment test_environment
     2     
     3     \startcomponent test19
     4     
     5     \product test
     6     
     7     
     8     \chapter{Second chapter title \\ which is very very very looong}
     9
     
    <inserted text> 
                    }
    <to be read again> 
                       \endgroup 
    \\->\endgroup 
                  \par \doalignline {\hss }{\hss }\begingroup 
    l.1 Second chapter title \\
                                which is very very very looong
    \ctxcommand ...\directlua \zerocount {commands.#1}
                                                      
    \getheadtitle ...lecommand \relax \structuretitle 
                                                      \else \normalexpanded {\no...
    ...
    l.10 ...r title \\ which is very very very looong}


If I don't try to enforce line break in the title with "\\", the file is processed without problem,
but also without making anyline break at all -- the whole long chapter title is one very long line.

If I don't use "textcommand=\midaligned", I am able to make multiline chapter with my own line break,
but the title is left-aligned...

Could anybody tell me, how to make properly the chapter setup according to above described rules?

Thank you in advance.

Pavel
___________________________________________________________________________________
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] 2+ messages in thread

* Re: Centered multiline chapter title
  2012-12-17 20:29 Centered multiline chapter title hanak
@ 2012-12-18 10:30 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2012-12-18 10:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.12.2012 um 21:29 schrieb hanak@wpb.cz:

> Hello,
> 
> I need to format my chapters in the following way:
> 
>   - The chapters are centered (midaligned).
> 
>   - Some chapters are long, so they have to be multilined.
> 
>   - The chapter title should be in capital letters, but in the header should it be without capitalisation.
> 
>   - When the chapter title is multilined, only the first line should appear in the header, followed by "...",
>     the same in TOC
> 
>   - When the chapter title is multilined, I want to choose the point of line break with "\\"
> 
> 
> So something like this:
> 
>  \chapter{FIRST CHAPTER TITLE}  (in the header and TOC will be "First chapter title")
> 
>  \chapter{SECOND CHAPTER TITLE \\ WHICH IS VERY VERY VERY LONG} (in the header and TOC will be "Second chapter title...")
> 
> 
> I tried the following setup for the chapter:  
> 
> \setuphead
>  [chapter]
>  [after={\blank[2*line,fixed]},
>   header=empty,
>   textcommand=\midaligned,
>   style={\chapterfont\WORD},
>   sectionset=none,
>   indentnext=no
>  ]
> 
> 
> But when I try to process the file, I will get the following error:
> 
>    structure       > sectioning > chapter @ level 2 : 0.1 -> Second chapter title \\ which is very very very looong
>    ! Missing } inserted.
> 
>    system          > tex > error on line 1 in file test.tex: Missing  ...
> 
>     1 >>  \environment test_environment
>     2     
>     3     \startcomponent test19
>     4     
>     5     \product test
>     6     
>     7     
>     8     \chapter{Second chapter title \\ which is very very very looong}
>     9
> 
>    <inserted text> 
>                    }
>    <to be read again> 
>                       \endgroup 
>    \\->\endgroup 
>                  \par \doalignline {\hss }{\hss }\begingroup 
>    l.1 Second chapter title \\
>                                which is very very very looong
>    \ctxcommand ...\directlua \zerocount {commands.#1}
> 
>    \getheadtitle ...lecommand \relax \structuretitle 
>                                                      \else \normalexpanded {\no...
>    ...
>    l.10 ...r title \\ which is very very very looong}
> 
> 
> If I don't try to enforce line break in the title with "\\", the file is processed without problem,
> but also without making anyline break at all -- the whole long chapter title is one very long line.
> 
> If I don't use "textcommand=\midaligned", I am able to make multiline chapter with my own line break,
> but the title is left-aligned...
> 
> Could anybody tell me, how to make properly the chapter setup according to above described rules?


You can use the “list” and “marking” keys to set separate entries for the header and TOC.

\setuphead
  [chapter]
  [after={\blank[fixed,2*line]},
   header=empty,
   align=middle,
   style={\setcharactercasing[WORD]}]

\setupheadertexts[chapter]

\starttext

\completecontent

\startchapter[title={First chapter title}]
\dorecurse{10}{\input knuth\par}
\stopchapter

\startchapter[title={Second chapter title\\which is very long},list={Second chapter title …},marking={Second chapter title …}]
\dorecurse{10}{\input zapf\par}
\stopchapter

\stoptext

Wolfgang
___________________________________________________________________________________
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] 2+ messages in thread

end of thread, other threads:[~2012-12-18 10:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 20:29 Centered multiline chapter title hanak
2012-12-18 10:30 ` Wolfgang Schuster

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