Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. startuseMPgraphic{mp:tcolorbox}
  2. path p, q; numeric w, h, o;
  3. w := OverlayWidth; h := OverlayHeight; o := BodyFontSize;
  4. q := (0,0) -- (0,h) -- (w,h) -- (w,0) -- cycle;
  5. p := (0,0) -- (0,h+2o) -- (w,h+2o) -- (w,0) -- cycle;
  6. p := p cornered (o);
  7. fill p withcolor OverlayColor;
  8. draw p withcolor OverlayLineColor withpen pencircle scaled OverlayLineWidth;
  9. p := (0,h) -- (0,h+2o) -- (w,h+2o) -- (w,h) -- cycle;
  10. p := p cornered (o);
  11. filldraw p -- cycle withcolor OverlayLineColor;
  12. draw textext.rt(MPstring{tcolorbox}) shifted (o,h+o) withcolor white;
  13. setbounds currentpicture to q;
  14. stopuseMPgraphic
  15.  
  16. defineoverlay[tcolorbox][useMPgraphic{mp:tcolorbox}]
  17.  
  18. definesetframetitle
  19. {setMPtext{tcolorbox}{strutframedparameter{title}}}
  20.  
  21. defineframedtext
  22. [tcolorbox]
  23. [frame=off,
  24. background=tcolorbox,
  25. backgroundcolor=white,
  26. framecolor=darkred,
  27. rulethickness=2pt,
  28. extras=setframetitle]
  29.  
  30. starttext
  31.  
  32. starttcolorbox
  33. [title={Knuth},
  34. backgroundcolor=lightgray]
  35.  
  36. samplefile{knuth}
  37.  
  38. stoptcolorbox
  39.  
  40. stoptext
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement