ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Customizing chapter heads
@ 2009-01-24 23:49 Alfredo Catalina
  2009-01-25  9:43 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Alfredo Catalina @ 2009-01-24 23:49 UTC (permalink / raw)
  To: ntg-context


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

I am new to ConTeXt. I am trying to define a customized head for chapters
but I am finding some problems. The sentences below are based on the chapter
Text Elements which may be found in the ConTeXt manual.

Prior to setting up the title, a new Head command is defined
by \def\HeadTitle#1#2%. It takes two arguments, the chapter number and the
chapter title. The Head so defined will show the word "C h a p t e r" in
capitals, then the chapter number at 80pt, then a horizontal line, and
finally the title.

The definition works quite well except that both, the chapter number and the
chapter title, are not show at the specified font size.

\definebodyfont[10pt,11pt,12pt][rm][tff=Regular at 80pt]
\definebodyfont[10pt,11pt,12pt][rm][tfe=Regular at 42pt]

\def\HeadTitle#1#2%
    {\hbox to \hsize \bgroup
        {\hfill %
        \setupframed[height=7cm,offset=.5em,frame=off]
         \framed[width=9cm,align=left]
            {
                {\tfc \sc {C~h~a~p~t~e~r}} ~~ {\tff #1}\\
                \hairline
                {\ss \tfe #2}
            }
        }
        \egroup
    }
\starttext
\setuphead[chapter] [command=\HeadTitle]
\chapter{An Insight\\Into Fred's Design}
\stoptext

An easy workaround for the chapter number replaces the argument #1 by
\currentheadnumber

\def\HeadTitle#1#2%
    {\hbox to \hsize \bgroup
        {\hfill %
        \setupframed[height=7cm,offset=.5em,frame=off]
         \framed[width=9cm,align=left]
            {
                {\tfc \sc {C~h~a~p~t~e~r}} ~~ {\tff #1}\\
                \hairline
                {\ss \tfe #2}
            }
        }
        \egroup
    }

Now the chapter number is shown at 80pt as defined. But I have not found the
way to solve the problem with the head title, #2. ¿Any ideas?

Thanks in advance.
Alfredo.

[-- Attachment #1.2: Type: text/html, Size: 3278 bytes --]

[-- Attachment #2: Type: text/plain, Size: 487 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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Customizing chapter heads
  2009-01-24 23:49 Customizing chapter heads Alfredo Catalina
@ 2009-01-25  9:43 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2009-01-25  9:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 25.01.2009 um 00:49 schrieb Alfredo Catalina:

> I am new to ConTeXt. I am trying to define a customized head for  
> chapters but I am finding some problems. The sentences below are  
> based on the chapter Text Elements which may be found in the ConTeXt  
> manual.
>
> Prior to setting up the title, a new Head command is defined by \def 
> \HeadTitle#1#2%. It takes two arguments, the chapter number and the  
> chapter title. The Head so defined will show the word "C h a p t e  
> r" in capitals, then the chapter number at 80pt, then a horizontal  
> line, and finally the title.
>
> The definition works quite well except that both, the chapter number  
> and the chapter title, are not show at the specified font size.
>
> \definebodyfont[10pt,11pt,12pt][rm][tff=Regular at 80pt]
> \definebodyfont[10pt,11pt,12pt][rm][tfe=Regular at 42pt]

\definebodyfont[10pt,11pt,12pt][ss][tfe=Sans    at 42pt]

> \def\HeadTitle#1#2%
>     {\hbox to \hsize \bgroup
>         {\hfill %
>         \setupframed[height=7cm,offset=.5em,frame=off]
>          \framed[width=9cm,align=left]
>             {
>                 {\tfc \sc {C~h~a~p~t~e~r}} ~~ {\tff #1}\\
>                 \hairline
>                 {\ss \tfe #2}
>
                 {\tfc \sc {C~h~a~p~t~e~r}} ~~ {#1}\\
                 \hairline
                 {#2}
>             }
>         }
>         \egroup
>     }
>
> \starttext
> \setuphead[chapter] [command=\HeadTitle]

\setuphead[chapter] [command=\HeadTitle,numberstyle=\tff,textstyle=\ss 
\tfe]

> \chapter{An Insight\\Into Fred's Design}
> \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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-01-25  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-24 23:49 Customizing chapter heads Alfredo Catalina
2009-01-25  9:43 ` 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).