ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Wolfgang Schuster" <schuster.wolfgang@googlemail.com>
To: "mailing list for ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: \setuphead and horizontal rules
Date: Wed, 22 Oct 2008 09:18:43 +0200	[thread overview]
Message-ID: <115224fb0810220018l2588296eif8f1756fa9e957d8@mail.gmail.com> (raw)
In-Reply-To: <20081021170018.GE24289@sebastian>

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
___________________________________________________________________________________


  reply	other threads:[~2008-10-22  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 17:00 Andrew Ho
2008-10-22  7:18 ` Wolfgang Schuster [this message]
2008-10-22 22:33   ` Andrew Ho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=115224fb0810220018l2588296eif8f1756fa9e957d8@mail.gmail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).