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