ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \setuphead and horizontal rules
@ 2008-10-21 17:00 Andrew Ho
  2008-10-22  7:18 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Ho @ 2008-10-21 17:00 UTC (permalink / raw)
  To: ntg-context

Hi,

Let me prefix this first my saying that I'm new to ConTeXT, so 
apologies if there is an obvious solution to what I'm trying to do or 
I'm approaching it in the wrong way.  I'm trying to style chapter 
headings so that they are right justified, with a line before them *on 
the same line*.  In other words, the page should look like this, where 
vertical bars represent the edges of the text width:

|------------------------------- 1.1 Some chapter --|

Can anyone give me pointers on how to do this?  I've trawled the wiki 
and the internet at large, but an inability to precisely word this 
leaves it difficult to find any previous example of this.

Many thanks,
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: \setuphead and horizontal rules
  2008-10-21 17:00 \setuphead and horizontal rules Andrew Ho
@ 2008-10-22  7:18 ` Wolfgang Schuster
  2008-10-22 22:33   ` Andrew Ho
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2008-10-22  7:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Oct 21, 2008 at 7:00 PM, Andrew Ho <andrewho@andrewho.co.uk> wrote:
> Hi,
>
> Let me prefix this first my saying that I'm new to ConTeXT, so
> apologies if there is an obvious solution to what I'm trying to do or
> I'm approaching it in the wrong way.  I'm trying to style chapter
> headings so that they are right justified, with a line before them *on
> the same line*.  In other words, the page should look like this, where
> vertical bars represent the edges of the text width:
>
> |------------------------------- 1.1 Some chapter --|
>
> Can anyone give me pointers on how to do this?  I've trawled the wiki
> and the internet at large, but an inability to precisely word this
> leaves it difficult to find any previous example of this.
>
> Many thanks,
> Andrew

\define[2]\ChapterCommand
  {\line
     {\leaders\hbox
        {\vrule width 1pt height .5\strutht depth
-\dimexpr.5\strutht-\linewidth\relax}\hfill
      #1\space#2}}

\setuphead[chapter][command=\ChapterCommand]

\starttext

\chapter{Some chapter}

\stoptext


Works only for headers shorter than one line.


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

* Re: \setuphead and horizontal rules
  2008-10-22  7:18 ` Wolfgang Schuster
@ 2008-10-22 22:33   ` Andrew Ho
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Ho @ 2008-10-22 22:33 UTC (permalink / raw)
  To: ntg-context

>> |------------------------------- 1.1 Some chapter --|
>
>\define[2]\ChapterCommand
>[...]

Thank you, this is exactly what I was looking for.

Regards,
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2008-10-22 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-21 17:00 \setuphead and horizontal rules Andrew Ho
2008-10-22  7:18 ` Wolfgang Schuster
2008-10-22 22:33   ` Andrew Ho

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