4

I am trying ConTeXt, and there is something I used to do in LaTeX that I am trying to reproduce : I used to define blocks with an icon superimposed on the top-left corner, such as in the following picture :

enter image description here

(I am willing to add a bottom line to change, so don't be suprised if it appears in the next examples).

While watching the manual, I finally tried to use a description environment. However, if I use the text option to contain the icon, I don't find how to place it. Here's a MWE

%% test 
\usemodule[ipsum]

%% Charging the icon
\usesymbols[mvs]
\definesymbol[info][{\symbol[martinvogel 2][Info]}]

%% first test
\definedescription[remark]
              [text={\tfb\symbol[info]},
                before=
                  {\startframedtext[topframe=off,rightframe=off,
                   width=broad,background=rmk,align=left]},
                after={\stopframedtext},
                location=inmargin,
                width=fit,
                title=no]

%% document
\starttext
\startremark
  \ipsum[alternative=paragraph, n=2, language=la]
\stopremark
\stoptext

I have looked at overlays, but I really can't seem to achieve what I'm trying to do. Does anyone have an idea of how to achieve this please ?

5

You can put your text in a framedtext environment and draw the rule and the symbol as a background graphic with MetaPost.

\usesymbols[mvs]

\startuseMPgraphic{information}
    draw textext.top("\tfb\symbol[martinvogel 2][Info]") shifted (-EmWidth,OverlayHeight-StrutHeight) ;
    draw leftboundary OverlayBox topenlarged -StrutHeight shifted (-EmWidth,0) ;
    setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\defineoverlay[information][\useMPgraphic{information}]

\defineframedtext
  [information]
  [frame=off,
   rulethickness=0pt,
   offset=0pt
   background=information,
   width=max]

\starttext

\startinformation
\input knuth
\stopinformation

\stoptext

Background graphic for framed text environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.