Hello, I think I'm using the wrong tool. I want a description environment, slightly narrower than the main text, and separated from the main text by a hairlines. If you compile the example below, you'll see that my attempt (apart from looking not quite balanced) will allow a page break between a hairline and the information contained in my description. This rules off the bottom of the page, rather than separating the description from the main text. What I would like is that the description be compelled to have at least a couple of orphan lines of the paragraph before a page break. Is it better to use something like a framedtext to achieve this result? ----- \definedescription [Note] [headstyle=\sc, style=small, width=fit, distance=10pt, hang=20, before={\hbox to \hsize{\hairline}\startnarrower}, after={\stopnarrower\vskip -1 ex \noindent\thinrule}] \starttext \Note{important} \input tufte\par \blank[medium] \dorecurse{3}{\input tufte } \blank[big] A line of text \Note{warning} \input tufte\par \blank[medium] \dorecurse{3}{\input tufte} \stoptext -----
Guy Worthington
I think I'm using the wrong tool. I want a description environment, slightly narrower than the main text, and separated from the main text by a hairlines.
I would use the textbackground feature: \definedescription [Note] [headstyle=\sc, style=small, width=fit, distance=10pt, hang=20, before={\startnarrower\starttextbackground[NoteA]}, after={\stoptextbackground\stopnarrower}] \definetextbackground[NoteA][frame=off, topframe=on, % does not work... location=paragraph] [...] How to get top and bottom frame only is left as an exercise to the reader(*). (*) Well, I gave up on this. Perhaps we should convince Hans to make options for this like in \framed: frame=off,topframe=on as above... I did not feel like hacking TeX *and* metapost. Almost there: \startuseMPgraphic{mpos:par:columnset} path p; for i := 1 upto nofmultipars : p := multipars[i]; if multilocs[i] = 1 : % top draw topboundary p; elseif multilocs [i] = 3 : %bottom draw bottomboundary p; fi endfor ; \stopuseMPgraphic (just copy this peace of code into your tex file and you'll see) We desperately need the issplit boolean there! :) Patrick
Hello Patrick, I ran you example and it's a significant improvement on my attempt -- I knew I had the hairline in the wrong position, but didn't know how to fix it. ----- \definedescription [Note] [headstyle=\sc, style=small, width=fit, distance=10pt, hang=20, before={\startnarrower\starttextbackground[NoteA]}, after={\stoptextbackground\stopnarrower}] \definetextbackground[NoteA][frame=off,location=paragraph] \startuseMPgraphic{mpos:par:columnset} path p; for i := 1 upto nofmultipars : p := multipars[i]; if multilocs[i] = 1 : % top draw topboundary p; elseif multilocs [i] = 3 : %bottom draw bottomboundary p; fi endfor ; \stopuseMPgraphic \starttext \Note{important} \input tufte\par \blank[medium] \dorecurse{3}{\input tufte } \blank[medium] A line of text \blank[medium] \Note{warning} \input tufte\par \blank[medium] \dorecurse{3}{\input tufte} \stoptext ----- 'Time to crack open the metafun book (even though I've a sinking feeling that I'll be as old as Mathusala before I actually understand what you've done).
Guy Worthington
'Time to crack open the metafun book (even though I've a sinking feeling that I'll be as old as Mathusala before I actually understand what you've done).
To be honest: it was mostly copy and modify some code from Giuseppe B. - so he should get the credits ;) Patrick
participants (2)
-
Guy Worthington
-
Patrick Gundlach