ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Taco Hoekwater <taco@elvenkind.com>
Subject: Re: help at layout
Date: Tue, 13 Sep 2005 11:22:21 +0200	[thread overview]
Message-ID: <43269A4D.9070903@elvenkind.com> (raw)
In-Reply-To: <BAY24-F81D45A3F19B061BD52D08CE9D0@phx.gbl>



Boris Pedrofiets wrote:
> Hello,
> I want to make a layout where a vertical line is putted at the rigth of 
> the left margin. Capters and paragraphs must indent in the left margin, 
> and be boxed.
> Someting like:

The important trick is to define a special command that does the
typesetting  of the chapter number + text, I hope you're not too
scared of low-level TeX, because in the actual example below I've
added  some low-level stuff to fiddle with the outdent.

This is the basic setup for the chapter command:


   \setupcolors[state=start]

   \def\Boxedchapter#1#2%
     {\framed[background=color,
              backgroundcolor=white]{#1.~#2}}

   \setuphead[chapter][command=\Boxedchapter]


The color commands are needed so that the background of the
chapter head overwrites the line in the margin. That line
is a single command, btw:

   \setupbackgrounds[text][leftmargin][state=start,rightframe=on]


Also, I've added a \blank in the example below so that a bit
of the line sticks out above the framed text, that looks
better, I think.


You can look up other options for \setupbackgrounds, \framed and
\setuphead in http://texshow.contextgarden.net, or use your local 
'texshow' command.


Greetings, Taco


% start
\setupcolors[state=start]

\setupbackgrounds[text][leftmargin][state=start,rightframe=on]

\newdimen\outdentchapter

\outdentchapter=1cm % change this for more or less outdent

\def\Boxedchapter#1#2%
    {\advance\hsize\outdentchapter
     \vbox
       {\moveleft\outdentchapter
        \vbox
           {\blank[2*line]
            \framed[background=color,
                    backgroundcolor=white]{#1.~#2}}}}

\setuphead[chapter][command=\Boxedchapter]

\starttext

\chapter{The first chapter}

\input knuth

\stoptext
% end

  reply	other threads:[~2005-09-13  9:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-12 21:48 Boris Pedrofiets
2005-09-13  9:22 ` Taco Hoekwater [this message]
2005-09-13 13:42 Boris Pedrofiets
2005-09-13 14:37 ` Taco Hoekwater

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=43269A4D.9070903@elvenkind.com \
    --to=taco@elvenkind.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).