ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Chapter headings macro
@ 2013-02-08  6:31 Devendra Ghate
  2013-02-08 13:13 ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Devendra Ghate @ 2013-02-08  6:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]

Hello everyone,

I have defined a macro for the chapter layouts -- nothing fancy, but 
still it is giving me trouble.
Essentially, I call this macro using *command=* in *\setuphead*. My 
philosophy was to add
all the details in the macro, so that I don't have to call anyother 
keyvalue pairs in *\setuphead*.
However, the macro gives two different results when called for 
typesetting a chapter heading
by ConTeXt internals and explicitly by me in the document (see attached 
file).

I don't know why the chapter number font style is not obeyed. If I add 
*numberstyle=dfont* in
*\setuphead*, then the font size is increased but the frame size has 
spurious space at top and
bottom.

When I call the macro myself, there is a single whitespace before the 
chapter heading (as can be
seen in the attached file).

I have gone through the wiki as much as possible and I think that I 
could have easily copied
*much better* heading styles from it. But I do not want to use code that 
I don't fully
understand.

Any suggestions/help will be most appreciated.

Regards,
Devendra


*MWE*

\definefont
  [dfont]
   [Serif at 60pt]

\definecolor[lightgrey][h=d8dcd6]

\define[2]\dmaketitle{%
   \starttable[|r|r|]
   \NC
     \framed
      [frame=on,
       rulethickness=3pt,
       framecolor=lightgrey,
       foreground=color,
       foregroundcolor=lightgrey,
       corner=00,
       align=right]
      {\hspace[big]{\dfont#1}}
   \NC
     \framed
      [width=.1\textwidth,
       strut=no,
       frame=on,
       align={flushleft,nothyphenated,verytolerant}]
      {{\kap\kerncharacters[.5]\tfc#2}}
   \NR
   \stoptable
}

\setuphead
   [chapter]
   [command=\dmaketitle]
    %numberstyle=\dfont

\starttext
  \chapter{Introduction to thesis}
  \dmaketitle{1}{Introduction to thesis}
\stoptext



[-- Attachment #2: Screenshot from 2013-02-08 11:53:14.png --]
[-- Type: image/png, Size: 17576 bytes --]

[-- Attachment #3: 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] 4+ messages in thread

* Re: Chapter headings macro
  2013-02-08  6:31 Chapter headings macro Devendra Ghate
@ 2013-02-08 13:13 ` Wolfgang Schuster
  2013-02-09  6:30   ` Devendra Ghate
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2013-02-08 13:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 08.02.2013 um 07:31 schrieb Devendra Ghate <devendra.ghate@gmail.com>:

> Hello everyone,
> 
> I have defined a macro for the chapter layouts -- nothing fancy, but still it is giving me trouble.
> Essentially, I call this macro using *command=* in *\setuphead*. My philosophy was to add
> all the details in the macro, so that I don't have to call anyother keyvalue pairs in *\setuphead*.
> However, the macro gives two different results when called for typesetting a chapter heading
> by ConTeXt internals and explicitly by me in the document (see attached file).
> 
> I don't know why the chapter number font style is not obeyed. If I add *numberstyle=dfont* in
> *\setuphead*, then the font size is increased but the frame size has spurious space at top and
> bottom.
> 
> When I call the macro myself, there is a single whitespace before the chapter heading (as can be
> seen in the attached file).
> 
> I have gone through the wiki as much as possible and I think that I could have easily copied
> *much better* heading styles from it. But I do not want to use code that I don't fully
> understand.
> 
> Any suggestions/help will be most appreciated.

\definefont [ChaperNumberStyle][Serif at 60pt]
\definecolor[ChaperNumberColor][x=d8dcd6]

\startsetups[head:devendra]

  \startlinealignment[left]

    \startframed
      [frame=on,
       rulethickness=3pt,
       framecolor=ChaperNumberColor,
       foregroundcolor=ChaperNumberColor,
       corner=00]
      \hspace[big]\headnumbercontent
    \stopframed

    \hspace[big]

    \startframed
      [width=.1\textwidth,
       strut=no,
       frame=on,
       align={flushleft,nothyphenated,verytolerant}]
      \headtextcontent
    \stopframed

  \stoplinealignment

\stopsetups


\defineheadalternative[devendra][renderingsetup=head:devendra]

\setuphead
  [chapter]
  [alternative=devendra,
   numberstyle=ChaperNumberStyle,
   textstyle={\tfc\kap\kerncharacters[.5]}]

\starttext
\chapter{Introduction to thesis}
\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] 4+ messages in thread

* Re: Chapter headings macro
  2013-02-08 13:13 ` Wolfgang Schuster
@ 2013-02-09  6:30   ` Devendra Ghate
  2013-02-09 13:16     ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: Devendra Ghate @ 2013-02-09  6:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On 02/08/2013 06:43 PM, Wolfgang Schuster wrote:
> Am 08.02.2013 um 07:31 schrieb Devendra Ghate <devendra.ghate@gmail.com>:
>
>> Hello everyone,
>>
>> I have defined a macro for the chapter layouts -- nothing fancy, but still it is giving me trouble.
>> Essentially, I call this macro using *command=* in *\setuphead*. My philosophy was to add
>> all the details in the macro, so that I don't have to call anyother keyvalue pairs in *\setuphead*.
>> However, the macro gives two different results when called for typesetting a chapter heading
>> by ConTeXt internals and explicitly by me in the document (see attached file).
>>
>> I don't know why the chapter number font style is not obeyed. If I add *numberstyle=dfont* in
>> *\setuphead*, then the font size is increased but the frame size has spurious space at top and
>> bottom.
>>
>> When I call the macro myself, there is a single whitespace before the chapter heading (as can be
>> seen in the attached file).
>>
>> I have gone through the wiki as much as possible and I think that I could have easily copied
>> *much better* heading styles from it. But I do not want to use code that I don't fully
>> understand.
>>
>> Any suggestions/help will be most appreciated.
> \definefont [ChaperNumberStyle][Serif at 60pt]
> \definecolor[ChaperNumberColor][x=d8dcd6]
>
> \startsetups[head:devendra]
>
>    \startlinealignment[left]
>
>      \startframed
>        [frame=on,
>         rulethickness=3pt,
>         framecolor=ChaperNumberColor,
>         foregroundcolor=ChaperNumberColor,
>         corner=00]
>        \hspace[big]\headnumbercontent
>      \stopframed
>
>      \hspace[big]
>
>      \startframed
>        [width=.1\textwidth,
>         strut=no,
>         frame=on,
>         align={flushleft,nothyphenated,verytolerant}]
>        \headtextcontent
>      \stopframed
>
>    \stoplinealignment
>
> \stopsetups
>
>
> \defineheadalternative[devendra][renderingsetup=head:devendra]
>
> \setuphead
>    [chapter]
>    [alternative=devendra,
>     numberstyle=ChaperNumberStyle,
>     textstyle={\tfc\kap\kerncharacters[.5]}]
>
> \starttext
> \chapter{Introduction to thesis}
> \stoptext
>
> Wolfgang
> _____

Thank you Wolfgang. I guess this is the proper ConTeXt way.

Presumably I will have to define a plain set up for unnumbered chapters 
like bibliographies
and call *\setuphead[chapter][alternative=plain]* for these chapters.

Devendra






> ______________________________________________________________________________
> 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] 4+ messages in thread

* Re: Chapter headings macro
  2013-02-09  6:30   ` Devendra Ghate
@ 2013-02-09 13:16     ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2013-02-09 13:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 09.02.2013 um 07:30 schrieb Devendra Ghate <devendra.ghate@gmail.com>:

> Thank you Wolfgang. I guess this is the proper ConTeXt way.
> 
> Presumably I will have to define a plain set up for unnumbered chapters like bibliographies
> and call *\setuphead[chapter][alternative=plain]* for these chapters.

Unnumbered chapters use the *title* heading.

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] 4+ messages in thread

end of thread, other threads:[~2013-02-09 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-08  6:31 Chapter headings macro Devendra Ghate
2013-02-08 13:13 ` Wolfgang Schuster
2013-02-09  6:30   ` Devendra Ghate
2013-02-09 13:16     ` 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).