ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Metafun manual section titles
@ 2011-11-13 22:24 Romain Diss
  2011-11-14  0:19 ` Andreas Harder
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Diss @ 2011-11-13 22:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 ?


-- 
Romain Diss
<romain.diss@yahoo.fr>
___________________________________________________________________________________
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] 3+ messages in thread

* Re: Metafun manual section titles
  2011-11-13 22:24 Metafun manual section titles Romain Diss
@ 2011-11-14  0:19 ` Andreas Harder
  2011-11-14 14:14   ` [solved] " Romain Diss
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Harder @ 2011-11-14  0:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


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

* Re: [solved] Metafun manual section titles
  2011-11-14  0:19 ` Andreas Harder
@ 2011-11-14 14:14   ` Romain Diss
  0 siblings, 0 replies; 3+ messages in thread
From: Romain Diss @ 2011-11-14 14:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

On 14.11.2011, Andreas Harder wrote:
> On 13.11.2011, at 23:24, Romain Diss wrote:
> > I'm trying to make some section titles which look like the ones of the
> > metafun manual: title and number underlined [...]
> 
> you can try something like this:
> [...]

Thank you very much. It works perfectly! It take me some time to understand 
every line but the solution is quite nice. Context never stop to surprise me 
with all these "not so much documented" powerfull macros...

-- 
Romain Diss
<romain.diss@yahoo.fr>
___________________________________________________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2011-11-14 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-13 22:24 Metafun manual section titles Romain Diss
2011-11-14  0:19 ` Andreas Harder
2011-11-14 14:14   ` [solved] " Romain Diss

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