3

This is a question that is similar to this one. I wished to implement two features of tcolorbox:

  • Box titles, with their respective list with placelistofXXX
  • Ability to choose between rounded and straight box edges.

What I had in mind was basically joining both frames below, but I still can't figure out spacing and overlay.

\starttext
\startframedtext[background=color,backgroundcolor=orange,width=.8\textwidth,align=flushleft,frame=off,bottomframe=on,framecolor=blue,bottomframe=on,rulethickness=2pt,width=.8\textwidth,location=middle,loffset=-1ex,toffset=-1ex,boffset=-1ex]
\bf A grandiose and reverential title, praising the stones and trees
\stopframedtext

\startframedtext[frame=off,topframe=on,bottomframe=on,framecolor=darkgray,background=color,backgroundcolor=lightgray,corner=round,width=.8\textwidth,location=middle] \input tufte \stopframedtext

\stoptext


Edit:

Basically what I wanted was a simple tcolorbox with title, number, and content in a separate placecontent:

a box

  • I think it could help with a picture of what you try to achive. In particular it is difficult to know what spacing you want. – mickep Dec 07 '20 at 09:36
  • @mickep, I wanted to put the first frame inside, and aligned with, the second, so that this "frame inside the frame" would be a numbered title. But if I do that there's a left and top space I haven't figured out how to remove yet. –  Dec 07 '20 at 13:57

1 Answers1

4

I'll simply use natural tables to get the desired output:

\usemodule[annotation]

\usecolors[solarized]

\startsetups table:tcolorbox \setupTABLE[row][1] [ background=color, backgroundcolor=red, foregroundcolor=base3, foregroundstyle=bold, framecolor=red, rulethickness=1.5bp, corner=03, loffset=0.25em, roffset=0.25em, ]

\setupTABLE[row][2] [ background=color, backgroundcolor=base2, foregroundcolor=base03, framecolor=red, rulethickness=1.5bp, corner=01, loffset=0.25em, roffset=0.25em, align={normal,hyphenated}, ] \stopsetups

\startsetups annotation:tcolorbox \startTABLE[setups=table:tcolorbox] \NC \placeannotationtext\space \placeannotationnumber:\space \placeannotationtitle \NC \NR \NC \placeannotationcontent \NC \NR \stopTABLE \writetolist[tcolorbox]{\placeannotationnumber}{\placeannotationtitle} \stopsetups

\defineannotationalternative [tcolorbox] [ alternative=vertical, renderingsetup=annotation:tcolorbox, ]

\defineannotation[tcolorbox] [ text=Example, number=yes, alternative=tcolorbox, ]

\starttext

\placelist[tcolorbox][alternative=b,criterium=all, headnumber=always]

\section{One}

\starttcolorbox[title={Title with a number}] \input ward \stoptcolorbox

\starttcolorbox[title={Title with a number}] \input ward \stoptcolorbox

\stoptext

which gives

enter image description here If you want straight edges, simply comment out the corner=... lines.

Aditya
  • 62,301