0

I am trying to create a tcolorbox like the one mentioned in version 3.40 manual:

enter image description here

I tried to figure out the settings by going through the source code, available here:

ftp://ftp.dante.de/tex-archive/macros/latex/contrib/tcolorbox/

Till now, I am not able to create a MWE using the extracted settings but it seems that they are too complicated to just draw a box:

  \documentclass[10pt]{book}

  \def\tcb@layer@pushup{%
  \tcb@count@boxes%
  \global\advance\tcolorbox@number by -1\relax%
  \stepcounter{tcblayer}%
  \ifnum\c@tcblayer>1%
    \tcbset{breakable@true/.code=}%
  \else%
    \ifinner\ifhmode\tcbset{breakable@true/.code=}\fi\fi%
  \fi%
  \ifnum\c@tcblayer>\tcb@managed@layers@max%
    \tcbset{every box on higher layers}%
    \tcbset{every box on higher layers/.code=}%
  \else%
    \tcbset{every box on layer \number\c@tcblayer}%
    \tcbset{every box on layer \number\c@tcblayer/.code=}%
  \fi%
  \addtocounter{tcblayer}{-1}%
}

\tcbset{
  docexample/.style={colframe=ExampleFrame,colback=ExampleBack,
    before skip=\medskipamount,after skip=\medskipamount,
    fontlower=\footnotesize},
  index default settings/.style={index actual={@},index quote={"},index level={!}},
  index german settings/.style={index actual={=},index quote={!},index level={>}},
  english language/.code={\tcbset{doclang/.cd,
    color=color,colors=Colors,
    counter=counter,counters=Counters,
    environment content=environment content,
    environment=environment,environments=Environments,
    index=Index,
    key=key,keys=Keys,
    length=length,lengths=Lengths,
    new=New,
    pageshort={P.},
    updated=Updated,
    value=value,values=Values}},
}

 \def\dispListing{\tcb@layer@pushup\tcbset{docexample}\begingroup\tcbwritetemp}

\def\enddispListing{%
  \endtcbwritetemp\endgroup%
  \begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \end{tcolorbox}%
}

\begin{dispListing}
Hello World
\end{dispListing}

Can someone please suggest me a simpler way to draw a similar box ?

Thanks

  • You could at least have provided a \documentclass etc :-( -- and current version of tcolorbox is 3.93 already – user31729 Jul 5 '16 at 11:19
  • No, it's still not compilable – user31729 Jul 5 '16 at 11:23
4

default code boxes for tcolorboxversion 3.40 are different from last version 3.93. I don't know how to obtain 3.40 code to dive into, so I've tried to do something similar. Hope it helps.

OP box has a frame based on a fixed image which looks like a rotated version of blueshade.png from tcolorbox.

enter image description here

As I don't know how to rotate it being the frame style image, the result is not the same.

enter image description here

\documentclass[tikz,border=2mm]{standalone} 
\usepackage[most]{tcolorbox}

\begin{document}

\newtcolorbox{mybox}{colback=blue!25!black!15, enhanced, frame style image=blueshade.png, drop fuzzy shadow}

\begin{mybox}
This is a \textbf{tcolorbox}.
\end{mybox}
\end{document}

Update

Thank you to Christian Hupfer who provided a link to 3.40 version, I could find how default code boxes were defined. In this case, svgnames option must be passed to xcolor and all option to tcolorbox because ExampleBack color is defined in its documentation library:

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[tikz,border=2mm]{standalone} 
\usepackage[all]{tcolorbox}

\begin{document}

\newtcolorbox{mybox}{colback=Navy!5!ExampleBack, enhanced, 
    frame style ={fill stretch image*={angle=180,origin=c}{blueshade.png},         
          fill image opacity=0.75}, 
    drop fuzzy shadow}

\begin{mybox}
This is a \textbf{tcolorbox}.
\end{mybox}
\end{document}

enter image description here

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.