ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andreas Harder <aharder@uni-koblenz.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Metafun manual section titles
Date: Mon, 14 Nov 2011 01:19:41 +0100	[thread overview]
Message-ID: <E583F353-63CB-4CA2-BB2A-3BA397065A66@uni-koblenz.de> (raw)
In-Reply-To: <201111132324.23732.romain.diss@yahoo.fr>


On 13.11.2011, at 23:24, Romain Diss wrote:

> Hello,
> 
> I'm trying to make some section titles which look like the ones of the metafun 
> manual: title and number underlined, with number in margin. I thougth it would 
> not be too hard but I can't do it.
> 
> Actually, I'm using a frame with an overlay with a \startuniqueMPgraphic to 
> underline the title but I can't make a frame for both the section number which 
> is in the margin and the text which is not.
> 
> I tried to make the underlining of the title text extend in the margin but 
> it's not easy because the frame background seems to be centered automatically 
> on the frame. Maybe I should adjust some offsets but how can I know the size of 
> the section number...
> 
> Anybody can help me on that problem ?

Hi,

you can try something like this:

\setuplayout[width=middle,backspace=4cm]

\startuseMPgraphic{line}
  drawoptions(withcolor \MPcolor{\framedparameter{framecolor}}) ;
  draw bottomboundary OverlayBox withpen pencircle scaled 3pt ; 
  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[head:line][\useMPgraphic{line}]

\defineframedtext
  [framedHead]
  [align=right,width=fit,
   offset=overlay,boffset=.25ex,
   frame=off,framecolor=yellow:4,
   background=head:line]

\defineheadplacement
  [MyPlacement] [vertical]
  {\setwidthof{#1\hskip\leftmargindistance}\to\MyWidth\hskip-\MyWidth
   \startframedHead
     #1\hskip\leftmargindistance #2
   \stopframedHead}

\setuphead [chapter,section] [alternative=MyPlacement]

\starttext  \showframe
  \dorecurse{3}{
    \chapter{Chapter #1}
    \dorecurse{3}{\section{Section ##1}
      \dorecurse{3}{\subsection{Subsection}}
    }
  }
\stoptext

But I’m sure there are better solutions …

Best wishes
	Andreas
___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2011-11-14  0:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-13 22:24 Romain Diss
2011-11-14  0:19 ` Andreas Harder [this message]
2011-11-14 14:14   ` [solved] " Romain Diss

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=E583F353-63CB-4CA2-BB2A-3BA397065A66@uni-koblenz.de \
    --to=aharder@uni-koblenz.de \
    --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).