3

While writing a package I started to use tcolorbox and its documentation library. I found the keys doc head command etc. and started to customize. But there are strong limitations to that, because I basically cannot use the enhanced features. The reason (code from the package):

\newtcolorbox{tcb@doc@head}[1]{blank,colback=white,colframe=white,
  code={\tcbdimto\tcb@temp@grow@left{-\kvtcb@doc@indentleft}%
        \tcbdimto\tcb@temp@grow@right{-\kvtcb@doc@indentright}},
  grow to left by=\tcb@temp@grow@left,%
  grow to right by=\tcb@temp@grow@right,
  sidebyside,sidebyside align=top,
  sidebyside gap=-\tcb@w@upper@real,
  phantom=\phantomsection,%
  enlarge bottom by=-0.2\baselineskip,#1}

It contains the option blank which disables all drawing. For customization purposes I would like to remove it. Do I really have to redefine the whole command or is there any easy way?

MWE:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{documentation}
\tcbset{
doc head command={colback=black} % disable blank here for the fancy stuff
}

\begin{document}
\begin{docCommand}{examplecommand}
Test
\end{docCommand}
\end{document}
2
  • What about \tcbset{blank/.style={}} just after loading the documentation library?
    – user31729
    Jul 8, 2017 at 16:54
  • @ChristianHupfer Simple, but effective. I hope this does not break anything. Would you mind writing up an answer?
    – TeXnician
    Jul 8, 2017 at 17:04

1 Answer 1

5

The easiest way is to say \tcbset{blank/.style={}} after loading the documentation library, but this could break other tcolorbox environments (their look would change if blank is used there).

Another solution is to define noblank which partially revokes the definitions in blank (see the file tcbskins.code.tex for the settings), unfortunately, some of the options have to copied over and changed manually.

\documentclass{article}
\usepackage{tcolorbox}


\tcbuselibrary{documentation}


% From tcbskins.code.tex
% blank/.style={enhanced,frame hidden,interior hidden,segmentation hidden,%
%    arc=0pt,outer arc=0pt,boxsep=0pt,top=0pt,bottom=0pt,left=0pt,right=0pt,boxrule=0pt,%
%    bottomtitle=6pt,middle=3pt}}

\tcbset{
  noblank/.style={enhanced,frame style={draw,fill=tcbcol@frame}, interior style={draw,fill=tcbcol@back}, segmentation hidden,sharp corners,
    %boxrule=1pt, % Change at will
    %boxsep=1pt,
  }
}

\tcbset{
  doc head command={colback=black,noblank} % disable blank here for the fancy stuff
}




\begin{document}
\begin{docCommand}{examplecommand}{}
Test
\end{docCommand}
\end{document}

enter image description here

3
  • @TeXnician: Change the options at will. I think the segmentation hidden style is crucial for the documentation commands, that's why I did not reenable it
    – user31729
    Jul 8, 2017 at 17:21
  • To revoke the frame hidden from blank I suggest to use frame style= (note the =) instead of frame style={draw,fill=tcbcol@frame} for noblank. The same goes for interior style :-) Jul 10, 2017 at 5:48
  • @ThomasF.Sturm: I did not think of that easy way. I'll give it a try
    – user31729
    Jul 11, 2017 at 0:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .