1

I am currently trying to add some nice textboxes to my current paper. Therefore, I found the tcolorbox package and consulted corresponding manual.

Once I browsed through some of the examples and became familiar with the basic usage of the package, I found the example in the manual on page 154 which has an enhanced title box.

The basic code concerning this example would be about (basically copied from the manual):

\documentclass[pdftex]{report}

\usepackage{lipsum}
\usepackage[many]{tcolorbox}    % Paket für textboxen
\usepackage{varwidth}           % Paket zur anpassung der titelbreite von textboxen

\begin{document}

\newtcolorbox{mybox}{
    enhanced,
    before skip=2mm,after skip=2mm,
    colback=black!5,colframe=black!50,boxrule=0.2mm,
    attach boxed title to top left={xshift=1cm,yshift*=1mm-\tcboxedtitleheight},
    varwidth boxed title*=-3cm,
    boxed title style={
        frame code={
            \path[fill=tcbcol@back!30!black]
                ([yshift=-1mm,xshift=-1mm]frame.north west)
                arc[start angle=0,end angle=180,radius=1mm]
                ([yshift=-1mm,xshift=1mm]frame.north east)
                arc[start angle=180,end angle=0,radius=1mm];
            \path[left color=tcbcol@back!60!black,right color=tcbcol@back!60!black,
                middle color=tcbcol@back!80!black]
                ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
                [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
                -- (frame.south east) -- (frame.south west)
                -- ([xshift=-1mm,yshift=-1mm]frame.north west)
                [sharp corners]-- cycle;
        },
        interior engine=empty,
    },
    fonttitle=\bfseries,
    title={My title},
    colbacktitle=green
}
\begin{mybox}
\lipsum[1]
\end{mybox}

\end{document}        

Sadly, this does not seem to work.

I have narrowed down the problem to the block:

boxed title style={
    frame code={
        \path[fill=tcbcol@back!30!black]
            ([yshift=-1mm,xshift=-1mm]frame.north west)
            arc[start angle=0,end angle=180,radius=1mm]
            ([yshift=-1mm,xshift=1mm]frame.north east)
            arc[start angle=180,end angle=0,radius=1mm];
        \path[left color=tcbcol@back!60!black,right color=tcbcol@back!60!black,
            middle color=tcbcol@back!80!black]
            ([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
            [rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
            -- (frame.south east) -- (frame.south west)
            -- ([xshift=-1mm,yshift=-1mm]frame.north west)
            [sharp corners]-- cycle;
    },
    interior engine=empty,
},

If one removes the both \path branches out of the frame code, it seems to work, but the title box also not coded!

The example should look like: enter image description here

Since I did not change anything important from the example code, I do not understand the error message I am getting:

Undefined control sequence. [   \begin{mybox}]
Undefined control sequence. [   \begin{mybox}]
  • 3
    This example works out of the box. Please check your version of tcolorbox. Current version is 3.94, the feature you're using has been updated on 2016-02-26. – user31729 Aug 24 '16 at 16:10
1

Too long for a comment, it's a recommendation rather.

The package tcolorbox introduced some changes/updates from version 3.80 to 3.90 (i.e. the update from 2016/02/29). The code by the O.P. runs into issues for pre-3.90 - releases:

! Undefined control sequence.
\tcb@frame@code ->\path 
                        [fill=tcbcol@back!30!black] ([yshift=-1mm,xshift=-1m...
l.36 \begin{mybox}

Pre-3.30 versions report following error:

! Package pgfkeys Error: I do not know the key '/tcb/before skip', to which you
 passed '2mm', and I am going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.36 \begin{mybox}

Any version since 3.90 will provide the correct output, so the easiest recommendation is to update, rather to patch the code here!

enter image description here

For those who want to compare the errors etc: Here are the older versions of tcolorbox tcolorbox on github/releases

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.