Feedforward semantic segmentation with zoom-out features
Mohammadreza Mostajabi
Payman Yadollahpour and Gregory Shakhnarovich
Toyota Technological Institute at Chicago
{\tt \{mostajabi
pyadolla
greg\
We introduce a purely feed-forward architecture for semantic segmentation. We map small image elements (superpixels) to rich feature representations extracted from a sequence of nested regions of increasing extent. These regions are obtained by "zooming out" from the superpixel all the way to scene-level resolution. This approach exploits statistical structure in the image and in the label space without setting up explicit structured prediction mechanisms, and thus avoids complex and expensive inference. Instead superpixels are classified by a feedforward multilayer network. Our architecture achieves new state of the art performance in semantic segmentation, obtaining 64.4\% average accuracy on the PASCAL VOC 2012 test set.
arxiv.tex
\documentclass[10pt,twocolumn,letterpaper]{article}
\pdfoutput=1 

\usepackage{cvpr}
\usepackage{amsmath,amssymb,amsfonts,gensymb}
%\usepackage{subfig}

\cvprfinalcopy
\usepackage{tikz}
%\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{intersections}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{fit}
\usepackage[skins]{tcolorbox}

\usepackage{times}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{array}
\def\rot{\rotatebox}
\usepackage{tabu}

\usepackage{upgreek}
\newcommand{\bmmax}{0} % to fix bold greek fonts
\usepackage{bm}
\usepackage{comment}
\makeatletter
\newcommand{\bfgreek}[1]{\bm{\@nameuse{#1}}}
\newcommand{\bfgreekco}[2]{\bm{\textcolor{#2}{\@nameuse{#1}}}}
\makeatother

\newcommand{\greg}[1]{\textbf{\textcolor{red}{#1}}}

% Include other packages here, before hyperref.

% If you comment hyperref and then uncomment it, you should delete
% egpaper.aux before re-running latex.  (Or just hit 'q' on the first latex
% run, let it finish, and you should be clear).
\usepackage[pagebackref=true,breaklinks=true,letterpaper=true,colorlinks,bookmarks=false]{hyperref}

% \cvprfinalcopy % *** Uncomment this line for the final submission

\def\httilde{\mbox{\tt\raisebox{-.5ex}{\symbol{126}}}}

% Pages are numbered in submission mode, and unnumbered in camera-ready
\begin{document}

%%%%%%%%% TITLE
\title{Feedforward semantic segmentation with zoom-out features}

\makeatletter
\author{Mohammadreza Mostajabi, Payman Yadollahpour and Gregory Shakhnarovich\\
Toyota Technological Institute at Chicago\\{\tt \{mostajabi,pyadolla,greg\}@ttic.edu}}
\makeatother

\date{}

\maketitle
%\thispagestyle{empty}

%%%%%%%%% ABSTRACT
\begin{abstract}
We introduce a purely feed-forward architecture for semantic
segmentation. We map small image elements (superpixels) to rich
feature representations extracted from a sequence of nested regions of
increasing extent. These regions are obtained by "zooming out" from the superpixel all
the way to scene-level resolution. This approach exploits
statistical structure in the image and in the label space without setting up explicit structured
prediction mechanisms, and thus avoids complex and expensive
inference. Instead superpixels are classified by a feedforward multilayer network. Our architecture achieves new
state of the art performance in semantic segmentation,
obtaining \textbf{64.4\%} average accuracy on the PASCAL VOC 2012 test set.
\end{abstract}

%%%%%%%%% BODY TEXT

\input{intro}



\input{method}


\input{related}


\input{experiments}


\input{conclusions}




{\small
\bibliographystyle{ieee}
\bibliography{segmentation}
}

\end{document}

colorcode.tex
\begin{figure*}[!th]
  \centering
\begin{tikzpicture}[every node/.style={font=\footnotesize}]
  \definecolor{aeroplane-co}{rgb}{0.502,0,0}
    \node[text=white,fill=aeroplane-co,draw=aeroplane-co,minimum
    height=.5cm,minimum width=1.65cm] (aeroplane) {aeroplane};

    \definecolor{bicycle-co}{rgb}{0,0.502,0}    
    \node[text=white,fill=bicycle-co,draw=bicycle-co,minimum
    height=.5cm,minimum width=1.65cm,right=of aeroplane,right=.1cm] (bicycle) {bicycle};

    \definecolor{bird-co}{rgb}{0.502,0.502,0}    
    \node[text=white,fill=bird-co,draw=bird-co,minimum
    height=.5cm,minimum width=1.65cm,right=of bicycle,right=.1cm] (bird) {bird};

    \definecolor{boat-co}{rgb}{0,0,0.502}    
        \node[text=white,fill=boat-co,draw=boat-co,minimum
    height=.5cm,minimum width=1.65cm,right=of bird,right=.1cm] (boat) {boat};

    \definecolor{bottle-co}{rgb}{0.502,0,0.502}    
    \node[text=white,fill=bottle-co,draw=bottle-co,minimum
    height=.5cm,minimum width=1.65cm,right=of boat,right=.1cm] (bottle) {bottle};
    
    \definecolor{bus-co}{rgb}{0,0.502,0.502}    
    \node[text=white,fill=bus-co,draw=bus-co,minimum
    height=.5cm,minimum width=1.65cm,right=of bottle,right=.1cm] (bus) {bus};

    \definecolor{car-co}{rgb}{0.502,0.502,0.502}    
    \node[text=white,fill=car-co,draw=car-co,minimum
    height=.5cm,minimum width=1.65cm,right=of bus,right=.1cm] (car)
    {car};

    \definecolor{cat-co}{rgb}{0.251,0,0}    
    \node[text=white,fill=cat-co,draw=cat-co,minimum
    height=.5cm,minimum width=1.65cm,right=of car,right=.1cm] (cat)
    {cat};

    \definecolor{chair-co}{rgb}{0.753,0,0}    
    \node[text=white,fill=chair-co,draw=chair-co,minimum
    height=.5cm,minimum width=1.65cm,right=of cat,right=.1cm] (chair)
    {chair};

    \definecolor{cow-co}{rgb}{0.251,0.502,0}    
    \node[text=white,fill=cow-co,draw=cow-co,minimum
    height=.5cm,minimum width=1.65cm,right=of chair,right=.1cm] (cow)
    {cow};

    \definecolor{diningtable-co}{rgb}{0.753,0.502,0}    
    \node[text=white,fill=diningtable-co,draw=diningtable-co,minimum
    height=.5cm,minimum width=1.65cm,below=of aeroplane,below=.1cm] (diningtable)
    {diningtable};

    \definecolor{dog-co}{rgb}{0.251,0,0.502}    
    \node[text=white,fill=dog-co,draw=dog-co,minimum
    height=.5cm,minimum width=1.65cm,right=of diningtable,right=.1cm] (dog)
    {dog};

    \definecolor{horse-co}{rgb}{0.753,0,0.502}    
    \node[text=white,fill=horse-co,draw=horse-co,minimum
    height=.5cm,minimum width=1.65cm,right=of dog,right=.1cm] (horse)
    {horse};

    \definecolor{motorbike-co}{rgb}{0.251,0.502,0.502}    
    \node[text=white,fill=motorbike-co,draw=motorbike-co,minimum
    height=.5cm,minimum width=1.65cm,right=of horse,right=.1cm] (motorbike)
    {motorbike};

    \definecolor{person-co}{rgb}{0.753,0.502,0.502}    
    \node[text=white,fill=person-co,draw=person-co,minimum
    height=.5cm,minimum width=1.65cm,right=of motorbike,right=.1cm] (person)
    {person};

    \definecolor{pottedplant-co}{rgb}{0,0.251,0}    
    \node[text=white,fill=pottedplant-co,draw=pottedplant-co,minimum
    height=.5cm,minimum width=1.65cm,right=of person,right=.1cm] (pottedplant)
    {pottedplant};

    \definecolor{sheep-co}{rgb}{0.502,0.251,0}    
    \node[text=white,fill=sheep-co,draw=sheep-co,minimum
    height=.5cm,minimum width=1.65cm,right=of pottedplant,right=.1cm] (sheep)
    {sheep};

    \definecolor{sofa-co}{rgb}{0,0.753,0}    
    \node[text=white,fill=sofa-co,draw=sofa-co,minimum
    height=.5cm,minimum width=1.65cm,right=of sheep,right=.1cm] (sofa)
    {sofa};

    \definecolor{train-co}{rgb}{0.502,0.753,0}    
    \node[text=white,fill=train-co,draw=train-co,minimum
    height=.5cm,minimum width=1.65cm,right=of sofa,right=.1cm] (train)
    {train};

   \definecolor{tvmonitor-co}{rgb}{0,0.251,0.502}    
    \node[text=white,fill=tvmonitor-co,draw=tvmonitor-co,minimum
    height=.5cm,minimum width=1.65cm,right=of train,right=.1cm] (tvmonitor)
    {tvmonitor};


\end{tikzpicture}
  \caption{Color code for VOC categories. Background is black.}
  \label{fig:colorcode}
\end{figure*}

conclusions.tex
\section{Conclusions}\label{sec:conclusions}

The main point of this paper is to explore how far we can push
feedforward semantic labeling of superpixels when we use
multilevel, zoom-out feature construction and train non-linear
classifiers (multi-layer neural networks) with asymmetric loss. The results are perhaps surprising:
we can far surpass existing state of the art, despite apparent
simplicity of our method and lack of explicit respresentation of the
structured nature of the segmentation task. Another important
conclusion that emerges from this is that we finally have shown that
segmentation, just like image classification, detection and other
recognition tasks, can benefit from the advent of deep convolutional
networks. 

Despite this progress, much remains to be
done as we continue this work. Immediately, we plan to
explore obvious improvements. One of these is replacement of
all the handcrafted local and proximal features with features learned
from the data with convnets. Another such improvement is to fine tune
the ``off the shelf'' networks currently used for distant and global
feature extraction. We also plan to look into including additional
zoom-out levels.
Our longer term plan is to switch from a collection of feature
extractors deployed at different zoom-out levels to a single zoom-out
network, which would be more in line with the philosophy of end-to-end
learning that has drive deep learning research.

Finally, despite the surprising success of the
zoom-out architecture described here, we by no means intend to entirely dismiss CRFs,
or more generally inference in structured models. We believe that the
zoom-out architecture may eventually benefit from
bringing back some form of inference to ``clean up'' the predictions. We hope that this can be done
without giving up the feedforward nature of our approach; one
possibility we are interested in exploring is to ``unroll''
approximate inference
into additional layers in the feedforward network~\cite{li2014mean,stoyanov2011empirical}.



experiments.tex
\section{Experiments}\label{sec:exp}

Our main set of experiments focuses on the PASCAL VOC category-level segmentation
benchmark with 21 categories, including the catch-all background
category. VOC is widely considered to be the main semantic
segmentation benchmark today\footnote{The Microsoft Common Objects in
  Context (COCO) promises to become another such benchmark, however at
  the time of this writing it is not yet fully set up with test set
  and evaluation procedure}. The original data set labeled with segmentation ground truth
consists of {\tt train}
and {\tt val} portions
(about 1,500 images in each). Ground
truth labels for additional 9,118 images have been provided by authors
of~\cite{BharathICCV2011}, and are commonly used in training segmentation models.
In all experiments below, we used the combination of these additional images with the original
{\tt train}
set for training, and {\tt val} was used only as held out validation set, to tune
parameters and to perform ``ablation studies''.



The
main measure of success is accuracy on the test, which for VOC 2012
consists of 1,456 images. No ground truth is available for test, and
accuracy on it can only be obtained by uploading predicted
segmentations to the evaluation server.
The standard evaluation measure for category-level segmentation in VOC
benchmarks is per-pixel accuracy, defined as intersection of the
predicted and true sets of pixels for a given class, divided by their
union (IU in short). This is averaged across the 21 classes to provide a single accuracy
number, mean IU, usually used to measure overall performance of a method.



\subsection{Superpixels and neighborhoods}
We obtained roughly 500 SLIC superpixels~\cite{achanta_pami12} per
image (the exact number varies per image), with
the parameter $m$ that controls the tradeoff between spatial and color
proximity set to 15, producing superpixels which tend to be of uniform
size and regular shape, but adhere to local
boundaries when color evidence compels it. This results
in average supepixel region of 21$\times$21 pixels. An example of a
typical over-segmentation is shown in Figure~\ref{fig:regions}.

Proximal region for a superpixel $s$ is defined as a set of
superpixels within radius 2 from $s$, that is, the immediate neighbors
of $s$ as well as their immediate neighbors. The proximal region can
be of arbitrary shape; its average size in training images is 100x100 pixels.
The distant region is
defined by all neighbors of $s$ up to the 3rd degree, and consists of
the bounding box around those neighbors, so that in contrast to
proximal, it is always rectangular; its average size is 170$\times$170
pixels.
Figure~\ref{fig:regions} contains a
few typical examples for the regions.


\subsection{Zoom-out feature computation}
Feature extraction differs according to the zoom-out level, as
described below.


\subsubsection{Local features}

To represent a superpixel we use a number of well known features as well
as a small set of learned features.

\begin{description}
\item[Color]
We compute histograms separately for each of the three L*a*b color
channels, using 32 as well as 8 bins, using equally spaced binning;
this yields 120 feature dimensions.  We also compute the entropy of
each 32-bin histogram as an additional scalar feature (+3 dimensions). Finally, we
also re-compute histograms using adaptive binning, based on observed quantiles
in each image (+120 dimensions).

\item[Texture]
Texture is represented by histogram of texton assignments, with
64-texton dictionary computed over a sampling of images from the
training set. This histogram is augmented with the value of its
entropy. In total there are 65 texture-related channels.

\item[SIFT] A richer set of features capturing appearance
is based on ``bag of words'' representations computed over SIFT
descriptors. The descriptors are computed over a regular grid (every 8
pixels), on 8- and 18-pixel patches, separately for each L*a*b
channel. All the descriptors are assigned to a dictionary of 500
visual words. Resulting assignment histograms are averaged for two
patch sizes in each channel, yielding a total of 1500 values, plus 6
values for the entropies of the histograms.

\item[Location] Finally, we encode superpixel's location, by
computing its image-normalized coordinates relative to the center as
well as its shift from the center (the absolute value of the
coordinates); this produces four feature values.

\item[Local convnet] Instead of using hand-crafted features we
could learn a representation for the superpixel using a convnet. We
trained a network with 3 convolutional (conv) + pooling + RELU layers,
with 32, 32 and 64 filters respectively, followed by two
fully connected layers (1152 units each) and finally a softmax layer. The input to this
network is the bounding box of the superpixel, resized to 25$\times$25
pixels and padded to $35\times35$, in L*a*b color space. The filter
sizes in all layers are 5$\times$5; the pooling layers all have 3$\times$3
receptive fields, with stride of 2. We trained the network using
back-propagation, with the objective of minimizing log-loss for
superpixel classification. The output of the softmax layer of this
network is used as a 21-dimensional feature vector. Another
network with the same architecture was trained on binary
classification of foreground vs. background classes; that gives us two
more features.
\end{description}

%\greg{timing}
%Computing the local features takes about \greg{???} seconds per image.

\subsubsection{Proximal features}
We use the same set of handcrafted features as for local regions,
resulting in 1818 feature dimensions.

\subsubsection{Distant and global features}
For distant and global features we use deep convnets originally
trained to classify images. In our initial experiments we used the CNN-S network
in~\cite{simonyan2014return}. It has 5 convolution layers
(three of them followed by pooling) and two fully connected layers. To extract the relevant features, we
resize either the distant region or the entire image to
224$\times$224 pixels, feed it to the network, and record the
activation values of the last fully-connected layer with 4096 units.
In a subsequent set of experiments we switched from CNN-S to a 16
layer network introduced in~\cite{simonyan2014very}. This network,
which we refer to as VGG-16, contains more layers that apply
non-linear transformations, but with smaller filters, and thus may learn richer representation
with fewer parameters. It has
produced excellent results on image classification and recently has
been reported to lead to a much better performance when used in
detection~\cite{girshick2014rich}. As reported below, we also observe
a significant improvement when using VGG-16 to extract distant
and global features, compared to performance with CNN-S.
    Note that both networks we used were originally trained for 1000-category ImageNet
classification task, and we did not fine-tune it in any way on VOC data.

\subsection{Learning setup}
With more than 10,000 images and roughly 500 superpixels per image, we
have more than 5 million training examples. 

In section~\ref{sec:method} we mentioned an obvious concern when reducing image labeling problem to superpixel
labeling is whether this leads to loss of achievable accuracy, since
superpixels need not perfectly adhere to true boundaries. Having
assigned each superpixel a category label based on the majority of
pixels in it, we computed the accuracy of this assignment on val: 94.4\%. Since accuracies of most of today's methods are well below this
number, we can assume that any potential loss of accuracy due to our
commitment to superpixel boundaries is going to play a minimal role
in our results.

We trained the classifiers mentioned below with asymmetric
loss~\eqref{eq:asymloss} using
Caffe~\cite{jia2014caffe}, on a single machine equipped with a Tesla K40
GPU. During training we used fixed learning rate of 0.0001, and
weight decay factor of 0.001.

%We therefore proceed treating these assigned labels as
%the target values for classification.



%\subsection{Significance of feature levels}
\subsection{Results on PASCAL VOC 2012}
To empirically assess the importance of features extracted
at different zoom-out levels, we trained linear (softmax) models
using various feature
subsets, as shown in Table~\ref{tab:ablation}, and evaluated them on
VOC 2012 {\tt val}. In these experiments we used CNN-S to extract
distant and global features.


\input{colorcode}

\begin{table}[!th]
  \centering
{\small
  \begin{tabular}{|l|l|}
    \hline
Feature set & mean accuracy\\
\hline
local &  14.6\\
proximal & 15.5\\
local+proximal & 17.7\\
local+distant & 37.38\\
local+global & 41.8\\
local+proximal+global & 43.4\\
distant+global & 47.0\\
\hline
full zoom-out, symmetric loss & 20.4\\
\hline
full zoom-out, asymmetric loss & {\bf 52.4}\\
\hline
  \end{tabular}}
  \caption{Ablation study: importance of features from different
    levels under linear superpixel classification. Results on VOC 2012 val, mean class accuracy.}
  \label{tab:ablation}
\end{table}

It is evident that each of the zoom-out
levels contributes to the eventual accuracy. The most striking is the
effect of adding the distant and global features computed by convnets;
but local and proximal features are very important as well, and
without those we observe poor segment localization.
We also confirmed empirically that learning with asymmetric loss leads to
dramatically better performance, as shown in
Table~\ref{tab:ablation}, with a few examples in
Figure~\ref{fig:levels}.

\begin{figure*}
  \centering
  \begin{tabular}{cc>{\hspace{-1.5em}}c>{\hspace{-2.5em}}c>{\hspace{-2.5em}}c>{\hspace{-2.5em}}c}
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2007_001423.jpg}} &
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2007_001423.png}} &
    \includegraphics[width=.2\textwidth]{img/2007_001423_local} &
    \includegraphics[width=.2\textwidth]{img/2007_001423_local+N2} &
    \includegraphics[width=.2\textwidth]{img/2007_001423_local+N2+global} &
    \includegraphics[width=.2\textwidth]{img/2007_001423_full}\\
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2008_001547.jpg}} &
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2008_001547.png}} &
    \includegraphics[width=.2\textwidth]{img/2008_001547_local} &
    \includegraphics[width=.2\textwidth]{img/2008_001547_local+N2} &
    \includegraphics[width=.2\textwidth]{img/2008_001547_local+N2+global} &
    \includegraphics[width=.2\textwidth]{img/2008_001547_full}\\
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2010_001069.jpg}} &
    \raisebox{.8em}{\includegraphics[width=.15\textwidth]{img/2010_001069.png}} &
    \includegraphics[width=.2\textwidth]{img/2010_001069_local} &
    \includegraphics[width=.2\textwidth]{img/2010_001069_local+N2} &
    \includegraphics[width=.2\textwidth]{img/2010_001069_local+N2+global} &
    \includegraphics[width=.2\textwidth]{img/2010_001069_full}
  \end{tabular}
  \caption{Examples illustrating the effect of zoom-out levels. From
    left: original image, ground truth, local only, local and
    proximal, local, proximal and global, and the full (four levels)
    set of zoom-out features. In all cases a linear model is used to
    label superpixels. See Figure~\ref{fig:colorcode} for category
    color code.}
  \label{fig:levels}
\end{figure*}



Next we explored the impact of switching from linear softmax models to
multilayer neural networks, as well as the effect of switching from
the 7-layer CNN-S to VGG-16.
Results of this set of experiments (mean IU when testing on {\tt val})
are
shown in Table~\ref{tab:models}. The best performer in the set of
experiments using CNN-S was
a two-layer network with 512 hidden units with rectified linear unit
activations. Deeper networks tended to
generalize less well, even when using
dropout~\cite{krizhevsky2012imagenet} in training. Then, switching to
VGG-16, we explored classifiers with this architecture, varying the
number of hidden units. The model with 1024 units in the hidden layer
led to the best accuracy on {\tt val}.



\begin{table}[!th]
  \centering
{\small
  \begin{tabular}{|l|l||l|l|}
    \hline
net & \#layers & \#units & mean IoU\\
\hline
CNN-S &1 (linear) & 0 & 52.4\\
\hline
CNN-S &2 & 256  & 57.9\\
CNN-S &2 & 512 & 59.1\\
CNN-S &3 & 256+256 & 56.4\\
CNN-S &3 & 256+256(dropout) &57.0\\
\hline
VGG-16 & 2 & 256 & 62.3 \\
VGG-16 & 2 & 512 & 63.0\\
VGG-16 & 2 & 1024 & {\bf 63.5}\\
\hline
  \end{tabular}}
  \caption{Results on VOC 2012 {\tt val} with different classification
    models. Net: convnet used to extract proximal and global features:
    CNN-S is the 7-layer network from~\cite{simonyan2014return},
    VGG-16 is the 16-layer network from~\cite{simonyan2014very}.
    Both convnets were pre-trained on ImageNet and used with no fine-tuning for
    our task. \#layers: number of layers in the classifier
    network. \#units: number of units in the hidden layer of the
    classifier network. }
  \label{tab:models}
\end{table}





Based on the results in Table~\ref{tab:models} we took the 2-layer
network with 1024 hidden units, with distant and global features
extracted using VGG-16, as the model of choice, and evaluated it
on the VOC 2012 test data\footnote{The best test result with a
  two-layer classifier using CNN-S
  features was mean IU of 58.4}. We report the results of this evaluation in
Table~\ref{tab:voc-old}; to allow for comparison to previously
published results, we also include numbers on VOC 2010 and 2011 test
sets, which are subsets of 2012. The table makes it clear that our
zoom-out architecture achieves accuracies well above those of any of
the previously published methods. Detailed per-class accuracies in
Table~\ref{tab:details-2012} reveal that this superiority is obtained
on 15 out of 20 object categories, some of them (like dogs, cats, or
trains) by a large margin.

\begin{table}[!th]
  \centering
  \begin{tabular}{|>{\small}l||l|l||l|}
    \hline
Method & {\small VOC2010} & {\small VOC2011} & {\small VOC2012}\\
\hline
zoom-out (ours) & {\bf 64.4} & {\bf 64.1} & {\bf 64.4}\\
\hline
FCN-8s~\cite{long2014fully} & -- & 62.7 & 62.2\\ 
Hypercolumns~\cite{hariharan2014hypercolumns} & -- & -- & 59.2\\
DivMbest+convnet~\cite{dhruv-new} & -- & -- & 52.2\\
SDS~\cite{hariharan2014simultaneous} & -- & 52.6 & 51.6\\
DivMbest+rerank~\cite{yadollahpour2013discriminative} & --&--& 48.1\\
Codemaps~\cite{Li2013codemaps} & --&-- &48.3\\
$O2P$~\cite{carreira2012semantic} & -- & 47.6 & 47.8\\
Regions \& parts\cite{arbelaez_cvpr12} & -- & 40.8 & --\\
D-sampling~\cite{lucchi2011spatial} & 33.5 & -- & --\\
Harmony potentials~\cite{boix_ijcv12} & 40.1 & -- & --\\
\hline
  \end{tabular}
  \caption{Results on VOC 2010, 2011 and 2012 test. Mean IoU is shown, see Table~\ref{tab:details-2012} for per-class
    accuracies of the zoom-out method.}
  \label{tab:voc-old}
\end{table}


% trick from http://tex.stackexchange.com/questions/32683/rotated-column-titles-in-tabular
%\newcommand{\rot}[1]{\multicolumn{1}{c}{\adjustbox{angle=90,lap=\width-1em}{#1}}‌​}



\renewcommand{\arraystretch}{1.5}
\setlength{\tabcolsep}{3pt}
\begin{table*}[!th]
  \centering
{\small
  \begin{tabu}{|l|c||c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
    \hline
    class &
    \rot{90}{\bf mean} &
    \rot{90}{background} &
    \rot{90}{aeroplane} &
    \rot{90}{bycycle}&
    \rot{90}{bird}&
    \rot{90}{boat}&
    \rot{90}{bottle}&
    \rot{90}{bus}&
    \rot{90}{car}&
    \rot{90}{cat}&
    \rot{90}{chair}&
    \rot{90}{cow}&
    \rot{90}{diningtable}&
    \rot{90}{dog}&
    \rot{90}{horse}&
    \rot{90}{motorbike}&
    \rot{90}{person}&
    \rot{90}{potted plant}&
    \rot{90}{sheep}&
    \rot{90}{sofa}&
    \rot{90}{train}&
    \rot{90}{TV/monitor}
    \\
    \hline
    \rowfont{\footnotesize}
    {\normalsize acc} &
    64.4 &
    89.8 &
    {\bf 81.9}& {\bf 35.1} & {\bf 78.2} & {\bf 57.4} & 56.5 &
    {\bf 80.5} & 74.0 & {\bf 79.8} & 22.4 & {\bf 69.6} &
    {\bf 53.7} & {\bf 74.0} & {\bf 76.0} & {\bf 76.6} & 68.8 &
    44.3 & 70.2 & {\bf 40.2} & 68.9 & {\bf 55.3}\\
    \hline
  \end{tabu}
}
\vspace{1em}\caption{Detailed results of our method on VOC 2012 test. Bold indicates best results on a given class of \emph{any} method we are aware of.}
  \label{tab:details-2012}
\end{table*}



\begin{figure*}[!th]
  \centering
  \begin{tabular}{cccccc}
\includegraphics[width=.16\textwidth]{figs/2011_002322.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2011_002322.png}&
\includegraphics[width=.14\textwidth]{figs/2007_001586.jpg} &
 \includegraphics[width=.14\textwidth]{figs/2007_001586.png}&
\includegraphics[width=.16\textwidth]{figs/2009_000412.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_000412.png}\\
\includegraphics[width=.16\textwidth]{figs/2007_000830.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_000830.png}&
\includegraphics[width=.15\textwidth]{figs/2007_001585.jpg} &
 \includegraphics[width=.15\textwidth]{figs/2007_001585.png}&
\includegraphics[width=.16\textwidth]{figs/2010_005284.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2010_005284.png}\\
\includegraphics[width=.09\textwidth]{figs/2009_003494.jpg} &
 \includegraphics[width=.09\textwidth]{figs/2009_003494.png} &
\includegraphics[width=.16\textwidth]{figs/2007_001311.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_001311.png}&
\includegraphics[width=.16\textwidth]{figs/2007_002728.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_002728.png}\\
%\includegraphics[width=.16\textwidth]{figs/2008_006108.jpg} &
% \includegraphics[width=.16\textwidth]{figs/2008_006108.png}\\
\includegraphics[width=.16\textwidth]{figs/2007_003143.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_003143.png}&
\includegraphics[width=.16\textwidth]{figs/2007_003349.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_003349.png}&
\includegraphics[width=.16\textwidth]{figs/2009_004507.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_004507.png}\\
\includegraphics[width=.16\textwidth]{figs/2007_002643.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_002643.png}&
\includegraphics[width=.16\textwidth]{figs/2011_002358.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2011_002358.png}&
\includegraphics[width=.16\textwidth]{figs/2010_001024.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2010_001024.png}\\
\includegraphics[width=.16\textwidth]{figs/2007_000129.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_000129.png}&
\includegraphics[width=.16\textwidth]{figs/2008_004654.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2008_004654.png}&
\includegraphics[width=.16\textwidth]{figs/2010_001557.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2010_001557.png}

  \end{tabular}
  \caption{Example segmentations on VOC 2012 val with our best
    classifier (2-layer neural network with 1024 hidden
    units, using four zoom-out levels). See Figure~\ref{fig:colorcode} for category
    color code.}
  \label{fig:examples}
\end{figure*}


\begin{figure*}
  \centering
\begin{tabular}{cccccc}
\includegraphics[width=.16\textwidth]{figs/2007_003088.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_003088.png}&
 \includegraphics[width=.18\textwidth]{figs/2011_003256.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2011_003256.png}&
\includegraphics[width=.16\textwidth]{figs/2009_000964.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_000964.png}\\
\includegraphics[width=.16\textwidth]{figs/2008_000725.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2008_000725.png}&
\includegraphics[width=.16\textwidth]{figs/2010_002305.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2010_002305.png}&
\includegraphics[width=.16\textwidth]{figs/2010_003302.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2010_003302.png}\\
\includegraphics[width=.16\textwidth]{figs/2009_002487.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_002487.png}&
\includegraphics[width=.16\textwidth]{figs/2009_002591.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_002591.png}&
\includegraphics[width=.16\textwidth]{figs/2009_000012.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_000012.png}\\
\includegraphics[width=.16\textwidth]{figs/2009_000964.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_000964.png}&
\includegraphics[width=.16\textwidth]{figs/2008_008362.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2008_008362.png}&
\includegraphics[width=.16\textwidth]{figs/2009_000704.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2009_000704.png}\\
\includegraphics[width=.16\textwidth]{figs/2007_000999.jpg} &
 \includegraphics[width=.16\textwidth]{figs/2007_000999.png}&
\includegraphics[width=.14\textwidth]{figs/2009_002808.jpg} &
 \includegraphics[width=.14\textwidth]{figs/2009_002808.png}&
\includegraphics[width=.16\textwidth]{figs/2010_005705.jpg}&
 \includegraphics[width=.16\textwidth]{figs/2010_005705.png}
\end{tabular}
  \caption{Additional examples of segmentation on VOC 2012 val with
    our model. See Figure~\ref{fig:colorcode} for category
    color code.}\label{fig:examples2}  
\end{figure*}




% qualitative discussion
Figure~\ref{fig:examples} displays example
segmentations.
Many of the segmentations have moderate to high accuracy, capturing
correct classes, in correct layout, and sometimes including level of detail
that is usually missing from over-smoothed segmentations obtained by
CRFs or generated by region proposals. But there is tradeoff: despite
the smoothness imposed by higher zoom-out levels, the segmentations we
get do tend to be \emph{under}-smoothed, and in particular include
little ``islands'' of often irrelevant categories. To some extent this
might be alleviated by post-processing; we found that we could learn a
classifier for isolated regions that with reasonable accuracy decides
when these must be ``flipped'' to the surrounding label, and this
improves results on {\tt val} by about 0.5\%, while making the segmentations
more visually pleasing. We do not pursue this ad-hoc approach, and
instead discuss in Section~\ref{sec:conclusions} more principled
remedies that should be investigated in the future.



\subsection{Results on Stanford Background Dataset}
For some of the closely related recent work results on VOC are not
available, so to allow for empirical comparison, we also ran an
experiment on Stanford Background Dataset (SBD). It has 715 images of
outdoor scenes, with
dense labels for eight categories. We applied the same zoom-out
architecture to this dataset as to VOC, with two exceptions: (i) the
local convnet produced 8 features instead of 21+2, and (ii) the
classifier was smaller, with only 128 hidden units, since SBD has about 20 times fewer examples
than VOC and thus could not support training larger models.


There is no standard train/test partition of SBD; the established
protocol calls for reporting 5-fold cross validation results. There is
also no single performance measure; two commonly reported measures are
per-pixel accuracy and average class accuracy (the latter is
different from the VOC measure in that it does not directly penalize false positives).

\begin{table}[!th]
  \centering
{\small
  \begin{tabular}{|l||l|l|}
    \hline
Method & pixel accuracy & class accuracy\\
\hline
zoom-out (ours) & {\bf 82.1} & {\bf 77.3}\\
\hline
Multiscale convnet~\cite{farabet2013learning} & 81.4 & 76.0\\
Recurrent CNN~\cite{pinheiro2014recurrent} & 80.2 & 69.9\\
Pylon~\cite{lempitsky2011pylon} & 81.9 & 72.4 \\
Recursive NN~\cite{socher2011parsing}& 78.1 & -- \\
Multilevel~\cite{mostajabi2014robust} & 78.4 & --\\
\hline
  \end{tabular}
  \caption{Results on Stanford Background Dataset}
  \label{tab:sbd}}
\end{table}

The resuls in Table~\ref{tab:sbd} show that the zoom-out architecture
obtains results better than those in~\cite{pinheiro2014recurrent}
and~\cite{farabet2013learning}, both in class accuracy and in pixel
accuracy.


fig2.tex
\begin{figure*}[!tb]
% \centering
\begin{minipage}{.2\textwidth}
%\hspace{-4em}
\begin{tabular}{>{\hspace{-2em}}c>{\hspace{-2em}}c>{\hspace{-2em}}c>{\hspace{-2em}}c}
    \begin{tabular}{c}
        \includegraphics[width=\textwidth]{figs/fig2/2007_001311.png}\\
    \begin{tabular}{ccc}
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N0_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N2_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N3_1.png} \\
        \includegraphics[width=.24\textwidth]{figs/fig2/2007_001311_N0_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N2_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N3_2.png} \\
        \includegraphics[width=.18\textwidth]{figs/fig2/2007_001311_N0_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N2_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001311_N3_3.png}
    \end{tabular}
    \end{tabular} &
    \begin{tabular}{c}
    \includegraphics[width=.78\textwidth]{figs/fig2/2007_001586.png}\\
    \begin{tabular}{ccc}
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N0_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N2_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N3_1.png} \\
        \includegraphics[width=.24\textwidth]{figs/fig2/2007_001586_N0_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N2_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N3_2.png} \\
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N0_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N2_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_001586_N3_3.png}
    \end{tabular}
    \end{tabular} &
    \begin{tabular}{c}
    \includegraphics[width=.78\textwidth]{figs/fig2/2007_000123.png}\\
    \begin{tabular}{ccc}
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N0_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N2_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N3_1.png} \\
        \includegraphics[width=.24\textwidth]{figs/fig2/2007_000123_N0_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N2_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N3_2.png} \\
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N0_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N2_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000123_N3_3.png}
    \end{tabular}
    \end{tabular} &
\begin{tabular}{c}
    \includegraphics[width=.78\textwidth]{figs/fig2/2007_000762.png}\\
    \begin{tabular}{ccc}
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N0_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N2_1.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N3_1.png} \\
        \includegraphics[width=.24\textwidth]{figs/fig2/2007_000762_N0_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N2_2.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N3_2.png} \\
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N0_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N2_3.png} &
        \includegraphics[width=.3\textwidth]{figs/fig2/2007_000762_N3_3.png}
    \end{tabular}
    \end{tabular} 
\end{tabular}
\end{minipage}
    \caption{Showing three superpixels in each image (top), followed
      by corresponding zoom-out regions that are seen by the
      segmenation process, (left) superpixel, (center) proximal
      region, (right) distant. As we zoom in from image to
      the superpixel level, it becomes increasingly hard to tell what
      we are looking at, however the higher zoom-out levels provide
      rich contextual information.}
 \label{fig:region-examples}
\end{figure*}

intro.tex
\section{Introduction}
We consider one of the central vision tasks, \emph{semantic
  segmentation}: assigning to each
pixel in an image a category-level label. Despite attention it has
received, it remains challenging, largely due to complex
interactions between neighboring as well as distant image elements,
the importance of global context, and the interplay between semantic
labeling and instance-level detection.
A widely accepted conventional wisdom, followed in much of
modern segmentation literature, is that 
segmentation should be treated as a structured prediction task, which most
often means using a random field or structured support vector machine
model of considerable complexity.

This in turn brings up severe challenges, among them the intractable
nature of inference and learning in many ``interesting'' models. To alleviate this,
many recently proposed methods rely on a pre-processing
stage, or a few stages, to produce a manageable number of hypothesized
regions, or even complete segmentations, for an image. These are then
scored, ranked or combined in a variety of ways.


\input{mainfig}

Here we consider a departure from these conventions, and approach semantic
segmentation as a single-stage classification task, in which each
image element (superpixel) is labeled by a feedforward model, based on evidence
computed from the image. Surprisingly, in experiments on PASCAL VOC 2012
segmentation benchmark we show that this simple sounding approach
leads to results significantly surpassing all previously published
ones, advancing the current state of the
art from about 52\% to 64.4\%.

The ``secret'' behind our method is that the evidence used in the
feedforward classification is not computed from a small local region
in isolation, but collected from a sequence of levels, obtained by
``zooming out'' from the close-up view of the superpixel. Starting from the superpixel itself, to a small region surrounding it,
to a larger region around it and all the way to the entire image, we
compute a rich feature representation at each level and combine all
the features before feeding them to a classifier. This allows us to
exploit statistical structure in the label space and dependencies
between image elements at different resolutions without explicitly
encoding these in a complex model.

We should emphasize that we do not mean to dismiss structured
prediction or inference, and as we discuss in
Section~\ref{sec:conclusions}, these tools may be complementary to our
architecture. In this paper we explore how far we can go
without resorting to explicitly structured models.

We use convolutional neural networks (convnets) to extract features from
larger zoom-out regions. Convnets, (re)introduced
to vision in 2012, have facilitated a dramatic advance in classification,
detection, fine-grained recognition and other vision tasks. Segmentation has remained conspicuously left out from this wave of
progress; while image classification and detection accuracies on
VOC have improved by nearly 50\% (relative), segmentation numbers have
improved only modestly. A big reason for this is that neural networks
are inherently geared for ``non-structured'' classification and
regression, and it is still not clear how they can be harnessed in a
structured prediction framework. In this work we propose a way to
leverage the power of representations learned by convnets, by framing
segmentation as classification and making the structured aspect of it
implicit. 
Last but not least, we show that use of
multi-layer neural network trained with asymmetric loss to
classify superpixels represented by zoom-out features, leads
to significant improvement in segmentation accuracy over simpler
models and conventional (symmetric) loss.



Below we give a high-level description of our method, then discuss
related work and position our work in its context. Most of the
technical details are deferred to Section~\ref{sec:exp} in which we
describe implementation and report on results, before concluding in Section~\ref{sec:conclusions}.

mainfig.tex
\begin{figure}[!th]
\centering
  \begin{tikzpicture}
% note: need to set the size of the image box to size of im in pixels
% divided by 100, in cm
    \node[rectangle,draw=black,thick,fill overzoom
    image=figs/2007_003143.jpg,minimum width=5cm,minimum height=2.92cm,opacity=.5] (image) {};

    \draw[name path=superpixel,red,line width=1.25pt] plot[smooth] file {figs/2007_003143_s252_n0.txt};
    %manual coord
    \coordinate (suppixcenter) at (-.82,-.14);

    \draw[name path=n2,cyan,line width=1.25pt] plot file
    {figs/2007_003143_s252_n2.txt};
    % manual: a point within n2
    \coordinate (n2pt) at (-.55,-.03);
    
    % manual coord of N3 window
    \coordinate (n3bl) at (-1.81,-.81);
    \coordinate (n3tr) at (-.04,.54);
    \node[draw,orange,line width=1.25pt,inner sep=0pt,fit=(n3bl) (n3tr)] (n3) {};
    \node[draw,very thick,black!20!green,fit=(image),inner sep=0.5pt] (global) {};
    
    \node[draw,black,above=of global.north west,anchor=west]
    (dcnn-global) {convnet};
    \node[draw,black!20!green,above=of dcnn-global.north
    west,anchor=west,minimum height=5.5mm,minimum width=1.7cm,very thick]
    (fglobal) {global};
    \draw[black!20!green,-latex,very thick] ($(global.130)-(.5,0)$) -- (dcnn-global.south);
    \draw[black!20!green,-latex,very thick] (dcnn-global.north) --
    (fglobal.south);

    \node[draw,black,right=of dcnn-global.east,right=3mm,anchor=west]
    (dcnn-n3) {convnet};
    \node[draw,orange,right=of
    fglobal.east,anchor=west,right=0pt,minimum height=5.5mm,minimum
    width=1.7cm,very thick]
    (fn3) {distant};
    \draw[orange,-latex,very thick] (n3.north) -- (dcnn-n3.south);
    \draw[orange,-latex,very thick] (dcnn-n3.north) -- (fn3);
    (fglobal.south);    
    
    
    \node[draw,cyan,right=of
    fn3.east,anchor=west,right=0pt,minimum height=5.5mm,minimum
    width=1.2cm,very thick]
    (fn2) {proximal};
    \path[name path=n2line] (suppixcenter) -- (image.north
    east);
    \draw[-latex,cyan,very thick] (n2pt) to[out=0,in=-90] (fn2.south);

    \node[draw,red,right=of
    fn2.east,anchor=west,right=0pt,minimum height=5.5mm,minimum
    width=1.2cm,very thick]
    (flocal) {local};
    \draw[-latex,red,very thick] (suppixcenter) to[out=0,in=-90]  (flocal.south);

    \node[fit=(fglobal) (flocal)] (allfeat) {};
    \node[draw,black,very thick,above=of allfeat.north,anchor=south,above=10pt]
    (hidden) {fully connected layer(s)};
    \draw[black!20!green,-latex,very thick] (fglobal) -- (hidden);
    \draw[orange,-latex,very thick] (fn3) -- (hidden);
    \draw[-latex,cyan,very thick] (fn2) -- (hidden);
    \draw[-latex,red,very thick] (flocal.north) -- (hidden);
    \node[draw,black,very thick,above=of hidden.north,anchor=south,above=10pt]
    (softmax) {softmax layer};
    \draw[black,very thick,-latex] (hidden) -- (softmax);
    \draw[black,very thick,-latex] (softmax) -- ++(0,.8) node[left,midway] {``car''};

  \end{tikzpicture}
  \caption{Our feedforward segmentation process. The feature vector for a
    superpixel consists of components extracted at
  zoom-out spatial levels: locally at a superpixel (red), in a small
  proximal neighborhood
  (cyan), in a larger distant neighborhood (orange), and globally from the
  entire image (green). The concatenated feature vector is fed to a
  multi-layer neural network that classifies the superpixel.}\label{fig:main}
\end{figure}

method.tex
\section{Zoom-out feature fusion}\label{sec:method}
We cast category-level segmentation of an image as classifying a set
of superpixels. Since we expect to apply the same classification
machine to every superpixel, we would like the nature of the superpixels
to be similar, in particular their size. In our experiments we use
SLIC~\cite{achanta_pami12}, but other methods that produce
nearly-uniform grid of superpixels might work similarly
well. Figures~\ref{fig:regions} and~\ref{fig:region-examples} provide a few illustrative examples
for this discussion.

\begin{figure*}[!th]
  \centering
  \begin{tabular}{ccc}
  \includegraphics[height=1.8in]{figs/2007_002728_zo_218_277_269} &
  \includegraphics[height=1.8in]{figs/2010_001557_zo_248_362_86} &
  \includegraphics[height=1.8in]{figs/2007_001585_zo_193_166_303}
  \end{tabular}

  \caption{Examples of zoom-out regions: red for
    \textcolor{red}{superpixel}, cyan for \textcolor{cyan}{proximal}
    region, solid orange for \textcolor{orange}{distant} region;
    curved orange line shows the extent of the radius-3 neighborhood
    on which the distant region is based. The
    \textcolor{black!20!green}{global} region is always the entire
    image. The image on the left shows superpixel boundaries in black;
  these are typical. Distant regions tend to enclose large
  portions of objects. Proximal regions are more likely to include moderate
  portions of objects, and both often include surrounding
  objects/background as well.}
  \label{fig:regions}
\end{figure*}






\subsection{Scoping the zoom-out features}

The main idea of our zoom-out architecture is to allow features
extracted from different levels of spatial context around the
superpixel to contribute to labeling decision at that superpixel. To
this end we define four levels of spatial extent. For each of these we
discuss the role we intend it to play in the eventual classification
process, and in particular focus on the expected relationships between the features
at each level computed for different superpixels in a given image. We
also briefly comment on the kind of features that we may want to
compute at each level.

\subsubsection{Local zoom (close-up)} The narrowest scope is the superpixel itself. We
expect the features extracted here to capture local evidence for or
against a particular labeling: color, texture, presence of small
intensity/gradient patterns, and other properties computed over a
relatively small contiguous set of pixels, could all contribute at this level. The
local features may be quite different even for neighboring
superpixels, especially if these straddle category or object boundaries.

\subsubsection{Proximal zoom} The next scope is a region that surrounds the
superpixel, perhaps an order of magnitude larger in area. We expect
similar kinds of visual properties to be informative as with the local features,
but computed over larger proximal regions, these may have different statistics, for instance, we can expect various histograms (e.g., color) to be
less sparse. Proximal features may capture
information not available in the local scope; e.g., for locations at the
boundaries of objects they will represent the appearance of both
categories. For classes with non-uniform appearance they may better
capture characteristic distributions for that class. This scope is
usually 
still too myopic to allow us to reason confidently about presence of objects.

Two neighboring
superpixels could still have quite different proximal features,
however some degree of smoothness is likely to arise from the
significant overlap between neigbhors' proximal regions.
As an example,
consider color features over the body of a leopard; superpixels for individual dark brown spots might
appear quite different from their neighbors (yellow fur) but their
proximal regions will have pretty similar distributions (mix of yellow
and brown).
Superpixels that are sufficiently far from each other could still, of
course, have drastically different proximal features. 

\input{fig2}

\subsubsection{Distant zoom} Zooming out further, we move to the distant level:
a region large enough to include sizeable fractions of objects, and
sometimes entire objects. At this level our scope is wide enough to
allow reasoning about shape, presence of more complex patterns in color and
gradient, and the spatial layout of such patterns. Therefore we can expect
more complex features that represent these properties to be useful here.
Distant regions are more
likely to straddle true boundaries in the image, and so this
higher-level feature extraction may include a significant area in both
the category of the superpixel at hand and nearby categories. For
example, consider a person sitting on a chair; bottle on a dining
table; pasture animals on the background of grass, etc. Naturally we
expect this to provide useful information on both the appearance of a
class and its context.

For neighboring superpixels, distant regions will have a very large
overlap; superpixels which are one superpixel apart will have
significant, but lesser, overlap in their distant regions; etc., all
the way to superpixels that are sufficiently far apart that the
distant regions do not overlap and thus are independent given the scene. This
overlap in the regions is likely to lead to somewhat gradual changes
in features, and to impose an entire network of implicit smoothness
``terms'', which depend both on the distance in the image and on the
similarity in appearance in and around superpixels. Imposing
such smoothness in a CRF usually leads to
a very complex, intractable model.


\subsubsection{Global zoom} The final zoom-out scope is the entire scene. Features computed at this level capture ``what
kind of an image'' we are looking at. One aspect of this global
context is image-level classification: since state of the art in image
classification seems to be dramatically higher than that of detection
or segmentation~\cite{everingham2014pascal,russakovsky2014imagenet}
\begin{comment}
\footnote{On Pascal VOC2012, the top 
  numbers known at the time of writing~\cite{everingham2014pascal} are 51.6 accuracy for segmentation, 63.8 mAP for
  detection, and 90.3 mAP for classification; on ImageNet~\cite{russakovsky2014imagenet}, the winning
  numbers in most recent competition were 37.2 mAP for detection and
  92.6 mAP for classification. While measures across tasks are not
  directly comparable, thes numbers give a clear picture of the
  relative difficulty of the tasks for modern methods.}
\end{comment}
 we can expect
image-level features to help determine presence of categories in the
scene and thus guide the segmentation.
%, for instance ``squashing''
%strong local evidence for a category that appears improbable given the
%scene. 

More subtly, features that are useful for classification can be
directly useful for global support of local labeling decisions; e.g.,
lots of green in an image supports labeling a (non-green) superpixel
as cow or sheep more than it supports labeling that superpixel as
chair or bottle, other things being equal. On the other hand, lots of
straight vertical lines in an image would perhaps suggest man-made
environment, thus supporting categories relevant to indoors or urban
scenes more than, say, wildlife. 


At this global level, all superpixels in an image will of course have the same
features, imposing (implicit, soft) global constraints. This is yet another form
of high-order interaction that is hard to capture in
a CRF framework, despite numerous attempts~\cite{boix_ijcv12}.



\subsection{Learning to label with asymmetric loss}
Once we have computed the zoom-out features we simply concatenate them
into a feature vector representing a superpixel. For superpixel $s$ in
image $\mathcal{I}$, we will denote this feature vector as
\begin{equation}
\bfgreek{phi}_{\text{zoom-out}}(s,\mathcal{I})\,=\,
\begin{bmatrix}
\bfgreekco{phi}{red}_{\textcolor{red}{loc}}(s,\mathcal{I})\\
\bfgreekco{phi}{cyan}_{\textcolor{cyan}{prox}}(s,\mathcal{I})\\
\bfgreekco{phi}{orange}_{\textcolor{orange}{dist}}(s,\mathcal{I})\\
\bfgreekco{phi}{black!20!green}_{\textcolor{black!20!green}{glob}}(\mathcal{I})
\end{bmatrix}
\end{equation}
For the training data, we will associate a single category label $y_s$
with
each superpixel $s$. This decision carries some risk, since in any non-trivial
over-segmentation some of the superpixels will not be perfectly
aligned with ground truth boundaries. In section~\ref{sec:exp} we
evaluate this risk empirically for our choice of superpixel settings
and confirm that it is indeed minimal.

Now we are ready to train a classifier that maps $s$ in image
$\mathcal{I}$ to $y_s$ based on $\bfgreek{phi}_{\text{zoom-out}}$;
this requires choosing the empirical loss function to be minimized,
subject to regularization.
In semantic
segmentation settings, a factor that must impact this choice is the highly imbalanced nature of the labels. Some categories are
much more common than others, but our goal (encouraged by the
way benchmark like VOC evaluate segmentations) is to predict them
equally well. It is well known that training on imbalanced data
without taking precautions can lead to
poor
results~\cite{farabet2013learning,pinheiro2014recurrent,lempitsky2011pylon}. A
common way to deal with this is to stratify the
training data; in practice this means that we throw away a large
fraction of the data corresponding to the more common
classes. We follow an alternative which we find less wasteful, and
which in our experience often produces dramatically better results:
use all the data, but change the loss. There has been some work on
loss design for learning segmentation~\cite{tarlow2012structured}, but
the simple weighted loss we describe below has to our knowledge been missed in
segmentation literature, with the exception
of~\cite{kuettel2012segmentation} and~\cite{lempitsky2011pylon}, where
it was used for binary segmentation.

Let the frequency of class $c$ in the
training data be
$f_c$, with $\sum_cf_c=1$. Suppose our choice of loss is log-loss; we
modify it to be
\begin{equation}
  \label{eq:asymloss}
  -\frac{1}{N}\sum_{i=1}^N\frac{1}{f_{y_i}}\log \widehat{p}\left(y_i|\bfgreek{phi}(s_i,\mathcal{I}_i)\right),
\end{equation}
where $\widehat{p}\left(y_i|\bfgreek{phi}(s_i,\mathcal{I}_i)\right)$
is the estimated probability of the correct label for segment $s_i$ in
image $\mathcal{I}_i$, according to our model. In other words, we scale the loss by the inverse frequency of
each class, effectively giving each pixel of less frequent classes
more importance. This modification does not change loss convexity, and
only requires minor changes in the optimization code, e.g., back-propagation.



related.tex
\section{Related work}\label{sec:related}

The literature on segmentation is vast, and here we only mention work
that is either significant as having achieved state of the art
performance in recent times, or is closely related to ours in some
way. In Section~\ref{sec:exp} we compare our performance to
that of most of the methods mentioned here.

Many prominent segmentation methods rely on conditional random fields (CRF) over nodes
corresponding to pixels or superpixels.
Such models incorporate local evidence in unary potentials, while
interactions between label assignments are captured by pairwise and
possibly higher-order potentials. This includes various hierarchical CRFs~\cite{shotton_ijcv09,ladicky_iccv09,lempitsky2011pylon,boix_ijcv12}. In
contrast, we let the zoom-out features (in CRF terminology, the unary potentials) to capture higher-order structure.

Another recent trend has been to follow a multi-stage
approach: First a set of proposal regions is generated, by a
category-independent~\cite{carreira2012cpmc,UijlingsIJCV2013} or
category-aware~\cite{arbelaez_cvpr12} mechanism.
Then the regions are scored or ranked based on their compatibility
with the target classes. Work in
this vein
includes~\cite{carreira2012semantic,ion2011probabilistic,arbelaez_cvpr12,carreira_ijcv12,Li2013codemaps}.
A similar approach is taken
in~\cite{yadollahpour2013discriminative}, where multiple segmentations
obtained from~\cite{carreira2012semantic}
are re-ranked using a discriminatively trained model.
Recent advances along these lines include~\cite{hariharan2014simultaneous}, which
uses convnets
and~\cite{dhruv-new}, which improves upon the re-ranking
in~\cite{yadollahpour2013discriminative}, also using
convnet-based features. At submission time, these two lines of work are
roughly tied for the previous state of the art\footnote{before this work and
concurrent efforts, all relying on multi-level features},
with mean accuracy of 51.6\% and 52.2\%, respectively, on VOC 2012 test.
In contrast to most of the work in this group, we do not rely on
region generators, and limit preprocessing to
over-segmentation of the image into a large number of superpixels. 

A body of work examined the role of
context and the importance of non-local evidence in segmentation. The
idea of computing features over a neighborhood of superpixels for
segmentation purposes was
introduced in~\cite{fulkerson2009class} and~\cite{lim2009context};
other early work on using forms of context for segmentation
includes~\cite{shotton_ijcv09}. 
A study in~\cite{lucchi2011spatial} concluded that non-unary terms may be unnecessary when neighborhood and global
information is captured by unary terms, but the results were
significantly inferior to state of the art at the time. 

Recent work closest to ours
includes~\cite{farabet2013learning,pinheiro2014recurrent,socher2011parsing,mostajabi2014robust,huang2013deep}. 
In~\cite{farabet2013learning}, the same convnet is applied on
different resolutions of the image and
combined with a tree-structured graph over superpixels to impose
smoothness. In~\cite{mostajabi2014robust} the features applied to
multiple levels (roughly analogous to our local+proximal+global) are
also same, and hand-crafted instead of using convnets. In~\cite{pinheiro2014recurrent} there is also a single
convnet, but it is applied in a recurrent fashion, i.e., input to the
network includes, in addition to the scaled image, the feature maps
computed by the network at a previous level. A similar idea is pursued
in~\cite{huang2013deep}, where it is applied to boundary detection in
3D biological data. In contrast with all of these, we use different
feature extractors across levels, some of them with a much smaller
receptive field than any of the networks in the
literature. We show in
Section~\ref{sec:exp} that our approach obtains better performance (on
Stanford Background Dataset) than that reported
for~\cite{farabet2013learning,pinheiro2014recurrent,socher2011parsing,mostajabi2014robust};
no comparison to~\cite{huang2013deep} is available.

Finally, two pieces of concurrent work share some key ideas with our
work, and we discuss these in some detail
here. In~\cite{long2014fully}, achieving 62.2\% mean accuracy on VOC
2012 test, a 16-layer convnet is applied to
an image at a coarse grid of locations. Predictions
based on the final layer of the network are upsampled and summed with predictions made from
intermediate layers of the network. Since units in lower layers are associated with
smaller receptive field than those in the final layer, this mechanism
provides fusion of information across spatial levels, much like our
zoom-out features. The architecture in~\cite{long2014fully} is more
efficient than our current implementation since it reuses computation
efficiently (via framing the computation of features at multiple
locations as convolution), and since the entire model is trained end-to-end.
However, it relies in a somewhat reduced range of spatial context
compared to our work; using our terminology proposed above, the architecture in~\cite{long2014fully}
roughly analogous to combining our
proximal and distant zoom-out levels, along with another one above
distant, but without the global level\footnote{assuming the original
  image is larger than the net receptive field, which is typically the
  case. In contrast, we zoom out far enough to include the entire
  image, which we resize to the desired receptive field size.}, important to establish the
general scene context, and without the local level, important for precise
localization of boundaries. Also, we choose to ``fuse'' not the
predictions made at different levels, but the rich evidence (features
themselves).  

The other recent work with significant similarities to ours
is~\cite{hariharan2014hypercolumns}, where \emph{hypercolumns} are
formed by pooling evidence extracted from nested regions around a
pixel; these too resemble our zoom-out feature
representations. In contrast with~\cite{long2014fully} and with our
work, the input to the system here consists of a hypothesized
detection bounding box, and not an entire image. The hypercolumn
includes some local information (obtained from the {\tt pool2} layer)
as well as information pooled from regions akin to our proximal as
well as the level that is global relative to the hypothesized bounding
box, but is not global with respect to the entire image. A further
difference from our work is the use of location-specific classifiers
within the bounding box, instead
of the same classifer applied everywhere. This work achieves 59.0\% mean
accuracy on VOC 2012 test. 

tcbbreakable.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbbreakable.code.tex: Code for breakable colorboxes
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{3.04}

\let\tcb@parboxrestore@true=\tcb@parboxrestore
\def\tcb@parboxrestore@false{\vskip-\parskip\linewidth\hsize\noindent}

\def\tcb@vbox#1#2{%
  \edef\reserved@a{%
    \endgroup%
    \setbox#1\vbox{\hsize=#2%
      \begingroup\aftergroup}%
      \def\noexpand\@currenvir{\@currenvir}%
      \def\noexpand\@currenvline{\on@line}}%
  \reserved@a%
  \@endpefalse%
  \color@begingroup%
  \textwidth\hsize%
  \columnwidth\hsize%
  \csname tcb@parboxrestore@\kvtcv@parbox\endcsname%
  \def\@mpfn{mpfootnote}%
  \def\thempfn{\thempfootnote}%
  \c@mpfootnote\z@%
  \let\@footnotetext\@mpfootnotetext%
  \@setminipage\tcb@hyph@fix%
  \ignorespaces%
  \let\tcb@drawcolorbox=\tcb@drawcolorbox@standalone%
  }

\def\endtcb@vbox{%
  \par%
  \unskip%
  \ifvoid\@mpfootins\else%
    \vskip\skip\@mpfootins%
    \normalcolor%
    \footnoterule%
    \unvbox\@mpfootins%
  \fi%
  \@minipagefalse%
  \color@endgroup}

% remaining height
\def\tcb@comp@h@page{%
  \ifx\kvtcb@float\@empty%
    \ifdim\pagegoal=16383.99998pt
      \tcbdimto\tcb@h@page{\textheight-\kvtcb@shrinkbreakgoal}%
    \else
      \tcbdimto\tcb@h@page{\pagegoal-\pagetotal-\pageshrink-\kvtcb@shrinkbreakgoal}%
    \fi%
  \else%
    \tcbdimto\tcb@h@page{\textheight-\kvtcb@shrinkbreakgoal}%
  \fi%
}

\def\tcb@comp@h@total@standalone{%
  \tcbdimto\tcb@h@padding{\kvtcb@bbtop@stand+\kvtcb@bbbottom@stand+\kvtcb@top@rule@stand+\kvtcb@bottom@rule@stand+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom}%
  \tcbdimto\tcb@h@total{\tcb@h@before+\tcb@h@after+\tcb@h@padding+\tcb@h@padtitle+\tcb@h@upper+\tcb@h@segment+\tcb@h@lower}%
}

\def\tcb@following@title{%
  \ifx\kvtcb@followingtitle\@empty%
    \tcb@hasTitlefalse%
    \let\tcb@h@title=\tcb@zpt%
    \let\tcb@h@padtitle=\tcb@zpt%
  \else%
    \tcb@hasTitletrue%
    \tcbdimto\tcb@w@title{\tcb@innerwidth-\kvtcb@boxsep*2-\kvtcb@lefttitle-\kvtcb@righttitle}%
    \begin{tcb@savebox}{\tcb@titlebox}{\tcb@w@title}\color{\kvtcb@coltitle}\kvtcb@fonttitle\kvtcb@followingtitle\end{tcb@savebox}%
    \tcbdimto\tcb@h@title{\ht\tcb@titlebox+\dp\tcb@titlebox}%
    \tcbdimto\tcb@h@padtitle{\kvtcb@title@rule+\kvtcb@boxsep*2+\kvtcb@toptitle+\kvtcb@bottomtitle+\tcb@h@title}%
  \fi%
}

\newbox\tcb@totalupperbox
\newbox\tcb@totallowerbox
\newif\iftcb@break@allowed

\def\tcb@enlbreak@next@final{%
  \ifdim\dimexpr\tcb@enlbreak@dim=0pt\relax
  \else\enlargethispage{\tcb@enlbreak@dim}\fi%
}

\def\tcb@enlbreak@next@scan#1/#2@{%
  \def\temp@a{#2}%
  \tcbdimto\tcb@enlbreak@dim{#1}%
  \ifx\temp@a\@empty%
    \let\tcb@enlbreak@next=\tcb@enlbreak@next@final%
  \else%
     \edef\tcb@enlbreak@seq{\temp@a @}%
  \fi%
  \tcb@enlbreak@next@final%
}

\def\tcb@enlbreak@next@step{%
  \edef\tcb@temp{\noexpand\tcb@enlbreak@next@scan\tcb@enlbreak@seq}%
  \tcb@temp%
}

\def\tcb@enlbreak@init{%
  \edef\tcb@enlbreak@seq{\kvtcb@enlargepage/@}%
  \let\tcb@enlbreak@next=\tcb@enlbreak@next@step%
  \tcb@enlbreak@next%
}

\def\tcb@drawcolorbox@breakable{%
  \ifx\kvtcb@float\@empty%
    {\parskip\z@\par\vskip\z@}\bgroup\@nobreakfalse\addpenalty\z@\egroup% force update vertical list
    \setbox\z@=\vbox{\kvtcb@beforebox}%
    \tcbdimto\tcb@h@before{\ht\z@+\dp\z@+\dimexpr\parskip\relax}%
    \setbox\z@=\vbox{\kvtcb@afterbox}%
    \tcbdimto\tcb@h@after{\ht\z@+\dp\z@}%
    \tcb@break@allowedtrue%
    \tcb@enlbreak@init%
  \else%
    \let\tcb@h@before=\tcb@zpt%
    \let\tcb@h@after=\tcb@zpt%
    \tcb@break@allowedfalse%
  \fi%
  \tcb@split@start%
}

\def\tcb@split@start{%
  \tcb@comp@h@page%
  %
  % height calculation
  \tcb@comp@h@total@standalone%
  %
  \let\tcb@split@next=\relax%
  \ifdim\tcb@h@total<\tcb@h@page\relax% no break
    \tcb@drawcolorbox@standalone%
  \else
    \iftcb@break@allowed%
      \ifdim\dimexpr\tcb@h@page-\tcb@h@before-\tcb@h@padding-\tcb@h@padtitle<\kvtcb@breakminlines\baselineskip\relax%
        \pagebreak\tcb@enlbreak@init\tcb@break@allowedfalse%
        \tcb@comp@h@page%
        \ifdim\tcb@h@total<\tcb@h@page\relax% no break!
          \tcb@drawcolorbox@standalone%
        \else
          \let\tcb@split@next=\tcb@split@first%
        \fi
      \else%
        \let\tcb@split@next=\tcb@split@first%
      \fi
    \else%
      \let\tcb@split@next=\tcb@split@first%
    \fi%
  \fi
  \tcb@split@next%
}


\def\tcb@setbox@upper#1#2{%
  \setbox\tcb@upperbox=\vbox{\color@begingroup\color{\kvtcb@colupper}\unvbox#2\color@endgroup}%
  \ifdim\dimexpr\ht\tcb@upperbox+\dp\tcb@upperbox>#1\relax%
    \setbox\tcb@upperbox=\vbox to\the\dimexpr#1-\dp\tcb@upperbox\relax {\color@begingroup\unvbox\tcb@upperbox\color@endgroup}%
  \fi%
  \tcbdimto\tcb@h@upper{\ht\tcb@upperbox+\dp\tcb@upperbox}%
}

\def\tcb@split@upper@box{%
  \vfuzz=\maxdimen\vbadness=10000%
  \setbox\tcb@upperbox=\vsplit\tcb@totalupperbox to\tcb@split@dim%
  \tcb@setbox@upper{\tcb@split@dim}{\tcb@upperbox}%
  \vbadness=\tcb@thevbadness\vfuzz=\tcb@thevfuzz%
}

\def\tcb@setbox@lower#1#2{%
  \setbox\tcb@lowerbox=\vbox{\color@begingroup\color{\kvtcb@collower}\unvbox#2\color@endgroup}%
  \ifdim\dimexpr\ht\tcb@lowerbox+\dp\tcb@lowerbox>#1\relax%
    \setbox\tcb@lowerbox=\vbox to\the\dimexpr#1-\dp\tcb@lowerbox\relax {\color@begingroup\unvbox\tcb@lowerbox\color@endgroup}%
  \fi%
  \tcbdimto\tcb@h@lower{\ht\tcb@lowerbox+\dp\tcb@lowerbox}%
}

\def\tcb@split@lower@box{%
  \vfuzz=\maxdimen\vbadness=10000%
  \setbox\tcb@lowerbox=\vsplit\tcb@totallowerbox to\tcb@split@dim%
  \tcb@setbox@lower{\tcb@split@dim}{\tcb@lowerbox}%
  \vbadness=\tcb@thevbadness\vfuzz=\tcb@thevfuzz%
}

\def\tcb@split@setstate@first{%
  \edef\tcb@split@state{first}%
  \let\kvtcb@top@rule=\kvtcb@top@rule@stand%
  \let\kvtcb@bottom@rule=\kvtcb@bottom@rule@break%
  \let\kvtcb@bbtop=\kvtcb@bbtop@stand%
  \let\kvtcb@bbbottom=\kvtcb@bbbottom@break%
  \let\tcb@break@topsep=\tcb@zpt%
  \let\tcb@break@bottomsep=\kvtcb@bottomsep%
}

\def\tcb@split@setstate@middle{%
  \edef\tcb@split@state{middle}%
  \let\kvtcb@top@rule=\kvtcb@top@rule@break%
  \let\kvtcb@bottom@rule=\kvtcb@bottom@rule@break%
  \let\kvtcb@bbtop=\kvtcb@bbtop@break%
  \let\kvtcb@bbbottom=\kvtcb@bbbottom@break%
  \let\tcb@break@topsep=\kvtcb@topsep%
  \let\tcb@break@bottomsep=\kvtcb@bottomsep%
}

\def\tcb@split@setstate@last{%
  \edef\tcb@split@state{last}%
  \let\kvtcb@top@rule=\kvtcb@top@rule@break%
  \let\kvtcb@bottom@rule=\kvtcb@bottom@rule@stand%
  \let\kvtcb@bbtop=\kvtcb@bbtop@break%
  \let\kvtcb@bbbottom=\kvtcb@bbbottom@stand%
  \let\tcb@break@topsep=\kvtcb@topsep%
  \let\tcb@break@bottomsep=\tcb@zpt%
}


\def\tcb@split@force@standalone{%
  \tcb@comp@h@total@standalone%
  \ifdim\tcb@h@total>\tcb@h@page%
    \tcbdimto\kvtcb@bbbottom@stand{\kvtcb@bbbottom@stand+\tcb@h@page-\tcb@h@total}%
  \fi%
}


\def\tcb@split@first{%
  \setcounter{tcbbreakpart}{1}%
  \ifx\kvtcb@float\@empty%
    \def\tcb@before@first{\nointerlineskip\kvtcb@beforebox}%
    \def\tcb@before@middle{\nointerlineskip\noindent}%
    \let\tcb@before@last=\tcb@before@middle%
    \long\def\tcb@after@first{\parskip\z@\par\pagebreak\nointerlineskip{\topskip\z@\null}\tcb@enlbreak@next}%
    \let\tcb@after@middle=\tcb@after@first%
    \let\tcb@after@last=\kvtcb@afterbox%
  \else%
    \edef\tcb@before@first{\noexpand\tcb@float@env@begin{tcbfloat}[\kvtcb@float]}%
    \let\tcb@before@middle=\tcb@before@first%
    \let\tcb@before@last=\tcb@before@first%
    \let\tcb@after@first=\tcb@float@env@end%
    \let\tcb@after@middle=\tcb@float@env@end%
    \let\tcb@after@last=\tcb@float@env@end%
  \fi%
  %
  \edef\kvtcb@skin@@first{\kvtcb@skin@first}%
  \edef\kvtcb@skin@@middle{\kvtcb@skin@middle}%
  \edef\kvtcb@skin@@last{\kvtcb@skin@last}%
  %
  \let\tcb@h@breaksep@first=\kvtcb@bottomsep%
  \tcbdimto\tcb@h@breaksep@middle{\kvtcb@bottomsep+\kvtcb@topsep}%
  \let\tcb@h@breaksep@last=\kvtcb@topsep%
  \tcbdimto\tcb@h@padding@first{\kvtcb@bbtop@stand+\kvtcb@bbbottom@break+\kvtcb@top@rule@stand+\kvtcb@bottom@rule@break+\tcb@h@breaksep@first+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom}%
  \tcbdimto\tcb@h@padding@middle{\kvtcb@bbtop@break+\kvtcb@bbbottom@break+\kvtcb@top@rule@break+\kvtcb@bottom@rule@break+\tcb@h@breaksep@middle+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom}%
  \tcbdimto\tcb@h@padding@last{\kvtcb@bbtop@break+\kvtcb@bbbottom@stand+\kvtcb@top@rule@break+\kvtcb@bottom@rule@stand+\tcb@h@breaksep@last+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom}%
  %
  \tcb@split@setstate@first%
  %
  \splittopskip=0pt%
  \splitmaxdepth=0pt%
  \edef\tcb@thevfuzz{\the\vfuzz}%
  \edef\tcb@thevbadness{\the\vbadness}%
  %
  \tcb@swap{\tcb@totalupperbox}{\tcb@upperbox}%
  \tcb@swap{\tcb@totallowerbox}{\tcb@lowerbox}%
  %
  \let\tcb@split@next=\relax%
  \tcbdimto\tcb@split@dim{\tcb@h@page-\tcb@h@before-\tcb@h@padding@first-\tcb@h@padtitle}%
  \ifdim\tcb@split@dim<\tcb@h@upper\relax%
    \tcb@split@upper@box%
    \ifdim\wd\tcb@totalupperbox=0pt\relax%
      \iftcb@lowerspace%
        \tcb@sdraw@U%
        \let\tcb@split@next=\tcb@split@SL%
      \else%
        \tcb@split@force@standalone%
        \tcb@drawcolorbox@standalone%
      \fi%
    \else%
      \ifdim\dimexpr\tcb@h@upper=0pt\relax%
        \iftcb@break@allowed
          \tcb@swap{\tcb@totalupperbox}{\tcb@upperbox}%
          \tcb@swap{\tcb@totallowerbox}{\tcb@lowerbox}%
          \tcbdimto\tcb@h@upper{\ht\tcb@upperbox+\dp\tcb@upperbox}%
          \tcbdimto\tcb@h@lower{\ht\tcb@lowerbox+\dp\tcb@lowerbox}%
          \pagebreak\tcb@enlbreak@init\tcb@break@allowedfalse%
          \let\tcb@split@next=\tcb@split@start%
        \else%
          \tcb@sdraw@U%
          \let\tcb@split@next=\tcb@split@USL%
        \fi%
      \else%
        \tcb@sdraw@U%
        \let\tcb@split@next=\tcb@split@USL%
      \fi%
    \fi%
  \else%
    \tcb@swap{\tcb@totalupperbox}{\tcb@upperbox}%
    \tcbdimto\tcb@split@dim{\tcb@split@dim-\tcb@h@upper-\tcb@h@segment}
    \ifdim\tcb@split@dim<\kvtcb@breakminlines\baselineskip\relax%
      \tcb@sdraw@U%
      \iftcb@lowerspace%
      \let\tcb@split@next=\tcb@split@SL%
      \else%
      \let\tcb@split@next=\tcb@split@USL%
      \fi%
    \else
      \tcb@split@lower@box%
      \ifdim\wd\tcb@totallowerbox=0pt\relax%
        \tcb@split@force@standalone%
        \tcb@drawcolorbox@standalone%
      \else%
        \tcb@sdraw@USL%
        \let\tcb@split@next=\tcb@split@L%
      \fi%
    \fi%
  \fi%
  \tcb@split@next%
}


\def\tcb@split@force@last{%
  \tcb@split@setstate@last%
  \ifdim\tcb@h@total>\tcb@h@page%
    \tcbdimto\kvtcb@bbbottom{\kvtcb@bbbottom+\tcb@h@page-\tcb@h@total}%
  \fi%
}


\def\tcb@split@USL{%
  \stepcounter{tcbbreakpart}%
  \tcb@following@title%
  \tcb@comp@h@page%
  \tcbdimto\tcb@h@upper{\ht\tcb@totalupperbox+\dp\tcb@totalupperbox}%
  \tcbdimto\tcb@h@total{\tcb@h@after+\tcb@h@padding@last+\tcb@h@padtitle+\tcb@h@upper+\tcb@h@segment+\tcb@h@lower}%
  %
  \let\tcb@split@next=\relax%
  \ifdim\tcb@h@total<\tcb@h@page\relax% no break
    \tcb@split@setstate@last%
    \tcb@setbox@upper{\tcb@h@upper}{\tcb@totalupperbox}%
    \iftcb@lowerspace%
      \tcb@setbox@lower{\tcb@h@lower}{\tcb@totallowerbox}%
      \tcb@sdraw@USL%
    \else
      \tcb@sdraw@U%
    \fi%
  \else
    \tcb@split@setstate@middle%
    \tcbdimto\tcb@split@dim{\tcb@h@page-\tcb@h@padding@middle-\tcb@h@padtitle}%
    \ifdim\tcb@split@dim<\tcb@h@upper\relax%
      \tcb@split@upper@box%
      \ifdim\wd\tcb@totalupperbox=0pt\relax%
        \iftcb@lowerspace%
          \tcb@sdraw@U%
          \let\tcb@split@next=\tcb@split@SL%
        \else%
          \tcb@split@force@last%
          \tcb@sdraw@U%
        \fi%
      \else%
        \tcb@sdraw@U%
        \let\tcb@split@next=\tcb@split@USL%
      \fi%
    \else%
      \tcb@setbox@upper{\tcb@h@upper}{\tcb@totalupperbox}%
      \iftcb@lowerspace%
        \tcbdimto\tcb@split@dim{\tcb@split@dim-\tcb@h@upper-\tcb@h@segment}
        \ifdim\tcb@split@dim<\kvtcb@breakminlines\baselineskip\relax%
          \tcb@sdraw@U%
          \let\tcb@split@next=\tcb@split@SL%
        \else
          \tcb@split@lower@box%
          \ifdim\wd\tcb@totallowerbox=0pt\relax%
            \tcb@split@force@last%
            \tcb@sdraw@USL%
          \else%
            \tcb@sdraw@USL%
            \let\tcb@split@next=\tcb@split@L%
          \fi%
        \fi%
      \else%
        \tcb@split@force@last%
        \tcb@sdraw@U%
      \fi%
    \fi%
  \fi%
  \tcb@split@next%
}


\def\tcb@split@SL{%
  \stepcounter{tcbbreakpart}%
  \tcb@following@title%
  \tcb@comp@h@page%
  \let\tcb@h@upper=\tcb@zpt%
  \tcbdimto\tcb@h@lower{\ht\tcb@totallowerbox+\dp\tcb@totallowerbox}%
  \tcbdimto\tcb@h@total{\tcb@h@after+\tcb@h@padding@last-\kvtcb@top-\kvtcb@boxsep+\tcb@h@padtitle+\tcb@h@segment+\tcb@h@lower}%
  %
  \let\tcb@split@next=\relax%
  \ifdim\tcb@h@total<\tcb@h@page\relax% no break
    \tcb@split@setstate@last%
    \tcb@setbox@lower{\tcb@h@lower}{\tcb@totallowerbox}%
    \tcb@sdraw@SL%
  \else
    \tcb@split@setstate@middle%
    \tcbdimto\tcb@split@dim{\tcb@h@page-\tcb@h@padding@middle+\kvtcb@top+\kvtcb@boxsep-\tcb@h@padtitle-\tcb@h@segment}%
    \tcb@split@lower@box%
    \ifdim\wd\tcb@totallowerbox=0pt\relax%
      \tcb@split@force@last%
      \tcb@sdraw@SL%
    \else
      \tcb@sdraw@SL%
      \let\tcb@split@next=\tcb@split@L%
    \fi%
  \fi%
  \tcb@split@next%
}


\def\tcb@split@L{%
  \stepcounter{tcbbreakpart}%
  \tcb@following@title%
  \tcb@comp@h@page%
  \let\tcb@h@upper=\tcb@zpt%
  \tcbdimto\tcb@h@lower{\ht\tcb@totallowerbox+\dp\tcb@totallowerbox}%
  \tcbdimto\tcb@h@total{\tcb@h@after+\tcb@h@padding@last+\tcb@h@padtitle+\tcb@h@lower}%
  %
  \let\tcb@split@next=\relax%
  \ifdim\tcb@h@total<\tcb@h@page\relax% no break
    \tcb@split@setstate@last%
    \tcb@setbox@lower{\tcb@h@lower}{\tcb@totallowerbox}%
    \tcb@sdraw@L%
  \else
    \tcb@split@setstate@middle%
    \tcbdimto\tcb@split@dim{\tcb@h@page-\tcb@h@padding@middle-\tcb@h@padtitle}%
    \tcb@split@lower@box%
    \ifdim\wd\tcb@totallowerbox=0pt\relax%
      \tcb@split@force@last%
      \tcb@sdraw@L%
    \else
      \tcb@sdraw@L%
      \let\tcb@split@next=\tcb@split@L%
    \fi%
  \fi%
  \tcb@split@next%
}


\def\tcb@sdraw@USL{%
  \tcbset{skin=\csname kvtcb@skin@@\tcb@split@state\endcsname}\tcb@afteroptions@hook%
  \def\tcb@segment@state{1}%
  \tcbdimto\tcb@natheight{\tcb@h@padtitle+\kvtcb@top@rule+\kvtcb@bottom@rule+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom+\tcb@h@upper+\tcb@h@segment+\tcb@h@lower+\csname tcb@h@breaksep@\tcb@split@state\endcsname}%
  \tcb@ch@natural%
  \tcbdimto\tcb@innerheight{\tcb@height-\kvtcb@top@rule-\kvtcb@bottom@rule-\tcb@h@padtitle}%
  \tcb@drawing@env@begin%
    \tcb@extensions@preframe%
     % draw frame and interior
    \tcb@adraw@frame%
    \tcb@adraw@interior%
    \iftcb@lowerseparated%
      \tcb@segmentation@code%
    \fi%
    \tcb@adraw@title%
    \tcb@extensions@postframe%
    % draw text boxes
    \tcb@tdraw@title%
    \tcb@tdraw@upper%
    \tcb@tdraw@lower%
    \tcb@extensions@final%
  \tcb@drawing@env@end%
}


\def\tcb@sdraw@U{%
  \tcbset{skin=\csname kvtcb@skin@@\tcb@split@state\endcsname}\tcb@afteroptions@hook%
  \def\tcb@segment@state{0}%
  \tcbdimto\tcb@natheight{\tcb@h@padtitle+\kvtcb@top@rule+\kvtcb@bottom@rule+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom+\tcb@h@upper+\csname tcb@h@breaksep@\tcb@split@state\endcsname}%
  \tcb@ch@natural%
  \tcbdimto\tcb@innerheight{\tcb@height-\kvtcb@top@rule-\kvtcb@bottom@rule-\tcb@h@padtitle}%
  \tcb@drawing@env@begin%
    \tcb@extensions@preframe%
    % draw frame and interior
    \tcb@adraw@frame%
    \tcb@adraw@interior%
    \tcb@adraw@title%
    \tcb@extensions@postframe%
    % draw text boxes
    \tcb@tdraw@title%
    \tcb@tdraw@upper%
    \tcb@extensions@final%
  \tcb@drawing@env@end%
}


\def\tcb@sdraw@SL{%
  \tcbset{skin=\csname kvtcb@skin@@\tcb@split@state\endcsname}\tcb@afteroptions@hook%
  \def\tcb@segment@state{1}%
  \tcbdimto\tcb@natheight{\tcb@h@padtitle+\kvtcb@top@rule+\kvtcb@bottom@rule+\kvtcb@bottom+\kvtcb@boxsep+\tcb@h@segment+\tcb@h@lower+\csname tcb@h@breaksep@\tcb@split@state\endcsname}%
  \tcb@ch@natural%
  \tcbdimto\tcb@innerheight{\tcb@height-\kvtcb@top@rule-\kvtcb@bottom@rule-\tcb@h@padtitle}%
  \tcb@drawing@env@begin%
    \tcb@extensions@preframe%
    % draw frame and interior
    \tcb@adraw@frame%
    \tcb@adraw@interior%
    \iftcb@lowerseparated%
      \tcb@segmentation@code%
    \fi%
    \tcb@adraw@title%
    \tcb@extensions@postframe%
    % draw text boxes
    \tcb@tdraw@title%
    \tcb@tdraw@lower%
    \tcb@extensions@final%
  \tcb@drawing@env@end%
}


\def\tcb@sdraw@L{%
  \tcbset{skin=\csname kvtcb@skin@@\tcb@split@state\endcsname}\tcb@afteroptions@hook%
  \def\tcb@segment@state{2}%
  \tcbdimto\tcb@natheight{\tcb@h@padtitle+\kvtcb@top@rule+\kvtcb@bottom@rule+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom+\ht\tcb@lowerbox+\dp\tcb@lowerbox+\csname tcb@h@breaksep@\tcb@split@state\endcsname}%
  \tcb@ch@natural%
  \tcbdimto\tcb@innerheight{\tcb@height-\kvtcb@top@rule-\kvtcb@bottom@rule-\tcb@h@padtitle}%
  \tcb@drawing@env@begin%
    \tcb@extensions@preframe%
    % draw frame and interior
    \tcb@adraw@frame%
    \tcb@adraw@interior%
    \tcb@adraw@title%
    \tcb@extensions@postframe%
    % draw text boxes
    \tcb@tdraw@title%
    \tcb@tdraw@lower%
    \tcb@extensions@final%
  \tcb@drawing@env@end%
}



\tcbset{%
  breakable@true/.code={%
    \let\tcb@savebox=\tcb@vbox%
    \let\endtcb@savebox=\endtcb@vbox%
    \let\tcb@drawcolorbox=\tcb@drawcolorbox@breakable},
  breakable/.style={breakable@#1},
  breakable/.default=true,%
  unbreakable/.style={breakable=false},%
  title after break/.store in=\kvtcb@followingtitle,%
  notitle after break/.style={title after break=},%
  adjusted title after break/.style={title after break={#1\vphantom{\kvtcb@adjusttext}}},%
  lines before break/.store in=\kvtcb@breakminlines,%
  shrink break goal/.store in=\kvtcb@shrinkbreakgoal,%
  toprule at break/.store in=\kvtcb@top@rule@break,
  bottomrule at break/.store in=\kvtcb@bottom@rule@break,
  topsep at break/.store in=\kvtcb@topsep,%
  bottomsep at break/.store in=\kvtcb@bottomsep,%
  pad before break/.code={\let\kvtcb@bottom@rule@break=\tcb@zpt%
    \tcbdimto\kvtcb@bottomsep{#1-\kvtcb@bottom-\kvtcb@boxsep}},%
  pad after break/.code={\let\kvtcb@top@rule@break=\tcb@zpt%
    \tcbdimto\kvtcb@topsep{#1-\kvtcb@top-\kvtcb@boxsep}},%
  pad at break/.style={pad before break={#1},pad after break={#1}},%
  enlargepage/.store in=\kvtcb@enlargepage,
}


\tcbset{%
  reset@breakable/.style={%
    unbreakable,notitle after break,
    shrink break goal=0pt,
    lines before break=2,
    topsep at break=0pt,
    bottomsep at break=0pt,
    enlargepage=0pt,
  },
  initialize@reset=reset@breakable,
}


tcbdocumentation.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbdocumentation.code.tex: Code for LaTeX documentations
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{3.04}

\tcbuselibrary{listings,skins}

\RequirePackage{doc}[2010/02/04]
\RequirePackage{pifont}[2005/04/12]
\RequirePackage{marvosym}[2011/07/20]
\ifdefined\printindex\else\RequirePackage{makeidx}[2000/03/29]\fi
\RequirePackage{refcount}[2011/10/16]
\RequirePackage{hyperref}[2012/02/06]

\definecolor{Option}{rgb}{0.118,0.546,0.222}
\definecolor{Definition}{rgb}{0.784,0.06,0.176}
\definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942}
\definecolor{ExampleBack}{rgb}{0.963,0.971,0.994}
\definecolor{Hyperlink}{rgb}{0.281,0.275,0.485}

\def\colDef#1{\textcolor{\kvtcb@col@command}{#1}}
\def\colOpt#1{\textcolor{\kvtcb@col@opt}{#1}}

\lstdefinestyle{tcbdocumentation}{language={[LaTeX]TeX},
    aboveskip={0\p@ \@plus 6\p@},
    belowskip={0\p@ \@plus 6\p@},
    columns=fullflexible,
    keepspaces=true,
    breaklines=true,
    prebreak={\Righttorque},
    postbreak={\space\Lefttorque},
    breakatwhitespace=true,
    basicstyle=\ttfamily\footnotesize,
    extendedchars=true,
    moredelim={[is][\itshape\rmfamily]{�}{�}},
    nolol,inputencoding=\kvtcb@listingencoding}

% The following macros are taken from ltxdoc
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
\let\tcb@doc@org@meta\meta%
\def\meta#1{{\rmfamily\tcb@doc@org@meta{#1}}}
\def\marg#1{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\def\oarg#1{%
  \colOpt{{\ttfamily[}\meta{#1}{\ttfamily]}}}

\newif\iftcb@doc@toindex
\newif\iftcb@doc@colorize
\newif\iftcb@doc@annotate

% language specific texts
\tcbset{
  doclang/.cd,
  color/.store in=\kvtcb@text@color,
  colors/.store in=\kvtcb@text@colors,
  environment content/.store in=\kvtcb@text@envcontent,
  environment/.store in=\kvtcb@text@env,
  environments/.store in=\kvtcb@text@envs,
  key/.store in=\kvtcb@text@key,
  keys/.store in=\kvtcb@text@keys,
  index/.store in=\kvtcb@text@index,
  pageshort/.store in=\kvtcb@text@pageshort,
  value/.store in=\kvtcb@text@value,
  values/.store in=\kvtcb@text@values,
}

% documentation options
\tcbset{
  documentation listing options/.store in=\kvtcb@doclistingoptions,%
  documentation listing style/.style={documentation listing options={style=#1}},%
  documentation minted style/.store in=\kvtcb@docmintstyle,
  documentation minted options/.store in=\kvtcb@docmintoptions,
  color command/.store in=\kvtcb@col@command,
  color environment/.store in=\kvtcb@col@environment,
  color key/.store in=\kvtcb@col@key,
  color value/.store in=\kvtcb@col@value,
  color color/.store in=\kvtcb@col@color,
  color definition/.style={color command={#1},color environment={#1},color key={#1},color value={#1},color color={#1}},
  color option/.store in=\kvtcb@col@opt,
  color hyperlink/.store in=\kvtcb@colhyper,
  color frame/.store in=\kvtcb@colhyper,
  before example/.store in=\kvtcb@beforeexample,
  after example/.store in=\kvtcb@afterexample,
  index actual/.store in=\idx@actual,
  index quote/.store in=\idx@quote,
  index level/.store in=\idx@level,
  index format/.store in=\idx@format,
  index colorize/.is if=tcb@doc@colorize,%
  index annotate/.is if=tcb@doc@annotate,%
  doc left/.dimstore in=\kvtcb@doc@left,
  doc right/.dimstore in=\kvtcb@doc@right,
  doc left indent/.dimstore in=\kvtcb@doc@indentleft,
  doc right indent/.dimstore in=\kvtcb@doc@indentright,
  doc head command/.style={doc@head@command/.style={#1}},
  doc head environment/.style={doc@head@environment/.style={#1}},
  doc head key/.style={doc@head@key/.style={#1}},
  doc head/.style={doc head command={#1},doc head environment={#1},doc head key={#1}},
  doc description/.store in=\kvtcb@doc@description,%
  doc into index/.is if=tcb@doc@toindex,%
}


% styles
\tcbset{
  docexample/.style={colframe=ExampleFrame,colback=ExampleBack,fontlower=\footnotesize},
  documentation minted style=,
  documentation minted options={tabsize=2,fontsize=\small},
  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,
    environment content=environment content,
    environment=environment,environments=Environments,
    key=key,keys=Keys,
    index=Index,
    pageshort={P.},
    value=value,values=Values}},
}

\AtBeginDocument{%
  \csname tcb@doc@index@\idx@format\endcsname%
  \hypersetup{
  citecolor=\kvtcb@colhyper,
  linkcolor=\kvtcb@colhyper,
  urlcolor=\kvtcb@colhyper,
  filecolor=\kvtcb@colhyper,
  menucolor=\kvtcb@colhyper
}}


\def\dispExample{\tcbset{docexample}\tcbwritetemp}

\def\enddispExample{%
  \endtcbwritetemp%
  \kvtcb@beforeexample\begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \tcblower%
  \tcbusetemp%
  \end{tcolorbox}\kvtcb@afterexample%
}

\newenvironment{dispExample*}[1]{%
  \tcbset{docexample,#1}\tcbwritetemp%
  }{\enddispExample}

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

\def\enddispListing{%
  \endtcbwritetemp%
  \kvtcb@beforeexample\begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \end{tcolorbox}\kvtcb@afterexample%
}

\newenvironment{dispListing*}[1]{%
  \tcb@layer@pushup\tcbset{docexample,#1}\tcbwritetemp%
  }{\enddispListing}

% index auxiliary macros
\def\tcb@Index@Print@CA#1#2#3{%
  \iftcb@doc@colorize\textcolor{#2}{\texttt{#1}}\else\texttt{#1}\fi%
  \iftcb@doc@annotate\ #3\fi%
}

\def\tcb@Index@Print@C#1#2{%
  \iftcb@doc@colorize\textcolor{#2}{\texttt{#1}}\else\texttt{#1}\fi%
}

\newrobustcmd{\tcbIndexPrintComC}[1]{\tcb@Index@Print@C{\cs{#1}}{\kvtcb@col@command}}
\def\tcb@Print@Com#1{\textcolor{\kvtcb@col@command}{\ttfamily\bfseries\cs{#1}}}

\newrobustcmd{\tcbIndexPrintEnvCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@environment}{\kvtcb@text@env}}
\newrobustcmd{\tcbIndexPrintEnvC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@environment}}
\def\tcb@Print@Env#1{\textcolor{\kvtcb@col@environment}{\ttfamily\bfseries#1}}

\newrobustcmd{\tcbIndexPrintKeyCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@key}{\kvtcb@text@key}}
\newrobustcmd{\tcbIndexPrintKeyC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@key}}
\def\tcb@Print@Key#1{\textcolor{\kvtcb@col@key}{\ttfamily\bfseries#1}}

\newrobustcmd{\tcbIndexPrintValCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@value}{\kvtcb@text@value}}
\newrobustcmd{\tcbIndexPrintValC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@value}}
\def\tcb@Print@Val#1{\textcolor{\kvtcb@col@value}{\ttfamily\bfseries#1}}

\newrobustcmd{\tcbIndexPrintColCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@color}{\kvtcb@text@color}}
\newrobustcmd{\tcbIndexPrintColC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@color}}
\def\tcb@Print@Col#1{\textcolor{\kvtcb@col@color}{\ttfamily\bfseries#1}}

\def\tcb@index@Com#1{\iftcb@doc@toindex\index{#1\idx@actual\tcbIndexPrintComC{#1}}\fi}
\def\tcb@index@Env#1{\iftcb@doc@toindex\index{#1\idx@actual\tcbIndexPrintEnvCA{#1}}\index{\kvtcb@text@envs\idx@level#1\idx@actual\tcbIndexPrintEnvC{#1}}\fi}
\def\tcb@index@Key#1{\iftcb@doc@toindex\index{#1\idx@actual\tcbIndexPrintKeyCA{#1}}\index{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{#1}}\fi}%
\def\tcb@index@KeyPath#1#2{\iftcb@doc@toindex\index{#2\idx@actual\tcbIndexPrintKeyCA{#2}}\index{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{/#1/}\idx@level#2\idx@actual\tcbIndexPrintKeyC{#2}}\fi}%
\def\tcb@index@Val#1{\iftcb@doc@toindex\index{#1\idx@actual\tcbIndexPrintValCA{#1}}\index{\kvtcb@text@values\idx@level#1\idx@actual\tcbIndexPrintValC{#1}}\fi}
\def\tcb@index@Col#1{\iftcb@doc@toindex\index{#1\idx@actual\tcbIndexPrintColCA{#1}}\index{\kvtcb@text@colors\idx@level#1\idx@actual\tcbIndexPrintColC{#1}}\fi}

\def\brackets#1{{\ttfamily\char`\{}#1{\ttfamily\char`\}}}

\newenvironment{tcb@manual@entry}{\begin{list}{}{%
  \setlength{\leftmargin}{\kvtcb@doc@left}%
  \setlength{\itemindent}{0pt}%
  \setlength{\itemsep}{0pt}%
  \setlength{\parsep}{0pt}%
  \setlength{\rightmargin}{\kvtcb@doc@right}%
  }\item}{\end{list}}

\def\tcb@manual@top#1{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt}

\def\tcb@doc@do@description{%
  \ifx\kvtcb@doc@description\@empty\else\tcblower\raggedleft(\kvtcb@doc@description)\fi%
}

\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}

% main documentation environments
\newenvironment{docCommand}[3][]{\tcbset{#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@command}%
  \tcb@Print@Com{#2}\tcb@index@Com{#2}\protected@edef\@currentlabel{\noexpand\cs{#2}}\label{com:#2}{\ttfamily #3}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}}%
  {\end{tcb@manual@entry}}

\newenvironment{docCommand*}{\bgroup\tcb@doc@toindexfalse\begin{docCommand}}{\end{docCommand}\egroup}

\newenvironment{docEnvironment}[3][]{\tcbset{#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@environment}%
  \strut\cs{begin}\brackets{\tcb@Print@Env{#2}}\tcb@index@Env{#2}\protected@edef\@currentlabel{#2}\label{env:#2}{\ttfamily #3}\par%
  \strut~~\meta{\kvtcb@text@envcontent}\par%
  \strut\cs{end}\brackets{\tcb@Print@Env{#2}}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}}%
  {\end{tcb@manual@entry}}

\newenvironment{docEnvironment*}{\bgroup\tcb@doc@toindexfalse\begin{docEnvironment}}{\end{docEnvironment}\egroup}

\newenvironment{docKey}[4][\@empty]{\begin{tcb@manual@entry}%
  \tcbset{doc description={#4}}%
  \begin{tcb@doc@head}{doc@head@key}%
  \ifx#1\@empty%
  \tcb@Print@Key{#2}\tcb@index@Key{#2}\protected@edef\@currentlabel{#2}\label{key:#2}{\ttfamily #3}%
  \else\tcb@Print@Key{/#1/#2}\tcb@index@KeyPath{#1}{#2}\protected@edef\@currentlabel{/#1/#2}\label{key:/#1/#2}{\ttfamily #3}%
  \fi%
  \tcb@doc@do@description%
  \end{tcb@doc@head}}%
  {\end{tcb@manual@entry}}

\newenvironment{docKey*}{\bgroup\tcb@doc@toindexfalse\begin{docKey}}{\end{docKey}\egroup}

\def\tcbmakedocSubKey#1#2{%
  \newenvironment{#1}[4][\@empty]{%
    \ifx##1\@empty\def\tcb@key@path{#2}\else\def\tcb@key@path{#2/##1}\fi%
    \begin{docKey}[\tcb@key@path]{##2}{##3}{##4}}%
      {\end{docKey}}%
  \newenvironment{#1*}{\bgroup\tcb@doc@toindexfalse\begin{#1}}{\end{#1}\egroup}%
}

\def\docAuxCommand@#1{\tcbIndexPrintComC{#1}\tcb@index@Com{#1}}%
\def\docAuxCommand@star#1{\tcbIndexPrintComC{#1}}%
\def\docAuxCommand{\@ifstar\docAuxCommand@star\docAuxCommand@}

\def\docAuxEnvironment@#1{\tcb@Print@Env{#1}\tcb@index@Env{#1}}%
\def\docAuxEnvironment@star#1{\tcb@Print@Env{#1}}%
\def\docAuxEnvironment{\@ifstar\docAuxEnvironment@star\docAuxEnvironment@}

\newcommand{\docAuxKey@}[2][\@empty]{%
  \ifx#1\@empty%
    \tcb@Print@Key{#2}\tcb@index@Key{#2}%
  \else%
    \tcb@Print@Key{/#1/#2}\tcb@index@KeyPath{#1}{#2}%
  \fi}%

\newcommand{\docAuxKey@star}[2][\@empty]{%
  \ifx#1\@empty%
    \tcb@Print@Key{#2}%
  \else%
    \tcb@Print@Key{/#1/#2}%
  \fi}%
\def\docAuxKey{\@ifstar\docAuxKey@star\docAuxKey@}

\def\docColor@#1{\tcb@Print@Col{#1}\tcb@index@Col{#1}}%
\def\docColor@star#1{\tcb@Print@Col{#1}}%
\def\docColor{\@ifstar\docColor@star\docColor@}

\def\docValue@#1{\tcb@Print@Val{#1}\tcb@index@Val{#1}}%
\def\docValue@star#1{\tcb@Print@Val{#1}}%
\def\docValue{\@ifstar\docValue@star\docValue@}

\setrefcountdefault{-1}
\def\tcb@ref@doc#1{\hyperref[#1]{\texttt{\ref*{#1}}%
  \ifnum\getpagerefnumber{#1}=\thepage\else%
  \textsuperscript{\ding{213}\,\kvtcb@text@pageshort\,\pageref*{#1}}\fi}}

\def\tcb@ref@doc@star#1{\hyperref[#1]{\texttt{\ref*{#1}}}}

\def\refCom@#1{\tcb@ref@doc{com:#1}}
\def\refCom@star#1{\tcb@ref@doc@star{com:#1}}
\def\refCom{\@ifstar\refCom@star\refCom@}

\def\refEnv@#1{\tcb@ref@doc{env:#1}}
\def\refEnv@star#1{\tcb@ref@doc@star{env:#1}}
\def\refEnv{\@ifstar\refEnv@star\refEnv@}

\def\refKey@#1{\tcb@ref@doc{key:#1}}
\def\refKey@star#1{\tcb@ref@doc@star{key:#1}}
\def\refKey{\@ifstar\refKey@star\refKey@}

\def\refAux#1{\textcolor{\kvtcb@colhyper}{\ttfamily #1}}
\def\refAuxcs#1{\textcolor{\kvtcb@colhyper}{\cs{#1}}}

\newenvironment{absquote}
               {\list{}{\leftmargin2cm\rightmargin\leftmargin}%
                \item\relax\footnotesize}
               {\endlist}

%--- index macros taken from pgfmanual-en-macros
\def\tcb@doc@index@pgf@{%
  \c@IndexColumns=2%
  \def\theindex{\@restonecoltrue
    \columnseprule \z@  \columnsep 29\p@
    \twocolumn[\index@prologue]%
    \parindent -30pt%
    \columnsep 15pt%
    \parskip 0pt plus 1pt%
    \leftskip 30pt%
    \rightskip 0pt plus 2cm%
    \small%
    \def\@idxitem{\par}%
    \let\item\@idxitem\ignorespaces}
  \def\endtheindex{\onecolumn}%
  \def\noindexing{\let\index=\@gobble}%
}

\def\tcb@doc@index@pgfsection{%
  \def\index@prologue{\section*{\kvtcb@text@index}\addcontentsline{toc}{section}{\kvtcb@text@index}%
    \par\noindent%
  }%
  \tcb@doc@index@pgf@%
}

\def\tcb@doc@index@pgfchapter{%
  \def\index@prologue{\ifdefined\phantomsection\phantomsection\fi\@makeschapterhead{\kvtcb@text@index}\addcontentsline{toc}{chapter}{\kvtcb@text@index}}%
  \tcb@doc@index@pgf@%
}

\let\tcb@doc@index@pgf=\tcb@doc@index@pgfsection%

\def\tcb@doc@index@doc{%
  \let\tcb@index@Com=\SpecialMainIndex%%
  \let\tcb@index@Env=\SpecialMainEnvIndex%
  \tcbset{index german settings}%
  \EnableCrossrefs%
  \PageIndex%
}

\def\tcb@doc@index@off{}%

\tcbset{%
  reset@documentation/.style={%
    index format=pgf,
    english language,
    documentation listing style=tcbdocumentation,
    index default settings,
    color option=Option,
    color definition=Definition,
    color hyperlink=Hyperlink,
    before example=\par\smallskip,
    after example=,
    doc left=2em,
    doc right=0pt,
    doc left indent=-2em,
    doc right indent=0pt,
    doc head=,
    doc description=,
    doc into index=true,
    index colorize=false,
    index annotate=true,
    },
  initialize@reset=reset@documentation,
}



tcbfitting.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbfitting.code.tex: Code for fit boxes
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\newdimen\tcbfitdim
\newdimen\tcb@lowerfitdim
\newdimen\tcb@upperfitdim
\newif\iftcb@continue

\tcbset{%
  fit/.style={capture=fitbox},%
  fit to/.style args={#1 and #2}{capture=fitbox,width=#1,height=#2},%
  fit to height/.style={capture=fitbox,height=#1},%
  fit basedim/.code={\def\kvtcb@fit@basedim{#1}\tcbfitdim\kvtcb@fit@basedim},%
  fit skip/.store in=\kvtcb@fit@skip,%
  fit fontsize macros/.code={%
    \renewcommand\tiny{\tcb@setfontsize\tiny{0.5}}%
    \renewcommand\scriptsize{\tcb@setfontsize\scriptsize{0.7}}%
    \renewcommand\footnotesize{\tcb@setfontsize\footnotesize{0.8}}%
    \renewcommand\small{\tcb@setfontsize\small{0.9}}%
    \renewcommand\normalsize{\tcb@setfontsize\normalsize{1}}%
    \renewcommand\large{\tcb@setfontsize\large{1.2}}%
    \renewcommand\Large{\tcb@setfontsize\Large{1.44}}%
    \renewcommand\LARGE{\tcb@setfontsize\LARGE{1.728}}%
    \renewcommand\huge{\tcb@setfontsize\huge{2.0736}}%
    \renewcommand\Huge{\tcb@setfontsize\Huge{2.48832}}},%
  fit height plus/.style={fit,height plus=#1},%
  fit width plus/.dimstore in=\kvtcb@fit@plus@width,%
  fit height from/.style args={#1 to #2}{fit,height from={#1} to {#2}},
  fit width from/.style args={#1 to #2}{fit,width={#1},fit width plus={#2-#1}},
  fit maxstep/.store in=\kvtcb@fit@maxstep,%
  fit maxfontdiff/.store in=\kvtcb@fit@maxfontdiff,%
  fit maxfontdiffgap/.store in=\kvtcb@fit@maxfontdiffgap,%
  fit maxwidthdiff/.store in=\kvtcb@fit@maxwidthdiff,%
  fit maxwidthdiffgap/.store in=\kvtcb@fit@maxwidthdiffgap,%
  fit warning/.is choice,
  fit warning/on/.code={\let\tcb@fit@warn@begin=\@empty%
    \let\tcb@fit@warn@end=\@empty},
  fit warning/off/.code={\def\tcb@fit@warn@begin{\hbadness=10000\relax}%
    \let\tcb@fit@warn@end=\@empty},
  fit warning/final/.code={\tcb@cur@hbadness=\hbadness\def\tcb@fit@warn@begin{\hbadness=10000\relax}%
    \def\tcb@fit@warn@end{\hbadness=\tcb@cur@hbadness\relax\tcb@fit@@box}},
  fit algorithm/.is choice,
  fit algorithm/fontsize/.code={\let\tcbox@fitalgorithm=\tcbox@fitalgorithm@fontsize},
  fit algorithm/areasize/.code={\let\tcbox@fitalgorithm=\tcbox@fitalgorithm@areasize},
  fit algorithm/hybrid/.code={\let\tcbox@fitalgorithm=\tcbox@fitalgorithm@hybrid},
  fit algorithm/squeeze/.code={\let\tcbox@fitalgorithm=\tcbox@fitalgorithm@squeeze},
  spartan@fit/.style={fit algorithm=squeeze},
}

\def\tcb@@capture@fitbox{%
  \let\endtcolorbox=\relax%
  \Collect@Body\tcbox@inner@fitbox@collected%
}

\def\tcbfontsize#1{\fontsize{#1\tcbfitdim}{#1\dimexpr\kvtcb@fit@skip\tcbfitdim}\selectfont}

\def\tcb@setfontsize#1#2{\@setfontsize#1{#2\tcbfitdim}{#2\dimexpr\kvtcb@fit@skip\tcbfitdim}}

\long\def\tcbox@inner@fitbox@collected#1{%
  \tcbox@inner@fitbox{#1}%
  \tcb@finalize@environment%
}

\newcount\tcb@cur@hbadness

\def\tcbox@fitalgorithm@fontsize{%
  \tcb@continuetrue%
  \loop%
    \tcbfitdim.5\tcbfitdim%
    \tcb@fit@@box%
    \ifnum\count@=\kvtcb@fit@maxstep\relax%
      \tcb@continuefalse%
    \else%
      \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
        \ifdim\tcbfitdim<18000sp\relax%
          \count@\kvtcb@fit@maxstep\relax%
          \tcb@continuefalse%
        \fi%
      \else%
        \tcb@continuefalse%
      \fi%
    \fi%
  \iftcb@continue \repeat%
  \ifnum\count@<\kvtcb@fit@maxstep\relax%
    \tcbdimto\tcb@fit@@gap{\tcb@fit@@target-\tcb@fit@@h}%
    \tcb@lowerfitdim\tcbfitdim%
    \tcb@upperfitdim2\tcbfitdim%
    \tcbfitdim1.5\tcbfitdim%
    \loop%
      \tcb@fit@@box%
      \tcb@continuetrue%
      \ifnum\count@<\kvtcb@fit@maxstep\relax%
        \ifdim\dimexpr\tcb@upperfitdim-\tcb@lowerfitdim<\kvtcb@fit@maxfontdiff\relax%
          \tcb@continuefalse%
        \else%
          \ifdim\dimexpr\tcb@upperfitdim-\tcb@lowerfitdim<\kvtcb@fit@maxfontdiffgap\relax%
            \ifdim\dimexpr\tcb@fit@@gap<\tcb@fit@@line\relax%
              \tcb@continuefalse%
            \fi%
          \fi%
        \fi%
      \else%
        \tcb@continuefalse%
      \fi%
      \iftcb@continue%
        \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
          \tcb@upperfitdim\tcbfitdim%
          \advance\tcbfitdim\tcb@lowerfitdim%
          \tcbfitdim0.5\tcbfitdim%
        \else%
          \tcbdimto\tcb@fit@@gap{\tcb@fit@@target-\tcb@fit@@h}%
          \tcb@lowerfitdim\tcbfitdim%
          \advance\tcbfitdim\tcb@upperfitdim%
          \tcbfitdim0.5\tcbfitdim%
        \fi%
      \else%
        \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
          \tcbfitdim\tcb@lowerfitdim%
          \tcb@fit@@box%
        \fi%
      \fi%
    \iftcb@continue \repeat%
  \fi%
}

\def\tcbox@fitalgorithm@areasize{%
  \pgfmathdivide{\tcb@fit@@h}{\tcb@fit@@target}%
  \pgfmathsqrt{\pgfmathresult}%
  \let\tcb@temp=\pgfmathresult%
  \tcbdimto\tcb@w@upper@temp{\pgfmathresult\dimexpr\tcb@w@upper}%
  \tcb@fit@@boxsave{\tcb@w@upper@temp}%
  %
  \tcbdimto\tcb@fit@@h{\ht\tcb@upperbox+\dp\tcb@upperbox}%
  \pgfmathdivide{\tcb@fit@@h}{\tcb@fit@@target}%
  \pgfmathdivide{\pgfmathresult}{\tcb@temp}%
  \pgfmathsqrt{\pgfmathresult}%
  \ifdim\dimexpr\pgfmathresult pt<0.98pt\relax
    \tcbdimto\tcb@w@upper@temp{\pgfmathresult\dimexpr\tcb@w@upper@temp}%
    \tcb@fit@@boxsave{\tcb@w@upper@temp}%
  \else\ifdim\dimexpr\pgfmathresult pt>1.02pt\relax
    \tcbdimto\tcb@w@upper@temp{\pgfmathresult\dimexpr\tcb@w@upper@temp}%
    \tcb@fit@@boxsave{\tcb@w@upper@temp}%
  \fi\fi%
  %
  \tcbdimto\tcb@fit@@h{\ht\tcb@upperbox+\dp\tcb@upperbox}%
  \pgfmathdivide{\tcb@w@upper}{\tcb@w@upper@temp}%
  \tcbdimto\tcb@fit@@h{\pgfmathresult\dimexpr\tcb@fit@@h}%
  \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
    \let\tcb@fit@@h=\tcb@fit@@target%
  \fi
  \setbox\tcb@upperbox\hbox{\resizebox*{\tcb@w@upper}{\tcb@fit@@h}{\box\tcb@upperbox}}%
  %
  \tcbdimto\tcb@fit@@h{\ht\tcb@upperbox+\dp\tcb@upperbox}%
}

\def\tcbox@fitalgorithm@squeeze{%
  \setbox\tcb@upperbox\hbox{\resizebox*{\tcb@w@upper}{\tcb@fit@@target}{\box\tcb@upperbox}}%
  \tcbdimto\tcb@fit@@h{\ht\tcb@upperbox+\dp\tcb@upperbox}%
}

\def\tcbox@fitalgorithm@hybrid{%
  \pgfmathdivide{\tcb@fit@@target}{\tcb@fit@@h}%
  \pgfmathsqrt{\pgfmathresult}%
  \tcbfitdim=\pgfmathresult\tcbfitdim%
  \tcb@fit@@box%
  %
  \pgfmathdivide{\tcb@fit@@target}{\tcb@fit@@h}%
  \pgfmathsqrt{\pgfmathresult}%
  \ifdim\dimexpr\pgfmathresult pt<0.85pt\relax
    \tcbfitdim=\pgfmathresult\tcbfitdim%
    \tcb@fit@@box%
  \else\ifdim\dimexpr\pgfmathresult pt>1.15pt\relax
    \tcbfitdim=\pgfmathresult\tcbfitdim%
    \tcb@fit@@box%
  \fi\fi%
  %
  \tcbox@fitalgorithm@areasize%
}

\def\tcb@fit@@box{%
  \tcbdimto\tcb@fit@@line{\kvtcb@fit@skip\tcbfitdim}%
  \tcbdimto\tcb@w@upper{\tcb@width-\kvtcb@left@rule-\kvtcb@right@rule-\kvtcb@boxsep*2-\kvtcb@leftupper-\kvtcb@rightupper}%
  \tcb@fit@@boxsave{\tcb@w@upper}%
  \tcbdimto\tcb@fit@@h{\ht\tcb@upperbox+\dp\tcb@upperbox}%
  \tcbdimto\tcb@fit@@target{\kvtcb@height@fixed-\kvtcb@top@rule@stand-\kvtcb@bottom@rule@stand-\kvtcb@top-\kvtcb@bottom-\kvtcb@boxsep*2-\tcb@h@titletotal}%
}%

\def\tcb@fit@@box@titled{%
  \tcb@set@@dim@and@title%
  \iftcb@hasTitle%
    \tcbdimto\tcb@h@titletotal{\ht\tcb@titlebox+\dp\tcb@titlebox+\kvtcb@title@rule+\kvtcb@boxsep*2+\kvtcb@toptitle+\kvtcb@bottomtitle}%
  \else%
    \let\tcb@h@titletotal=\tcb@zpt%
  \fi%
  \tcb@fit@@box%
}%

\long\def\tcbox@inner@fitbox#1{%
  \tcbset{breakable@false,sidebyside=false}%
  \let\tcb@val@raisebase=\tcb@zpt%
  \unless\ifdefined\kvtcb@height@fixed%
    \tcbset{height=\kvtcb@width}%
  \fi%
  \tcb@hasLowerfalse%
  %
  \count@\z@%
  \tcbfitdim\kvtcb@fit@basedim%
  \tcb@fit@warn@begin%
  %
  \def\tcb@fit@@boxsave##1{%
    \begin{tcb@savebox}{\tcb@upperbox}{##1}%
      \color{\kvtcb@colupper}%
      \kvtcb@fontupper\fontsize{\tcbfitdim}{\tcb@fit@@line}\selectfont%
      \kvtcb@before@upper\ignorespaces#1\unskip\kvtcb@after@upper%
    \end{tcb@savebox}%
    \advance\count@ 1\relax%
  }%
  %
  \tcb@fit@@box@titled%
  %
  % height fit
  \ifdim\kvtcb@height@fixed@plus>0pt\relax%
    \let\tcb@fit@@minheight=\kvtcb@height@fixed%
    \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
      \ifdim\dimexpr\tcb@fit@@h>\dimexpr\tcb@fit@@target+\kvtcb@height@fixed@plus\relax%
        \tcbdimto\kvtcb@height@fixed{\kvtcb@height@fixed+\kvtcb@height@fixed@plus}%
        \tcbdimto\tcb@fit@@target{\tcb@fit@@target+\kvtcb@height@fixed@plus}%
      \else%
        \tcbdimto\kvtcb@height@fixed{\kvtcb@height@fixed+\tcb@fit@@h-\tcb@fit@@target}%
        \let\tcb@fit@@target=\tcb@fit@@h%
      \fi%
    \fi%
  \fi%
  %
  % width fit
  \ifdim\kvtcb@fit@plus@width>0pt\relax%
    \ifnum\count@<\kvtcb@fit@maxstep\relax%
      \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
        \tcb@lowerfitdim\kvtcb@width%
        \tcb@upperfitdim\dimexpr\kvtcb@width+\kvtcb@fit@plus@width\relax%
        \tcbdimto\kvtcb@width{\tcb@upperfitdim}%
        \tcb@fit@@box@titled%
        \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
        \else%
          \ifnum\count@<\kvtcb@fit@maxstep\relax%
            \tcbdimto\tcb@fit@@gap{\tcb@fit@@target-\tcb@fit@@h}%
            \tcbdimto\kvtcb@width{(\tcb@lowerfitdim+\tcb@upperfitdim)/2}%
            \loop%
              \tcb@fit@@box@titled%
              \tcb@continuetrue%
              \ifnum\count@<\kvtcb@fit@maxstep\relax%
                \ifdim\dimexpr\tcb@upperfitdim-\tcb@lowerfitdim<\kvtcb@fit@maxwidthdiff\relax%
                  \tcb@continuefalse%
                \else%
                  \ifdim\dimexpr\tcb@upperfitdim-\tcb@lowerfitdim<\kvtcb@fit@maxwidthdiffgap\relax%
                    \ifdim\dimexpr\tcb@fit@@gap<\tcb@fit@@line\relax%
                      \tcb@continuefalse%
                    \fi%
                  \fi%
                \fi%
              \else%
                \tcb@continuefalse%
              \fi%
              \iftcb@continue%
                \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
                  \tcb@lowerfitdim\kvtcb@width%
                  \tcbdimto\kvtcb@width{(\tcb@lowerfitdim+\tcb@upperfitdim)/2}%
                \else%
                  \tcb@upperfitdim\kvtcb@width%
                  \tcbdimto\tcb@fit@@gap{\tcb@fit@@target-\tcb@fit@@h}%
                  \tcbdimto\kvtcb@width{(\tcb@lowerfitdim+\tcb@upperfitdim)/2}%
                \fi%
              \else%
                \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
                  \tcbdimto\kvtcb@width{\tcb@upperfitdim}%
                  \tcb@fit@@box@titled%
                \fi%
              \fi%
            \iftcb@continue \repeat%
          \fi%
        \fi%
      \fi%
    \fi%
  \fi%
  %
  % (font) fit
  \ifnum\count@<\kvtcb@fit@maxstep\relax%
    \ifdim\dimexpr\tcb@fit@@h>\tcb@fit@@target\relax%
    \tcbox@fitalgorithm%
    \fi%
  \fi%
  %
  \tcb@fit@warn@end%
  %
  % last height fit
  \ifdim\kvtcb@height@fixed@plus>0pt\relax%
    \ifdim\dimexpr\tcb@fit@@h<\tcb@fit@@target\relax%
      \tcbdimto\tcb@temp{\kvtcb@height@fixed+\tcb@fit@@h-\tcb@fit@@target}%
      \ifdim\dimexpr\tcb@temp<\tcb@fit@@minheight\relax%
      \else%
        \let\kvtcb@height@fixed=\tcb@temp%
      \fi%
    \fi%
  \fi%
  %
  \edef\tcbfitsteps{\the\count@}%
  \tcb@draw@color@box%
}

\newcommand{\tcboxfit}[2][]{%
  \tcb@ox{capture=fitbox,#1}{#2}%
}

\long\def\tcb@newtcboxfit#1#2{\expandafter\tcb@newcommand\csname#1\endcsname{\tcboxfit[#2,options@for=#1]}}

\long\def\tcb@newtcboxfit@#1[#2]#3{\expandafter\tcb@newcommand\csname#1\endcsname[#2]{\tcboxfit[#3,options@for=#1]}}

\long\def\tcb@newtcboxfit@@#1[#2][#3]#4{\expandafter\tcb@newcommand\csname#1\endcsname[#2][#3]{\tcboxfit[#4,options@for=#1]}}

\long\def\tcb@new@tcboxfit@#1[#2]{%
  \@ifnextchar[{\tcb@newtcboxfit@@{#1}[#2]}{\tcb@newtcboxfit@{#1}[#2]}}

\long\def\tcb@new@tcboxfit#1{%
  \@ifnextchar[{\tcb@new@tcboxfit@{#1}}{\tcb@newtcboxfit{#1}}}

\def\newtcboxfit{%
  \let\tcb@newcommand\newcommand%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcboxfit%
  \tcb@process@newcommand}

\def\renewtcboxfit{%
  \let\tcb@newcommand\renewcommand%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcboxfit%
  \tcb@process@newcommand}

\tcbset{%
  reset@fitting/.style={%
    fit algorithm=fontsize,%
    fit basedim=10pt,fit skip=1.2,
    height plus=0pt,fit width plus=0pt,
    fit maxstep=20,fit maxfontdiff=0.1pt,fit maxfontdiffgap=1pt,
    fit maxwidthdiff=1pt,fit maxwidthdiffgap=10pt,
    fit warning=off
  },
  initialize@reset=reset@fitting,
}


tcbhooks.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbhooks.code.tex: Code for adding hooks
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\tcbset{%
  before upper app/.code={\appto\kvtcb@before@upper{#1}},%
  before upper pre/.code={\preto\kvtcb@before@upper{#1}},%
  after upper app/.code={\appto\kvtcb@after@upper{#1}},%
  after upper pre/.code={\preto\kvtcb@after@upper{#1}},%
  before lower app/.code={\appto\kvtcb@before@lower{#1}},%
  before lower pre/.code={\preto\kvtcb@before@lower{#1}},%
  after lower app/.code={\appto\kvtcb@after@lower{#1}},%
  after lower pre/.code={\preto\kvtcb@after@lower{#1}},%
  before title app/.code={\appto\kvtcb@before@title{#1}},%
  before title pre/.code={\preto\kvtcb@before@title{#1}},%
  after title app/.code={\appto\kvtcb@after@title{#1}},%
  after title pre/.code={\preto\kvtcb@after@title{#1}},%
  %
  % usable inside the document or in the preamble after setting before / after
  before app/.code={\appto\kvtcb@beforebox{#1}},%
  before pre/.code={\preto\kvtcb@beforebox{#1}},%
  after app/.code={\appto\kvtcb@afterbox{#1}},%
  after pre/.code={\preto\kvtcb@afterbox{#1}},%
  %
  overlay unbroken app/.code={\appto\tcb@overlay@unbroken{#1}},%
  overlay unbroken pre/.code={\preto\tcb@overlay@unbroken{#1}},%
  overlay first app/.code={\appto\tcb@overlay@first{#1}},%
  overlay first pre/.code={\preto\tcb@overlay@first{#1}},%
  overlay middle app/.code={\appto\tcb@overlay@middle{#1}},%
  overlay middle pre/.code={\preto\tcb@overlay@middle{#1}},%
  overlay last app/.code={\appto\tcb@overlay@last{#1}},%
  overlay last pre/.code={\preto\tcb@overlay@last{#1}},%
  %
  overlay app/.style={overlay unbroken app={#1},overlay first app={#1},overlay middle app={#1},overlay last app={#1}},%
  overlay pre/.style={overlay unbroken pre={#1},overlay first pre={#1},overlay middle pre={#1},overlay last pre={#1}},%
  overlay broken app/.style={overlay first app={#1},overlay middle app={#1},overlay last app={#1}},%
  overlay broken pre/.style={overlay first pre={#1},overlay middle pre={#1},overlay last pre={#1}},%
  overlay unbroken and first app/.style={overlay unbroken app={#1},overlay first app={#1}},%
  overlay unbroken and first pre/.style={overlay unbroken pre={#1},overlay first pre={#1}},%
  overlay unbroken and last app/.style={overlay unbroken app={#1},overlay last app={#1}},%
  overlay unbroken and last pre/.style={overlay unbroken pre={#1},overlay last pre={#1}},%
  overlay middle and last app/.style={overlay middle app={#1},overlay last app={#1}},%
  overlay middle and last pre/.style={overlay middle pre={#1},overlay last pre={#1}},%
  %
  % skins:
  frame code app/.code={\appto\tcb@frame@code{#1}},%
  frame code pre/.code={\preto\tcb@frame@code{#1}},%
  interior titled code app/.code={\appto\tcb@interiortitled@code{#1}},%
  interior titled code pre/.code={\preto\tcb@interiortitled@code{#1}},%
  interior code app/.code={\appto\tcb@interior@code{#1}},%
  interior code pre/.code={\preto\tcb@interior@code{#1}},%
  segmentation code app/.code={\appto\tcb@segmentation@code{#1}},%
  segmentation code pre/.code={\preto\tcb@segmentation@code{#1}},%
  title code app/.code={\appto\tcb@title@code{#1}},%
  title code pre/.code={\preto\tcb@title@code{#1}},%
  %
  underlay unbroken pre/.code={\preto\tcb@underlay@unbroken{#1}},%
  underlay first pre/.code={\preto\tcb@underlay@first{#1}},%
  underlay middle pre/.code={\preto\tcb@underlay@middle{#1}},%
  underlay last pre/.code={\preto\tcb@underlay@last{#1}},%
  underlay boxed title pre/.code={\preto\tcb@underlay@boxedtitle{#1}},%
  underlay pre/.style={underlay unbroken pre={#1},underlay first pre={#1},underlay middle pre={#1},underlay last pre={#1}},%
  underlay broken pre/.style={underlay first pre={#1},underlay middle pre={#1},underlay last pre={#1}},%
  underlay unbroken and first pre/.style={underlay unbroken pre={#1},underlay first pre={#1}},%
  underlay unbroken and last pre/.style={underlay unbroken pre={#1},underlay last pre={#1}},%
  underlay middle and last pre/.style={underlay middle pre={#1},underlay last pre={#1}},%
  finish unbroken pre/.code={\preto\tcb@finish@unbroken{#1}},%
  finish first pre/.code={\preto\tcb@finish@first{#1}},%
  finish middle pre/.code={\preto\tcb@finish@middle{#1}},%
  finish last pre/.code={\preto\tcb@finish@last{#1}},%
  finish pre/.style={finish unbroken pre={#1},finish first pre={#1},finish middle pre={#1},finish last pre={#1}},%
  finish broken pre/.style={finish first pre={#1},finish middle pre={#1},finish last pre={#1}},%
  finish unbroken and first pre/.style={finish unbroken pre={#1},finish first pre={#1}},%
  finish unbroken and last pre/.style={finish unbroken pre={#1},finish last pre={#1}},%
  finish middle and last pre/.style={finish middle pre={#1},finish last pre={#1}},%
  %
  watermark tikz app/.style={overlay app={\tcb@drawspec@watermark@tikz{#1}}},
  watermark tikz pre/.style={overlay pre={\tcb@drawspec@watermark@tikz{#1}}},
  watermark tikz app on/.style args={#1 is #2}{overlay #1 app={\tcb@drawspec@watermark@tikz{#2}}},%
  watermark tikz pre on/.style args={#1 is #2}{overlay #1 pre={\tcb@drawspec@watermark@tikz{#2}}},%
  watermark graphics app/.style={overlay app={\tcb@drawspec@watermark@graphics{#1}}},
  watermark graphics pre/.style={overlay pre={\tcb@drawspec@watermark@graphics{#1}}},
  watermark graphics app on/.style args={#1 is #2}{overlay #1 app={\tcb@drawspec@watermark@graphics{#2}}},
  watermark graphics pre on/.style args={#1 is #2}{overlay #1 pre={\tcb@drawspec@watermark@graphics{#2}}},
  watermark text app/.style={overlay app={\tcb@drawspec@watermark@text{#1}}},
  watermark text pre/.style={overlay pre={\tcb@drawspec@watermark@text{#1}}},
  watermark text app on/.style args={#1 is #2}{overlay #1 app={\tcb@drawspec@watermark@text{#2}}},
  watermark text pre on/.style args={#1 is #2}{overlay #1 pre={\tcb@drawspec@watermark@text{#2}}},
}


tcblistings.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcblistings.code.tex: Code for colorboxes with listings
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\RequirePackage{listings}[2007/02/22]

\tcbuselibrary{listings@core}

\let\tcb@listing@MakeCaption@org=\lst@MakeCaption

\def\tcb@listing@set@MakeCaption@org{%
  \let\lst@MakeCaption\tcb@listing@MakeCaption@org}
\def\tcb@listing@set@MakeCaption@empty{%
  \lst@HRefStepCounter{lstlisting}%
  \let\lst@MakeCaption\@gobble}

\lstdefinestyle{tcblatex}{language={[LaTeX]TeX},
     aboveskip={0\p@ \@plus 6\p@}, belowskip={0\p@ \@plus 6\p@},
     columns=fullflexible, keepspaces=true,
     breaklines=true, breakatwhitespace=true,
     basicstyle=\ttfamily\small, extendedchars=true, nolol,
     inputencoding=\kvtcb@listingencoding}

\def\tcb@listing@input@listing#1#2{%
  \begingroup%
  \toks@=\expandafter{#1}%
  \edef\tcb@temp{\noexpand\lstinputlisting[nolol,\the\toks@]}%
  \tcb@listing@set@MakeCaption%
  \tcb@temp{#2}%
  \endgroup%
}%


\def\tcb@listing@uselistinglisting{%
  \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@listingfile}%
}%

\def\tcb@listing@usetemplisting{%
  \tcb@listing@input@listing{\kvtcb@listingoptions}{\kvtcb@tempfile}%
}%

\def\tcb@listing@doc@usetemplisting{%
  \tcb@listing@input@listing{\kvtcb@doclistingoptions}{\kvtcb@tempfile}%
}

\tcbset{%
  listing options/.store in=\kvtcb@listingoptions,%
  listing style/.style={listing options={style=#1}},%
  no listing options/.style={listing options=},%
  listing inputencoding/.store in=\kvtcb@listingencoding,%
  listing remove caption/.is choice,
  listing remove caption/true/.code={\let\tcb@listing@set@MakeCaption\tcb@listing@set@MakeCaption@empty},
  listing remove caption/false/.code={\let\tcb@listing@set@MakeCaption\tcb@listing@set@MakeCaption@org},
  listing remove caption/.default=true,
  listing engine/listings/.code={\let\tcbuselistinglisting\tcb@listing@uselistinglisting%
    \let\tcbusetemplisting\tcb@listing@usetemplisting%
    \let\tcb@doc@usetemplisting\tcb@listing@doc@usetemplisting},
  every listing line/.code={%
    \def\lst@NewLine{%
      \ifx\lst@OutputBox\@gobble\else
          \par\noindent \hbox{}#1%
      \fi
      \global\advance\lst@newlines\m@ne
      \lst@newlinetrue}},%
  every listing line*/.style={every listing line={#1},%
    code={\setbox\z@=\hbox{#1}\tcbdimto\kvtcb@rightupper{\kvtcb@rightupper+\wd\z@}}},%
}


\tcbset{%
  reset@listings/.style={%
    listing style=tcblatex,
    listing inputencoding=\inputencodingname,
    listing remove caption,
    listing engine=listings,
  },
  initialize@reset=reset@listings,
}


tcblistingscore.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcblistingscode.code.tex: Auxiliary code for colorboxes with listings
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\def\tcbuselistingtext{\input{\kvtcb@listingfile}}%
\def\tcbuselistingcomment{\kvtcb@listingcomment}%
\def\tcb@listing@listing{\tcbuselistinglisting}

\def\tcb@listing@listingAndOther{%
   \tcbuselistinglisting%
   \tcblower%
   \tcb@use@listing@other%
}

\def\tcb@listing@otherAndListing{%
   \tcb@use@listing@other%
   \tcblower%
   \tcbuselistinglisting%
}

\newenvironment{tcb@lower@outside}[1]{%
  \tcbset{savedelimiter=tcb@lower@outside}\tcb@minipage{#1}%
  \color{\kvtcb@collower}\kvtcb@fontlower\kvtcb@before@lower\ignorespaces}%
  {\unskip\kvtcb@after@lower\endminipage}

\def\tcb@use@lower@outside#1{%
  \setbox\z@=\hbox{\begin{tcb@lower@outside}{#1}%
    \stepcounter{tcblayer}%
    \tcb@use@listing@other%
    \addtocounter{tcblayer}{-1}%
  \end{tcb@lower@outside}}%
  \tcbdimto{\tcb@temp@wd}{\wd\z@}%
  \unhbox\z@%
}

\def\tcb@inputlisting@out@otherAboveListing{%
  \kvtcb@beforebox\noindent%
  \iftcb@lowervisible%
    \tcb@use@lower@outside{\kvtcb@width}%
    \par\vskip-\parskip\vspace*{\kvtcb@middle}\noindent%
  \fi%
  \begin{tcolorbox}[before=,savedelimiter=tcolorbox]\tcbuselistinglisting\end{tcolorbox}%
}

\def\tcb@inputlisting@out@listingAboveOther{%
  \begin{tcolorbox}[after=,savedelimiter=tcolorbox]\tcbuselistinglisting\end{tcolorbox}%
  \iftcb@lowervisible\par\vskip-\parskip\vspace*{\kvtcb@middle}\noindent%
    \tcb@use@lower@outside{\kvtcb@width}%
  \fi%
  \kvtcb@afterbox%
}

\newenvironment{tcb@outside@environment}{%
  \tcb@before@unbroken%
  \begin{minipage}{\tcb@width}}%
{%
  \end{minipage}%
  \tcb@after@unbroken}

\def\tcb@inputlisting@out@prepare{%
  \tcbdimto\tcb@width{\kvtcb@width}%
  \tcbdimto\tcb@innerwidth{\tcb@width-\kvtcb@left@rule-\kvtcb@right@rule}%
  \tcbdimto\tcb@temp{\tcb@innerwidth-\kvtcb@boxsep*2}%
  \tcbdimto\tcb@w@upper{\tcb@temp-\kvtcb@leftupper-\kvtcb@rightupper}%
  \tcbset{breakable@false}%
  \def\tcb@minipage{\csname tcb@minipage@\kvtcb@sbs@align\endcsname}%
  \tcbdimto\tcb@w@upper@real{\tcb@w@upper}%
  \tcbdimto\tcb@w@sbs{\tcb@w@upper@real-\kvtcb@sbs@gap}%
  \tcb@sbs@quota%
  \ifx\kvtcb@float\@empty%
    \let\tcb@before@unbroken=\kvtcb@beforebox%
    \let\tcb@after@unbroken=\kvtcb@afterbox%
  \else%
    \edef\tcb@before@unbroken{\noexpand\tcb@float@env@begin{tcbfloat}[\kvtcb@float]}%
    \let\tcb@after@unbroken=\tcb@float@env@end%
  \fi%
}

\def\tcb@inputlisting@out@listingAndOther{%
  \tcb@inputlisting@out@prepare%
  \tcbdimto\tcb@w@outside{\tcb@w@lower}%
  \tcbdimto\tcb@w@inside{\tcb@width-\tcb@w@lower-\kvtcb@sbs@gap}%
  \begin{tcb@outside@environment}%
  \tcb@minipage{\tcb@w@inside}%
  \begin{tcolorbox}[width=\tcb@w@inside,nobeforeafter,nofloat,sidebyside=false,savedelimiter=tcolorbox]\tcbuselistinglisting\end{tcolorbox}%
  \endminipage\kern\kvtcb@sbs@gap%
  \iftcb@lowervisible%
    \tcb@use@lower@outside{\tcb@w@outside}%
  \fi%
  \end{tcb@outside@environment}%
}

\def\tcb@inputlisting@out@otherAndListing{%
  \tcb@inputlisting@out@prepare%
  \tcbdimto\tcb@w@outside{\tcb@w@upper}%
  \tcbdimto\tcb@w@inside{\tcb@width-\tcb@w@upper-\kvtcb@sbs@gap}%
  \begin{tcb@outside@environment}%
  \iftcb@lowervisible%
    \tcb@use@lower@outside{\tcb@w@outside}%
    \tcbdimto{\tcb@temp@wd}{\tcb@w@outside-\tcb@temp@wd+\kvtcb@sbs@gap}%
  \else%
    \tcbdimto{\tcb@temp@wd}{\tcb@w@outside+\kvtcb@sbs@gap}%
  \fi%
  \kern\tcb@temp@wd\tcb@minipage{\tcb@w@inside}%
  \begin{tcolorbox}[width=\tcb@w@inside,nobeforeafter,nofloat,sidebyside=false,savedelimiter=tcolorbox]\tcbuselistinglisting\end{tcolorbox}%
  \endminipage%
  \end{tcb@outside@environment}%
}

\def\tcb@inputlisting@inside{%
  \begin{tcolorbox}[capture=\tcb@listing@capture,savedelimiter=tcolorbox]\tcb@listing@process\end{tcolorbox}%
}

\tcbset{%
  listing file/.store in=\kvtcb@listingfile,%
  comment/.store in=\kvtcb@listingcomment,%
  listing@process@inside/.code 2 args={%
    \let\tcb@inputlisting\tcb@inputlisting@inside%
    \let\tcb@listing@process=#1%
    \let\tcb@use@listing@other=#2},%
  listing@process@outside/.code 2 args={%
    \let\tcb@inputlisting=#1%
    \let\tcb@use@listing@other=#2},%
  listing only/.style={listing@process@inside={\tcb@listing@listing}{\tcbuselistingtext}},%
  text only/.style={listing@process@inside={\tcbuselistingtext}{\tcbuselistingtext}},%
  listing and text/.style={listing@process@inside={\tcb@listing@listingAndOther}{\tcbuselistingtext}},%
  text and listing/.style={listing@process@inside={\tcb@listing@otherAndListing}{\tcbuselistingtext}},%
  text above listing/.style={listing@process@outside={\tcb@inputlisting@out@otherAboveListing}{\tcbuselistingtext}},%
  listing above text/.style={listing@process@outside={\tcb@inputlisting@out@listingAboveOther}{\tcbuselistingtext}},%
  text outside listing/.style={listing@process@outside={\tcb@inputlisting@out@otherAndListing}{\tcbuselistingtext}},%
  listing outside text/.style={listing@process@outside={\tcb@inputlisting@out@listingAndOther}{\tcbuselistingtext}},%
  text side listing/.style={sidebyside,text and listing},%
  listing side text/.style={sidebyside,listing and text},%
  listing and comment/.style={listing@process@inside={\tcb@listing@listingAndOther}{\tcbuselistingcomment}},%
  comment and listing/.style={listing@process@inside={\tcb@listing@otherAndListing}{\tcbuselistingcomment}},%
  comment above listing/.style={listing@process@outside={\tcb@inputlisting@out@otherAboveListing}{\tcbuselistingcomment}},%
  listing above comment/.style={listing@process@outside={\tcb@inputlisting@out@listingAboveOther}{\tcbuselistingcomment}},%
  comment outside listing/.style={listing@process@outside={\tcb@inputlisting@out@otherAndListing}{\tcbuselistingcomment}},%
  listing outside comment/.style={listing@process@outside={\tcb@inputlisting@out@listingAndOther}{\tcbuselistingcomment}},%
  comment side listing/.style={sidebyside,comment and listing},%
  listing side comment/.style={sidebyside,listing and comment},%
  listing engine/.is choice,%
  image comment/.style 2 args={comment={\includegraphics[#1]{#2}}},
}

\newenvironment{tcblisting}[1]{%
  \def\tcblisting@box{\tcbinputlisting{#1}}%
  \begingroup\tcbverbatimwrite{\kvtcb@listingfile}%
}{\endtcbverbatimwrite\endgroup%
  \tcblisting@box%
}

\long\def\tcbinputlisting#1{%
  \begingroup%
  \tcb@layer@pushup%
  \tcbset{capture=minipage,#1}\tcb@afteroptions@hook%
  \let\tcb@listing@capture=\kvtcb@capture%
  \tcb@inputlisting\endgroup%
}

\newenvironment{tcboutputlisting}{%
  \begingroup\tcbverbatimwrite{\kvtcb@listingfile}%
}{\endtcbverbatimwrite\endgroup}

\long\def\tcb@newtcblisting#1#2{\tcb@newenvironment{#1}{\tcblisting{#2,options@for=#1}}{\endtcblisting}}

\long\def\tcb@newtcblisting@#1[#2]#3{\tcb@newenvironment{#1}[#2]{\tcblisting{#3,options@for=#1}}{\endtcblisting}}

\long\def\tcb@newtcblisting@@#1[#2][#3]#4{\tcb@newenvironment{#1}[#2][#3]{\tcblisting{#4,options@for=#1}}{\endtcblisting}}

\long\def\tcb@new@tcblisting@#1[#2]{%
  \@ifnextchar[{\tcb@newtcblisting@@{#1}[#2]}{\tcb@newtcblisting@{#1}[#2]}}

\def\tcb@new@tcblisting#1{%
  \@ifnextchar[{\tcb@new@tcblisting@{#1}}{\tcb@newtcblisting{#1}}}

\def\newtcblisting{%
  \let\tcb@newenvironment\newenvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcblisting%
  \tcb@process@newenvironment}

\def\renewtcblisting{%
  \let\tcb@newenvironment\renewenvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcblisting%
  \tcb@process@newenvironment}

\long\def\tcb@newtcbinputlisting#1#2{\expandafter\tcb@newcommand\csname#1\endcsname{\tcbinputlisting{#2,options@for=#1}}}

\long\def\tcb@newtcbinputlisting@#1[#2]#3{\expandafter\tcb@newcommand\csname#1\endcsname[#2]{\tcbinputlisting{#3,options@for=#1}}}

\long\def\tcb@newtcbinputlisting@@#1[#2][#3]#4{\expandafter\tcb@newcommand\csname#1\endcsname[#2][#3]{\tcbinputlisting{#4,options@for=#1}}}

\long\def\tcb@new@tcbinputlisting@#1[#2]{%
  \@ifnextchar[{\tcb@newtcbinputlisting@@{#1}[#2]}{\tcb@newtcbinputlisting@{#1}[#2]}}

\def\tcb@new@tcbinputlisting#1{%
  \@ifnextchar[{\tcb@new@tcbinputlisting@{#1}}{\tcb@newtcbinputlisting{#1}}}

\def\newtcbinputlisting{%
  \let\tcb@newcommand\newcommand%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcbinputlisting%
  \tcb@process@newcommand}

\def\renewtcbinputlisting{%
  \let\tcb@newcommand\renewcommand%
  \let\tcb@process@newtcolorbox@continue\tcb@new@tcbinputlisting%
  \tcb@process@newcommand}

\tcbset{%
  reset@listingscore/.style={%
    listing file=\jobname.listing,
    comment=,
    listing and text,
  },
  initialize@reset=reset@listingscore,
}


tcblistingsutf8.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcblistingsutf8.code.tex: Code for colorboxes with listings in UTF-8
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{3.04}

\RequirePackage{listingsutf8}[2011/11/10]
\tcbuselibrary{listings}

\tcbset{
  listing utf8/.style={listing inputencoding=utf8/#1},
}

\tcbset{%
  reset@listingsutf8/.style={listing utf8=latin1},
  initialize@reset=reset@listingsutf8,
}


tcbminted.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbminted.code.tex: Code for colorboxes with listings
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\RequirePackage{minted}[2011/09/17]

\tcbuselibrary{listings@core}

\def\tcb@minted@input@listing#1#2#3#4{%
  \edef\temp@a{#4}%
  \ifx\temp@a\@empty%
  \else
    \usemintedstyle{\temp@a}%
  \fi%
  \toks@=\expandafter{#1}%
  \edef\tcb@temp{\noexpand\inputminted[\the\toks@]}%
  \tcb@temp{#2}{#3}%
}

\def\tcb@minted@uselistinglisting{%
  \tcb@minted@input@listing{\kvtcb@minted@options}{\kvtcb@minted@language}{\kvtcb@listingfile}{\kvtcb@minted@style}%
}%

\def\tcb@minted@usetemplisting{%
  \tcb@minted@input@listing{\kvtcb@minted@options}{\kvtcb@minted@language}{\kvtcb@tempfile}{\kvtcb@minted@style}%
}%

\def\tcb@minted@doc@usetemplisting{%
  \tcb@minted@input@listing{\kvtcb@docmintoptions}{latex}{\kvtcb@tempfile}{\kvtcb@docmintstyle}%
}

\tcbset{%
  minted language/.store in=\kvtcb@minted@language,
  minted options/.store in=\kvtcb@minted@options,
  minted style/.store in=\kvtcb@minted@style,
  listing engine/minted/.code={\let\tcbuselistinglisting\tcb@minted@uselistinglisting%
    \let\tcbusetemplisting\tcb@minted@usetemplisting%
    \let\tcb@doc@usetemplisting\tcb@minted@doc@usetemplisting},
}


\tcbset{%
  reset@minted/.style={%
    minted language=latex,
    minted options={tabsize=2,fontsize=\small},
    minted style=,
    listing engine=minted,
  },
  initialize@reset=reset@minted,
}


tcbskins.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbskins.code.tex: Code for colorboxes with different skins
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{3.04}

\RequirePackage{tikz}[2010/10/13]

\newenvironment{tikzpicture@tcb@hooked}{%
  \edef\tcb@tikzpicture@begin{\noexpand\tikzpicture[\expandonce\tcb@tikz@option@hook]}%
  \tcb@tikzpicture@begin\tcb@tikz@begin@hook}{\tcb@tikz@end@hook\endtikzpicture}

\def\tcb@creategeonodes@true{%
  \begin{scope}[every node/.style={line width=0mm,inner sep=0mm,outer sep=0mm,draw=none,fill=none,rectangle}]
    \node[name=frame,at={(0,0)},above right,minimum width=\tcb@width,minimum height=\tcb@height]{};
    \node[name=interior,at={({\kvtcb@left@rule},{\kvtcb@bottom@rule})},above right,minimum width=\tcb@innerwidth,minimum height=\tcb@innerheight]{};
    \ifnum\tcb@segment@state=1%
    \node[name=segmentation,at={({\kvtcb@left@rule},{\the\dimexpr\kvtcb@bottom@rule+\kvtcb@boxsep*2+\tcb@break@bottomsep+\kvtcb@bottom+\tcb@height@lower\relax})},above right,
       minimum width=\tcb@innerwidth,minimum height=\the\dimexpr\kvtcb@middle*2\relax]{};
    \else\iftcb@sidebyside%
    \node[name=segmentation,at={({\the\dimexpr\kvtcb@left@rule+\kvtcb@boxsep+\kvtcb@leftupper+\tcb@w@upper\relax},{\the\dimexpr\kvtcb@bottom@rule\relax})},above right,
       minimum width=\the\dimexpr\kvtcb@sbs@gap\relax,minimum height=\tcb@innerheight]{};
    \fi\fi%
    \iftcb@hasTitle%
    \node[name=title,at={({\kvtcb@left@rule},{\the\dimexpr\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule\relax})},above right,
       minimum width=\tcb@innerwidth,minimum height=\the\dimexpr\tcb@h@title+\kvtcb@toptitle+\kvtcb@bottomtitle+\kvtcb@boxsep*2\relax]{};
    \fi%
    \tcb@specialgeonodes@hook%
  \end{scope}%
}

\def\tcb@spec#1{\tikzset{tcb@spec/.style={#1}}}

\def\tcb@gettikzxy#1#2#3{%
  \tikz@scan@one@point\pgfutil@firstofone#1\relax%
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}

\def\tcb@boundary@tikzbase#1#2#3#4#5#6{%
  \tcb@gettikzxy{(#1)}{\tcb@xa}{\tcb@ya}%
  \tcb@gettikzxy{(#2)}{\tcb@xb}{\tcb@yb}%
  \pgfpathmoveto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  #4\pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@yb}}%
  #5\pgfpathlineto{\pgfqpoint{\tcb@xb}{\tcb@yb}}%
  #6\pgfpathlineto{\pgfqpoint{\tcb@xb}{\tcb@ya}}%
  #3\pgfpathclose%
}

\def\tcb@pathboundary#1#2{\path[#1]\pgfextra{#2};}

\def\tcb@pathbase#1#2#3#4#5#6#7{\tcb@pathboundary{#1}{\tcb@boundary@tikzbase{#2}{#3}{#4}{#5}{#6}{#7}}}

\def\tcb@boundaryframe@pathfirst{%
  \tcb@boundary@base{0pt}{0pt}%
    {\tcb@width}{\tcb@height}%
    {\tcb@arc@zpt}{\tcb@arc@out}{\tcb@arc@out}{\tcb@arc@zpt}%
}

\def\tcb@boundaryframe@pathmiddle{%
  \tcb@boundary@base{0pt}{0pt}%
    {\tcb@width}{\tcb@height}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@boundaryframe@pathlast{%
  \tcb@boundary@base{0pt}{0pt}%
    {\tcb@width}{\tcb@height}%
    {\tcb@arc@out}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@out}%
}

\tikzset{%
  tcb fill frame/.style={fill=\kvtcb@colframe,fill opacity=\kvtcb@opacityframe,tcb@spec,frame@style},%
  tcb fill interior/.style={fill=\kvtcb@colback,fill opacity=\kvtcb@opacityback,tcb@spec,interior@style},%
  tcb fill title/.style={fill=\kvtcb@colbacktitle,fill opacity=\kvtcb@opacitybacktitle,tcb@spec,title@style},%
}

% fill frame
\def\tcb@drawframe@path{\tcb@pathboundary{tcb fill frame}{\tcb@outerboundary}}
\let\tcb@drawframe@pathfirst=\tcb@drawframe@path
\let\tcb@drawframe@pathmiddle=\tcb@drawframe@path
\let\tcb@drawframe@pathlast=\tcb@drawframe@path


% fill inner box with title
\def\tcb@drawwithtitle@path{\tcb@pathboundary{tcb fill interior}{\tcb@boundaryinterior@title@standard}}

\def\tcb@drawwithtitle@pathfirst{%
  \tcb@pathbase{tcb fill interior}{interior.west|-frame.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\let\tcb@drawwithtitle@pathmiddle=\tcb@drawwithtitle@pathfirst

\let\tcb@drawwithtitle@pathlast=\tcb@drawwithtitle@path

% fill inner box without title
\def\tcb@drawwithouttitle@path{\tcb@pathboundary{tcb fill interior}{\tcb@boundaryinterior@notitle@standard}}

\def\tcb@drawwithouttitle@pathfirst{%
  \tcb@pathbase{tcb fill interior}{interior.west|-frame.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@ins}{\tcb@arc@ins}{\tcb@arc@zpt}%
}

\def\tcb@drawwithouttitle@pathmiddle{%
  \tcb@pathbase{tcb fill interior}{interior.west|-frame.south}{interior.east|-frame.north}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawwithouttitle@pathlast{%
  \tcb@pathbase{tcb fill interior}{interior.south west}{interior.east|-frame.north}%
    {\tcb@arc@ins}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}%
}

% draw title box
\def\tcb@drawtitle@path{\tcb@pathboundary{tcb fill title}{\tcb@boundarytitle@standard}}

\let\tcb@drawtitle@pathfirst=\tcb@drawtitle@path

\def\tcb@drawtitle@pathmiddle{%
  \tcb@pathbase{tcb fill title}{title.south west}{title.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\let\tcb@drawtitle@pathlast=\tcb@drawtitle@pathmiddle

% draw segmentation line
\def\tcb@drawlower@path{%
  \iftcb@sidebyside%
    \path[draw=\kvtcb@colframe,fill opacity=\kvtcb@opacityframe,dash pattern=on 1mm off 1mm,dash phase=0.5mm,tcb@spec,segmentation@style]
    (segmentation.north)--(segmentation.south);%
  \else%
    \path[draw=\kvtcb@colframe,fill opacity=\kvtcb@opacityframe,dash pattern=on 1mm off 1mm,dash phase=0.5mm,tcb@spec,segmentation@style]
    (segmentation.west)--(segmentation.east);%
  \fi%
}

\long\def\tcb@pseudo@segmentation#1{%
{\parskip\z@\par\nointerlineskip\hfilneg\kern-\@totalleftmargin}\begingroup%
\tcb@shield@externalize\begin{tikzpicture}%
  \path[use as bounding box] (0,{\the\dimexpr-\kvtcb@middle-\kvtcb@boxsep\relax})
     rectangle (\linewidth,{\the\dimexpr\kvtcb@middle+\kvtcb@boxsep\relax});
  \node[line width=0mm,inner sep=0mm,draw=none,fill=none,rectangle,
        name=segmentation,at={({\the\dimexpr-#1-\kvtcb@boxsep\relax},0)},right,%
        minimum width=\tcb@innerwidth,minimum height=\the\dimexpr\kvtcb@middle*2\relax]{};
  \tcb@drawlower@path%
\end{tikzpicture}%
\endgroup{\parskip\z@\par\nointerlineskip}%
}

\def\tcbline{\iftcb@hasLower\tcb@pseudo@segmentation{\kvtcb@leftlower}%
  \else\tcb@pseudo@segmentation{\kvtcb@leftupper}\fi}


% draw special versions
\def\tcb@drawspec@UT{%
  \tcb@pathbase{tcb fill interior}{segmentation.west}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@UR{%
  \tcb@pathbase{tcb fill interior}{segmentation.west}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@ins}{\tcb@arc@ins}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@US{%
  \tcb@pathbase{tcb fill interior}{segmentation.west}{interior.east|-frame.north}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@LR#1{%
  \tcb@pathbase{#1,segmentation@style}{interior.south west}{[yshift=0.1mm]segmentation.east}%
    {\tcb@arc@ins}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}%
}

\def\tcb@drawspec@LS#1{%
  \tcb@pathbase{#1,segmentation@style}{interior.west|-frame.south}{[yshift=0.1mm]segmentation.east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@sbs@A#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}{\tcb@arc@ins}%
}

\def\tcb@drawspec@sbs@B#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}%
}

\def\tcb@drawspec@sbs@C#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south|-frame.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@sbs@D#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south|-frame.south}{interior.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@sbs@E#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south|-frame.south}{interior.east|-frame.north}%
  {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawspec@sbs@F#1{%
  \tcb@pathbase{#1,segmentation@style}{segmentation.south}{interior.east|-frame.north}%
  {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}%
}

\def\tcb@drawspec@T{%
  \tcb@pathbase{top color=\kvtcb@colframe,bottom color=\kvtcb@colback,fill opacity=\kvtcb@opacitybacktitle}{[yshift=-0.01pt]interior.north west}{[yshift=0.01pt]title.south east}%
  {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@drawframe@freelance{\tcb@frame@code}
\def\tcb@drawwithtitle@freelance{\tcb@interiortitled@code}
\def\tcb@drawwithouttitle@freelance{\tcb@interior@code}
\def\tcb@drawlower@freelance{\tcb@segmentation@code}
\def\tcb@drawtitle@freelance{\tcb@title@code}


\def\tcb@drawframe@spartan{%
  \begin{pgfscope}%
  \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \pgfsetfillcolor{\kvtcb@colframe}%
  \pgfsetfillopacity{\kvtcb@opacityframe}%
  \pgfusepath{fill}%
  \end{pgfscope}%
}

\def\tcb@drawwithtitle@spartan{%
  \begin{pgfscope}%
  \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\kvtcb@bottom@rule}}%
   {\pgfqpoint{\the\dimexpr\tcb@width-\kvtcb@right@rule\relax}{\the\dimexpr\kvtcb@bottom@rule+\tcb@innerheight\relax}}%
  \pgfsetfillcolor{\kvtcb@colback}%
  \pgfsetfillopacity{\kvtcb@opacityback}%
  \pgfusepath{fill}%
  \end{pgfscope}%
}

\def\tcb@drawwithouttitle@spartan{%
  \begin{pgfscope}%
  \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\kvtcb@bottom@rule}}%
   {\pgfqpoint{\the\dimexpr\tcb@width-\kvtcb@right@rule\relax}{\the\dimexpr\tcb@height-\kvtcb@top@rule\relax}}%
  \pgfsetfillcolor{\kvtcb@colback}%
  \pgfsetfillopacity{\kvtcb@opacityback}%
  \pgfusepath{fill}%
  \end{pgfscope}%
}

\def\tcb@drawtitle@spartan{%
  \begin{pgfscope}%
  \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\the\dimexpr\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule\relax}}%
   {\pgfqpoint{\the\dimexpr\tcb@width-\kvtcb@right@rule\relax}{\the\dimexpr\tcb@height-\kvtcb@top@rule\relax}}%
  \pgfsetfillcolor{\kvtcb@colbacktitle}%
  \pgfsetfillopacity{\kvtcb@opacitybacktitle}%
  \pgfusepath{fill}%
  \end{pgfscope}%
}

\def\tcb@drawlower@spartan{%
  \begin{pgfscope}%
  \iftcb@sidebyside%
  \tcbdimto\tcb@seg@pos{\kvtcb@left@rule+\kvtcb@boxsep+\kvtcb@leftupper+\tcb@w@upper+\kvtcb@sbs@gap/2}%
  \pgfpathmoveto{\pgfqpoint{\tcb@seg@pos}{\the\dimexpr\kvtcb@bottom@rule+\tcb@innerheight\relax}}%
  \pgfpathlineto{\pgfqpoint{\tcb@seg@pos}{\kvtcb@bottom@rule}}%
  \else%
  \tcbdimto\tcb@seg@pos{\kvtcb@bottom@rule+\kvtcb@boxsep*2+\tcb@break@bottomsep+\kvtcb@middle+\kvtcb@bottom+\tcb@height@lower}%
  \pgfpathmoveto{\pgfqpoint{\kvtcb@left@rule}{\tcb@seg@pos}}%
  \pgfpathlineto{\pgfqpoint{\the\dimexpr\tcb@width-\kvtcb@right@rule\relax}{\tcb@seg@pos}}%
  \fi%
  \pgfsetcolor{\kvtcb@colframe}%
  \pgfsetstrokeopacity{\kvtcb@opacityframe}%
  \pgfusepath{stroke}%
  \end{pgfscope}%
}


\tcbset{%
  frame style/.code={\tikzset{frame@style/.style={#1}}},%
  frame hidden/.style={frame style={draw=none,fill=none}},
  frame engine/path/.style={frame code=\tcb@drawframe@path},
  frame engine/pathfirst/.style={frame code=\tcb@drawframe@pathfirst},
  frame engine/pathmiddle/.style={frame code=\tcb@drawframe@pathmiddle},
  frame engine/pathlast/.style={frame code=\tcb@drawframe@pathlast},
  frame engine/freelance/.style={frame code=\tcb@drawframe@standard},
  frame engine/spartan/.style={frame code=\tcb@drawframe@spartan},
  frame engine/empty/.style={frame code=},
  %
  interior titled engine/path/.style={interior titled code=\tcb@drawwithtitle@path},
  interior titled engine/pathfirst/.style={interior titled code=\tcb@drawwithtitle@pathfirst},
  interior titled engine/pathmiddle/.style={interior titled code=\tcb@drawwithtitle@pathmiddle},
  interior titled engine/pathlast/.style={interior titled code=\tcb@drawwithtitle@pathlast},
  interior titled engine/freelance/.style={interior titled code=\tcb@drawwithtitle@standard},
  interior titled engine/spartan/.style={interior titled code=\tcb@drawwithtitle@spartan},
  interior titled engine/empty/.style={interior titled code=},
  %
  interior engine/path/.style={interior code=\tcb@drawwithouttitle@path},
  interior engine/pathfirst/.style={interior code=\tcb@drawwithouttitle@pathfirst},
  interior engine/pathmiddle/.style={interior code=\tcb@drawwithouttitle@pathmiddle},
  interior engine/pathlast/.style={interior code=\tcb@drawwithouttitle@pathlast},
  interior engine/freelance/.style={interior code=\tcb@drawwithouttitle@standard},
  interior engine/spartan/.style={interior code=\tcb@drawwithouttitle@spartan},
  interior engine/empty/.style={interior code=},
  %
  segmentation engine/path/.style={segmentation code=\tcb@drawlower@path},
  segmentation engine/freelance/.style={segmentation code=\tcb@drawlower@standard},
  segmentation engine/spartan/.style={segmentation code=\tcb@drawlower@spartan},
  segmentation engine/empty/.style={segmentation code=},
  %
  title engine/path/.style={@title code=\tcb@drawtitle@path},
  title engine/pathfirst/.style={@title code=\tcb@drawtitle@pathfirst},
  title engine/pathmiddle/.style={@title code=\tcb@drawtitle@pathmiddle},
  title engine/pathlast/.style={@title code=\tcb@drawtitle@pathlast},
  title engine/freelance/.style={@title code=\tcb@drawtitle@standard},
  title engine/spartan/.style={@title code=\tcb@drawtitle@spartan},
  title engine/empty/.style={@title code=},
  %
  interior style/.code={\tikzset{interior@style/.style={#1}}},%
  interior hidden/.style={interior style={draw=none,fill=none}},
  segmentation style/.code={\tikzset{segmentation@style/.style={#1}}},%
  segmentation hidden/.style={segmentation style={draw=none,fill=none}},
  @title style/.code={\tikzset{title@style/.style={#1}}},%
  title style/.style={title filled,@title style={#1}},
  title hidden/.style={title style={draw=none,fill=none}},
  colbacklower/.store in=\kvtcb@colbacklower,%
  clear@spec/.code={\tcb@spec{}},%
  tikz/.code={\appto\tcb@tikz@option@hook{,#1}},%
  tikz reset/.code={\let\tcb@tikz@option@hook\@empty},%
  at begin tikz/.code={\appto\tcb@tikz@begin@hook{#1}},%
  at begin tikz reset/.code={\let\tcb@tikz@begin@hook\@empty},%
  at end tikz/.code={\appto\tcb@tikz@end@hook{#1}},%
  at end tikz reset/.code={\let\tcb@tikz@end@hook\@empty},%
  rotate/.style={tikz={rotate=#1,transform shape}},%
  scale/.style={tikz={scale=#1,transform shape},%
    at begin tikz={%
    \tcbdimto\kvtcb@arc{#1\dimexpr\kvtcb@arc}%
    \tcbdimto\tcb@outer@arc{#1\dimexpr\tcb@outer@arc}%
    \def\tcb@shadow@prepare##1##2{%
      \ifdim##2>0pt\relax\tcbdimto\tcb@shadow@ts{##1-##2/2}%%
      \else\tcbdimto\tcb@shadow@ts{##1+##2/2}\fi%
      \tcbdimto\tcb@shadow@ts{#1\dimexpr\tcb@shadow@ts}%
      \ifdim\dimexpr\tcb@outer@arc>\tcb@shadow@ts\relax%
        \tcbdimto\tcb@shadow@arc{\tcb@outer@arc-\tcb@shadow@ts}%
      \else%
        \let\tcb@shadow@arc=\tcb@zpt%
      \fi%
    }}},%
  remember/.style={tikz={remember picture}},%
  remember as/.style={tikz={remember picture},at end tikz={\pgfnodealias{#1}{frame}}},%
}

\tcbset{%
  base@unbroken/.style={%
    clear@spec,graphical environment=tikzpicture@tcb@hooked,geometry nodes,%
    set@outerboundary=\tcb@boundaryframe@standard,%
    set@extensions@preframe={\tcb@draw@shadow@unbroken},%
    set@extensions@postframe={\tcb@draw@border@unbroken\tcb@apply@underlay\tcb@apply@overlay},%
    set@extensions@final={\tcb@apply@finish}%
  },%
  base@first/.style={%
    clear@spec,graphical environment=tikzpicture@tcb@hooked,geometry nodes,%
    set@outerboundary=\tcb@boundaryframe@pathfirst,%
    set@extensions@preframe={\tcb@draw@shadow@first},%
    set@extensions@postframe={\tcb@draw@border@first\tcb@apply@underlay\tcb@apply@overlay},%
    set@extensions@final={\tcb@apply@finish}%
  },%
  base@middle/.style={%
    clear@spec,graphical environment=tikzpicture@tcb@hooked,geometry nodes,%
    set@outerboundary=\tcb@boundaryframe@pathmiddle,%
    set@extensions@preframe={\tcb@draw@shadow@middle},%
    set@extensions@postframe={\tcb@draw@border@middle\tcb@apply@underlay\tcb@apply@overlay},%
    set@extensions@final={\tcb@apply@finish}%
  },%
  base@last/.style={%
    clear@spec,graphical environment=tikzpicture@tcb@hooked,geometry nodes,%
    set@outerboundary=\tcb@boundaryframe@pathlast,%
    set@extensions@preframe={\tcb@draw@shadow@last},%
    set@extensions@postframe={\tcb@draw@border@last\tcb@apply@underlay\tcb@apply@overlay},%
    set@extensions@final={\tcb@apply@finish}%
  },%
}

\tcb@new@skin{enhanced}{base@unbroken,%
  frame engine=path,interior titled engine=path,interior engine=path,segmentation engine=path,title engine=path,%
  skin first=enhancedfirst,skin middle=enhancedmiddle,skin last=enhancedlast}

\tcb@new@skin{enhancedfirst}{base@first,%
  frame engine=pathfirst,interior titled engine=pathfirst,interior engine=pathfirst,segmentation engine=path,title engine=pathfirst,%
  skin first=enhancedfirst,skin middle=enhancedmiddle,skin last=enhancedmiddle}

\tcb@new@skin{enhancedmiddle}{base@middle,%
  frame engine=pathmiddle,interior titled engine=pathmiddle,interior engine=pathmiddle,segmentation engine=path,title engine=pathmiddle,%
  skin first=enhancedmiddle,skin middle=enhancedmiddle,skin last=enhancedmiddle}

\tcb@new@skin{enhancedlast}{base@last,%
  frame engine=pathlast,interior titled engine=pathlast,interior engine=pathlast,segmentation engine=path,title engine=pathlast,%
  skin first=enhancedmiddle,skin middle=enhancedmiddle,skin last=enhancedlast}

\tcbset{enhanced/.style={skin=enhanced},%
  enhanced standard/.style={skin=enhanced,
    skin first=enhanced,skin middle=enhanced,skin last=enhanced},%
  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}}

\tcb@new@skin{empty}{base@unbroken,%
  frame engine=empty,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=empty,%
  skin first=emptyfirst,skin middle=emptymiddle,skin last=emptylast}

\tcb@new@skin{emptyfirst}{base@first,%
  frame engine=empty,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=empty,%
  skin first=emptyfirst,skin middle=emptymiddle,skin last=emptymiddle}

\tcb@new@skin{emptymiddle}{base@middle,%
  frame engine=empty,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=empty,%
  skin first=emptymiddle,skin middle=emptymiddle,skin last=emptymiddle}

\tcb@new@skin{emptylast}{base@last,%
  frame engine=empty,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=empty,%
  skin first=emptymiddle,skin middle=emptymiddle,skin last=emptylast}

\tcbset{empty/.style={skin=empty},%
  blanker/.style={empty,arc=0pt,outer arc=0pt,boxsep=0pt,top=0pt,bottom=0pt,left=0pt,right=0pt,boxrule=0pt,%
    bottomtitle=6pt,middle=3pt}}

\tcb@new@skin{freelance}{base@unbroken,%
  frame engine=freelance,interior titled engine=freelance,interior engine=freelance,segmentation engine=freelance,title engine=freelance,%
  skin first=freelancefirst,skin middle=freelancemiddle,skin last=freelancelast}%,freelance@extension}

\tcb@new@skin{freelancefirst}{base@first,%
  frame engine=freelance,interior titled engine=freelance,interior engine=freelance,segmentation engine=freelance,title engine=freelance,%
  skin first=freelancefirst,skin middle=freelancemiddle,skin last=freelancemiddle}%,freelancefirst@extension}

\tcb@new@skin{freelancemiddle}{base@middle,%
  frame engine=freelance,interior titled engine=freelance,interior engine=freelance,segmentation engine=freelance,title engine=freelance,%
  skin first=freelancemiddle,skin middle=freelancemiddle,skin last=freelancemiddle}%,freelancemiddle@extension}

\tcb@new@skin{freelancelast}{base@last,%
  frame engine=freelance,interior titled engine=freelance,interior engine=freelance,segmentation engine=freelance,title engine=freelance,%
  skin first=freelancemiddle,skin middle=freelancemiddle,skin last=freelancelast}%,freelancelast@extension}

\tcbset{freelance/.style={skin=freelance},
  % for backward compatibility:
  extend freelance/.style={#1},%
  extend freelancefirst/.style={skin first is subskin of={freelancefirst}{#1}},%
  extend freelancemiddle/.style={skin middle is subskin of={freelancemiddle}{#1}},%
  extend freelancelast/.style={skin last is subskin of={freelancelast}{#1}}}

\tcb@new@skin{bicolor}{base@unbroken,%
  frame engine=path,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=path,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@path}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithtitle@path}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@path}%
    \fi},
  interior code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@path}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UR%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithouttitle@path}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@path}%
    \fi},
  segmentation code={\iftcb@sidebyside%
    \iftcb@hasTitle\tcb@drawspec@sbs@B{fill=\kvtcb@colbacklower}\else%
    \tcb@drawspec@sbs@A{fill=\kvtcb@colbacklower}\fi\else\tcb@drawspec@LR{fill=\kvtcb@colbacklower}\fi},%
  skin first=bicolorfirst,skin middle=bicolormiddle,skin last=bicolorlast}

\tcbset{bicolor/.style={skin=bicolor}}

\tcb@new@skin{bicolorfirst}{base@first,%
  frame engine=pathfirst,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathfirst,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathfirst}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithtitle@pathfirst}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathfirst}%
    \fi},
  interior code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathfirst}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UR%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithouttitle@pathfirst}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathfirst}%
    \fi},
  segmentation code={\iftcb@sidebyside%
    \iftcb@hasTitle\tcb@drawspec@sbs@D{fill=\kvtcb@colbacklower}\else%
    \tcb@drawspec@sbs@C{fill=\kvtcb@colbacklower}\fi\else\tcb@drawspec@LS{fill=\kvtcb@colbacklower}\fi},%
  skin first=bicolorfirst,skin middle=bicolormiddle,skin last=bicolormiddle}

\tcb@new@skin{bicolormiddle}{base@middle,%
  frame engine=pathmiddle,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathmiddle,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathmiddle}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithtitle@pathmiddle}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathmiddle}%
    \fi},%
  interior code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathmiddle}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@US%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithouttitle@pathmiddle}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathmiddle}%
    \fi},
  segmentation code={\iftcb@sidebyside%
    \iftcb@hasTitle\tcb@drawspec@sbs@D{fill=\kvtcb@colbacklower}\else%
    \tcb@drawspec@sbs@E{fill=\kvtcb@colbacklower}\fi\else\tcb@drawspec@LS{fill=\kvtcb@colbacklower}\fi},%
  skin first=bicolormiddle,skin middle=bicolormiddle,skin last=bicolormiddle}

\tcb@new@skin{bicolorlast}{base@last,%
  frame engine=pathlast,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathlast,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathlast}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithtitle@pathlast}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithtitle@pathlast}%
    \fi},
  interior code={%
    \iftcb@lowerseparated%
      \ifcase\tcb@segment@state%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathlast}%
      \or%
      \tcb@spec{fill=\kvtcb@colback}\tcb@drawspec@US%
      \else
      {\tcb@spec{fill=\kvtcb@colbacklower}\tcb@drawwithouttitle@pathlast}%
      \fi%
    \else%
      {\tcb@spec{fill=\kvtcb@colback}\tcb@drawwithouttitle@pathlast}%
    \fi},%
  segmentation code={\iftcb@sidebyside%
    \iftcb@hasTitle\tcb@drawspec@sbs@B{fill=\kvtcb@colbacklower}\else%
    \tcb@drawspec@sbs@F{fill=\kvtcb@colbacklower}\fi\else\tcb@drawspec@LR{fill=\kvtcb@colbacklower}\fi},%
  skin first=bicolormiddle,skin middle=bicolormiddle,skin last=bicolorlast}


\tikzset{beamer@color/.style={top color=\kvtcb@colback,bottom color=\kvtcb@colback!85!black}}

\tcb@new@skin{beamer}{base@unbroken,%
  frame engine=path,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=path,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1%
      \tcb@spec{beamer@color}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@path}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@path}%
    \fi%
    \tcb@drawspec@T},
  interior code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1
      \tcb@spec{beamer@color}\tcb@drawspec@UR%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@path}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@path}%
    \fi},
  segmentation code={\iftcb@sidebyside\tcb@drawlower@path\else\tcb@drawspec@LR{beamer@color}\fi},%
  skin first=beamerfirst,skin middle=beamermiddle,skin last=beamerlast}

\tcbset{beamer/.style={skin=beamer,boxrule=0mm,titlerule=1mm,toptitle=0.5mm,arc=2mm,fonttitle=\bfseries,drop fuzzy shadow}}

\tcb@new@skin{beamerfirst}{base@first,%
  frame engine=pathfirst,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathfirst,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1%
      \tcb@spec{beamer@color}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathfirst}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathfirst}%
    \fi%
    \tcb@drawspec@T},%
  interior code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1
      \tcb@spec{beamer@color}\tcb@drawspec@UR%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathfirst}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathfirst}%
    \fi},
  segmentation code={\iftcb@sidebyside\tcb@drawlower@path\else\tcb@drawspec@LS{beamer@color}\fi},%
  skin first=beamerfirst,skin middle=beamermiddle,skin last=beamermiddle}

\tcb@new@skin{beamermiddle}{base@middle,%
  frame engine=pathmiddle,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathmiddle,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1%
      \tcb@spec{beamer@color}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathmiddle}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathmiddle}%
    \fi%
    \tcb@drawspec@T},%
  interior code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1
      \tcb@spec{beamer@color}\tcb@drawspec@US%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathmiddle}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathmiddle}%
    \fi},
  segmentation code={\iftcb@sidebyside\tcb@drawlower@path\else\tcb@drawspec@LS{beamer@color}\fi},%
  skin first=beamermiddle,skin middle=beamermiddle,skin last=beamermiddle}

\tcb@new@skin{beamerlast}{base@last,%
  frame engine=pathlast,interior titled engine=empty,interior engine=empty,segmentation engine=empty,title engine=pathlast,%
  interior titled code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1%
      \tcb@spec{beamer@color}\tcb@drawspec@UT%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathlast}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithtitle@pathlast}%
    \fi%
    \tcb@drawspec@T},%
  interior code={%
    \iftcb@lowerseparated%
      \ifnum\tcb@segment@state=1
      \tcb@spec{beamer@color}\tcb@drawspec@US%
      \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathlast}%
      \fi%
    \else%
      {\tcb@spec{beamer@color}\tcb@drawwithouttitle@pathlast}%
    \fi},
  segmentation code={\iftcb@sidebyside\tcb@drawlower@path\else\tcb@drawspec@LR{beamer@color}\fi},%
  skin first=beamermiddle,skin middle=beamermiddle,skin last=beamerlast}

\def\tcb@drawspec@widgetsegment{%
  \iftcb@sidebyside%
  \tcb@drawlower@path%
  \else%
  \path[left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback,segmentation@style]
    ([yshift={-\kvtcb@middle/4}]segmentation.west) rectangle ([yshift={\kvtcb@middle/4}]segmentation.east);
  \fi%
}

\tikzset{widget@color/.style={left color=\kvtcb@colframe!75!white,right color=\kvtcb@colframe!75!white!25!\kvtcb@colback}}

\tcb@new@skin{widget}{base@unbroken,%
  frame engine=path,interior titled engine=path,interior engine=path,segmentation engine=empty,title engine=empty,%
  title code={{\tcb@spec{widget@color}\tcb@drawtitle@path}},
  segmentation code={\tcb@drawspec@widgetsegment},%
  skin first=widgetfirst,skin middle=widgetmiddle,skin last=widgetlast}

\tcbset{widget/.style={skin=widget,arc=0.5mm,fonttitle=\bfseries,titlerule=0mm,toprule at break=0mm}}

\tcb@new@skin{widgetfirst}{base@first,%
  frame engine=pathfirst,interior titled engine=pathfirst,interior engine=pathfirst,segmentation engine=empty,title engine=empty,%
  title code={{\tcb@spec{widget@color}\tcb@drawtitle@pathfirst}},%
  segmentation code={\tcb@drawspec@widgetsegment},%
  skin first=widgetfirst,skin middle=widgetmiddle,skin last=widgetmiddle}

\tcb@new@skin{widgetmiddle}{base@middle,%
  frame engine=pathmiddle,interior titled engine=pathmiddle,interior engine=pathmiddle,segmentation engine=empty,title engine=empty,%
  title code={{\tcb@spec{widget@color}\tcb@drawtitle@pathmiddle}},%
  segmentation code={\tcb@drawspec@widgetsegment},%
  skin first=widgetmiddle,skin middle=widgetmiddle,skin last=widgetmiddle}

\tcb@new@skin{widgetlast}{base@last,%
  frame engine=pathlast,interior titled engine=pathlast,interior engine=pathlast,segmentation engine=empty,title engine=empty,%
  title code={{\tcb@spec{widget@color}\tcb@drawtitle@pathlast}},
  segmentation code={\tcb@drawspec@widgetsegment},%
  skin first=widgetmiddle,skin middle=widgetmiddle,skin last=widgetlast}

\tcb@new@skin{spartan}{graphical environment=tikzpicture@tcb@hooked,geometry nodes=true,
  set@extensions@preframe=,set@extensions@postframe={\tcb@apply@underlay},set@extensions@final=,%
  frame engine=spartan,interior titled engine=spartan,interior engine=spartan,title engine=spartan,segmentation engine=spartan,%
  set@outerboundary=\tcb@boundaryframe@standard,%
  skin first=spartan,skin middle=spartan,skin last=spartan}

\tcbset{spartan/.style={skin=spartan}}

\tcb@new@skin{draft}{clear@spec,graphical environment=tikzpicture@tcb@hooked,geometry nodes,%
  frame engine=empty,interior titled engine=empty,interior engine=empty,segmentation engine=path,title empty,%
  segmentation style={draw=black,dashed},
  set@extensions@postframe=,
  set@extensions@final={\tcb@apply@finish},no finish,%
  colupper=black!50!white,collower=black!50!white,coltitle=black!50!white,
  frame code={%
    \path[draw=blue!10!white,double,line width=1pt,dashed] (current bounding box.south west) rectangle (current bounding box.north east);
    {\tcb@spec{fill=black!15!white,draw=black}\tcb@drawframe@path}%
    \iftcb@hasTitle%
      \path[fill=red!10!white,draw,dotted,rounded corners=\kvtcb@arc]
        ([xshift={\kvtcb@left@rule},yshift={\kvtcb@bottom@rule}]frame.south west) rectangle
        (interior.north east);
      \path[fill=red!10!white,draw,dotted,rounded corners=\kvtcb@arc]
        ([yshift={\kvtcb@title@rule}]interior.north west) rectangle
        ([xshift={-\kvtcb@right@rule},yshift={-\kvtcb@top@rule}]frame.north east);
      \path[fill=white,draw,dotted]
        ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep}]title.south west) rectangle
        ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep}]title.north east);
      \path[fill=green!20!white,draw=green!75!black,dashed]
        ([xshift={\kvtcb@boxsep+\kvtcb@lefttitle},yshift={\kvtcb@boxsep+\kvtcb@bottomtitle}]title.south west)
         rectangle node[font=\scriptsize] {title: w=\tcb@w@title, h=\tcb@h@title}
        +(\tcb@w@title,\tcb@h@title);
      \path[draw=red,opacity=0.5] (title.south west) rectangle (title.north east);
    \else%
      \path[fill=red!10!white,draw,dotted,rounded corners=\kvtcb@arc]
        ([xshift={\kvtcb@left@rule},yshift={\kvtcb@bottom@rule}]frame.south west) rectangle
        ([xshift={-\kvtcb@right@rule},yshift={-\kvtcb@top@rule}]frame.north east);
    \fi%
    \ifcase\tcb@segment@state
      \path[fill=white,draw,dotted]
        ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep+\tcb@break@bottomsep}]interior.south west) rectangle
        ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep-\tcb@break@topsep}]interior.north east);
      \path[fill=green!20!white,draw=green!75!black,dashed]
        ([xshift={\kvtcb@boxsep+\kvtcb@leftupper},yshift={\kvtcb@boxsep+\kvtcb@bottom+\tcb@break@bottomsep}]interior.south west)
        rectangle node[font=\scriptsize] {upper: w=\tcb@w@upper, h=\tcb@height@upper}
        +(\tcb@w@upper,\tcb@height@upper);
      \iftcb@sidebyside%
      \path[fill=green!20!white,draw=green!75!black,dashed]
        ([yshift={\kvtcb@boxsep+\kvtcb@bottom+\tcb@break@bottomsep}]segmentation.south east)
        rectangle node[font=\scriptsize] {lower: w=\tcb@w@lower, h=\tcb@height@upper}
        +(\tcb@w@lower,\tcb@height@upper);
      \fi%
    \or%
      \ifdim\wd\tcb@upperbox=0pt\relax
        \path[fill=white,draw,dotted]
          ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep+\tcb@break@bottomsep}]interior.south west) rectangle
          ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep-\tcb@break@topsep}]interior.north east);
      \else
        \path[fill=white,draw,dotted]
          ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep+\tcb@break@bottomsep}]interior.south west) rectangle
          ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep}]segmentation.east);
        \path[fill=white,draw,dotted]
           ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep}]segmentation.west)
           rectangle ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep-\tcb@break@topsep}]interior.north east);
        \path[fill=green!20!white,draw=green!75!black,dashed]
          ([xshift={\kvtcb@boxsep+\kvtcb@leftupper},yshift={\kvtcb@boxsep}]segmentation.north west)
           rectangle node[font=\scriptsize] {upper: w=\tcb@w@upper, h=\tcb@height@upper}
           +(\tcb@w@upper,\tcb@height@upper);
      \fi%
      \path[fill=green!20!white,draw=green!75!black,dashed]
        ([xshift={\kvtcb@boxsep+\kvtcb@leftlower},yshift={\kvtcb@boxsep+\kvtcb@bottom+\tcb@break@bottomsep}]interior.south west)
        rectangle  node[font=\scriptsize] {lower: w=\tcb@w@lower, h=\tcb@height@lower}
        +(\tcb@w@lower,\tcb@height@lower);
      \path[draw=red,opacity=0.5] (segmentation.south west) rectangle (segmentation.north east);
    \else
      \path[fill=white,draw,dotted]
        ([xshift={\kvtcb@boxsep},yshift={\kvtcb@boxsep+\tcb@break@bottomsep}]interior.south west) rectangle
        ([xshift={-\kvtcb@boxsep},yshift={-\kvtcb@boxsep-\tcb@break@topsep}]interior.north east);
      \path[fill=green!20!white,draw=green!75!black,dashed]
        ([xshift={\kvtcb@boxsep+\kvtcb@leftlower},yshift={\kvtcb@boxsep+\kvtcb@bottom+\tcb@break@bottomsep}]interior.south west)
        rectangle  node[font=\scriptsize] {lower: w=\tcb@w@lower, h=\tcb@height@lower}
        +(\tcb@w@lower,\tcb@height@lower);
    \fi%
    \path[draw=red,opacity=0.5] (interior.south west) rectangle (interior.north east);
    \path[draw=red,opacity=0.5] (frame.south west) rectangle (frame.north east);
    \node[above,font=\scriptsize,red!50!black] at (interior.south) {interior: w=\tcb@innerwidth, h=\tcb@innerheight};
    \node[above,font=\scriptsize,red!50!black] at (frame.north) {frame: w=\the\dimexpr\tcb@width\relax, h=\tcb@height};
    \path[draw=blue!10!white,double,line width=1pt,dashed,opacity=0.3] (current bounding box.south west) rectangle (current bounding box.north east);
    \pgfsetfillopacity{0.3}
  },
  skin first=draft,skin middle=draft,skin last=draft}

\tcbset{draft/.style={skin=draft}}

\tikzset{%
  tcb@forced@clip/.code={\tikz@addmode{\tikz@mode@cliptrue}\let\tikz@options=\pgfutil@empty},%
  tcb@invclip/.style={clip,insert path={{[reset cm]\pgfextra{%
    \pgfpathmoveto{\pgfqpoint{-16383.99999pt}{-16383.99999pt}}%
    \pgfpathlineto{\pgfqpoint{16383.99999pt}{-16383.99999pt}}%
    \pgfpathlineto{\pgfqpoint{16383.99999pt}{16383.99999pt}}%
    \pgfpathlineto{\pgfqpoint{-16383.99999pt}{16383.99999pt}}%
    \pgfpathclose}}}}%
}%

\def\tcb@clip@frame{\tcb@pathboundary{clip}{\tcb@outerboundary}}

\def\tcb@invclip@frame{\tcb@pathboundary{tcb@invclip}{\tcb@outerboundary}}

\def\tcb@clip@interior{%
  \begingroup%
  \tcbset{interior hidden}%
  \tcb@spec{tcb@forced@clip}%
  \def\tcb@spec##1{}%
  \iftcb@hasTitle%
    %\csname tcb@drawwithtitle@\kvtcb@engine@interiortitled\endcsname%
    \tcb@interiortitled@code%
  \else%
    %\csname tcb@drawwithouttitle@\kvtcb@engine@interior\endcsname%
    \tcb@interior@code%
  \fi%
  \endgroup%
}

\def\tcb@clip@title{%
  \begingroup%
  \tcbset{title hidden}%
  \tcb@spec{tcb@forced@clip}%
  \def\tcb@spec##1{}%
    \iftcb@hasTitle%
      %\csname tcb@drawtitle@\kvtcb@engine@title\endcsname%
      \tcb@title@code%
    \fi%
  \endgroup%
}

\newenvironment{tcbclipframe}{\begin{scope}\tcb@clip@frame}{\end{scope}}
\newenvironment{tcbinvclipframe}{\begin{scope}\tcb@invclip@frame}{\end{scope}}
\newenvironment{tcbclipinterior}{\begin{scope}\tcb@clip@interior}{\end{scope}}
\newenvironment{tcbcliptitle}{\begin{scope}\tcb@clip@title}{\end{scope}}

\def\tcb@apply@underlay{\csname tcb@underlay@\tcb@split@state\endcsname}%
\def\tcb@apply@finish{\csname tcb@finish@\tcb@split@state\endcsname}%

\tcbset{%
  underlay unbroken/.code={\appto\tcb@underlay@unbroken{#1}},%
  underlay first/.code={\appto\tcb@underlay@first{#1}},%
  underlay middle/.code={\appto\tcb@underlay@middle{#1}},%
  underlay last/.code={\appto\tcb@underlay@last{#1}},%
  underlay boxed title/.code={\appto\tcb@underlay@boxedtitle{#1}},%
  underlay/.style={underlay unbroken={#1},underlay first={#1},underlay middle={#1},underlay last={#1}},%
  underlay broken/.style={underlay first={#1},underlay middle={#1},underlay last={#1}},%
  underlay unbroken and first/.style={underlay unbroken={#1},underlay first={#1}},%
  underlay unbroken and last/.style={underlay unbroken={#1},underlay last={#1}},%
  underlay middle and last/.style={underlay middle={#1},underlay last={#1}},%
  no underlay unbroken/.code={\let\tcb@underlay@unbroken\@empty},%
  no underlay first/.code={\let\tcb@underlay@first\@empty},%
  no underlay middle/.code={\let\tcb@underlay@middle\@empty},%
  no underlay last/.code={\let\tcb@underlay@last\@empty},%
  no underlay boxed title/.code={\let\tcb@underlay@boxedtitle\@empty},%
  no underlay/.style={no underlay unbroken,no underlay first,no underlay middle,no underlay last,no underlay boxed title},%
  finish unbroken/.code={\appto\tcb@finish@unbroken{#1}},%
  finish first/.code={\appto\tcb@finish@first{#1}},%
  finish middle/.code={\appto\tcb@finish@middle{#1}},%
  finish last/.code={\appto\tcb@finish@last{#1}},%
  finish/.style={finish unbroken={#1},finish first={#1},finish middle={#1},finish last={#1}},%
  finish broken/.style={finish first={#1},finish middle={#1},finish last={#1}},%
  finish unbroken and first/.style={finish unbroken={#1},finish first={#1}},%
  finish unbroken and last/.style={finish unbroken={#1},finish last={#1}},%
  finish middle and last/.style={finish middle={#1},finish last={#1}},%
  no finish unbroken/.code={\let\tcb@finish@unbroken\@empty},%
  no finish first/.code={\let\tcb@finish@first\@empty},%
  no finish middle/.code={\let\tcb@finish@middle\@empty},%
  no finish last/.code={\let\tcb@finish@last\@empty},%
  no finish/.style={no finish unbroken,no finish first,no finish middle,no finish last},%
}


\tcbset{%
  before@boxed@title/.store in=\kvtcb@before@boxedtitle,%
  after@boxed@title/.store in=\kvtcb@after@boxedtitle,%
  boxed title style/.store in=\kvtcb@style@boxedtitle,%.style={boxed@title@style/.style={#1}},
  %
  varwidth boxed title/.style={before@boxed@title={\tcbdimto\tcb@w@title{#1}\begin{varwidth}{\tcb@w@title}},after@boxed@title={\end{varwidth}}},%
  varwidth boxed title/.default={\kvtcb@width-\kvtcb@left@rule-\kvtcb@right@rule-\kvtcb@boxsep*2-\kvtcb@lefttitle-\kvtcb@righttitle},
  varwidth boxed title*/.style={varwidth boxed title={\kvtcb@width+#1}},
  varwidth boxed title*/.default={-\kvtcb@left@rule-\kvtcb@right@rule-\kvtcb@boxsep*2-\kvtcb@lefttitle-\kvtcb@righttitle},
  %
  minipage boxed title/.style={before@boxed@title={\tcbdimto\tcb@w@title{#1}\begin{minipage}{\tcb@w@title}},after@boxed@title={\end{minipage}}},%
  minipage boxed title/.default={\kvtcb@width-\kvtcb@left@rule-\kvtcb@right@rule-\kvtcb@boxsep*2-\kvtcb@lefttitle-\kvtcb@righttitle},
  minipage boxed title*/.style={minipage boxed title={\kvtcb@width+#1}},
  minipage boxed title*/.default={-\kvtcb@left@rule-\kvtcb@right@rule-\kvtcb@boxsep*2-\kvtcb@lefttitle-\kvtcb@righttitle},
  %
  tikznode boxed title/.style={before@boxed@title={\centering\tcb@shield@externalize\begin{tikzpicture}\node[align=center,inner sep=0pt,outer sep=0pt,#1]\bgroup},after@boxed@title={\egroup;\end{tikzpicture}}},%
  hbox boxed title/.style={before@boxed@title=,after@boxed@title=},%
  %
  boxtitle/xshift/.dimstore in=\kvtcb@xshift@boxedtitle,%
  boxtitle/yshift/.dimstore in=\kvtcb@yshift@boxedtitle,%
  boxtitle/yshifttext/.dimstore in=\kvtcb@yinnershift@boxedtitle,%
  %
  boxtitle/yshift*@top/.style={yshift*/.code={%
    \tcbdimto\kvtcb@yshift@boxedtitle{##1}%
    \tcbdimto\kvtcb@yinnershift@boxedtitle{\kvtcb@yshift@boxedtitle+\kvtcb@top@rule@stand}%
    \ifdim\dimexpr\kvtcb@yinnershift@boxedtitle>0pt\relax\let\kvtcb@yinnershift@boxedtitle\tcb@zpt\fi%
  }},
  boxtitle/yshift*@bottom/.style={yshift*/.code={%
    \tcbdimto\kvtcb@yshift@boxedtitle{##1}%
    \tcbdimto\kvtcb@yinnershift@boxedtitle{\kvtcb@yshift@boxedtitle-\kvtcb@bottom@rule@stand}%
    \ifdim\dimexpr\kvtcb@yinnershift@boxedtitle<0pt\relax\let\kvtcb@yinnershift@boxedtitle\tcb@zpt\fi%
  }},
  boxtitle/adapt@top/.code={%
    \ifdim\dimexpr\tcboxedtitleheight+\kvtcb@yshift@boxedtitle>0pt\relax
      \tcbdimto\kvtcb@bbtop@stand{\kvtcb@bbtop@stand+\tcboxedtitleheight+\kvtcb@yshift@boxedtitle}%
    \fi%
    \tcbdimto\kvtcb@top{\kvtcb@top-\kvtcb@yinnershift@boxedtitle}%
  },
  boxtitle/adapt@bottom/.code={%
    \ifdim\dimexpr\tcboxedtitleheight-\kvtcb@yshift@boxedtitle>0pt\relax
      \tcbdimto\kvtcb@bbbottom@stand{\kvtcb@bbbottom@stand+\tcboxedtitleheight-\kvtcb@yshift@boxedtitle}%
    \fi%
    \tcbdimto\kvtcb@bottom{\kvtcb@bottom+\kvtcb@yinnershift@boxedtitle}%
  },
  attach@title@boxed/.style n args={5}{%
    detach title,
    code={\def\tcb@specialtitle@hook{%
      \ifx\tcbtitletext\@empty\else%
      \let\tcb@trans@colframe\kvtcb@colframe%
      \let\tcb@trans@colback\kvtcb@colbacktitle%
      \let\tcb@trans@boxedstyle\kvtcb@style@boxedtitle%
      \setbox\tcb@titlebox\hbox{\bgroup\color{\kvtcb@coltitle}\kvtcb@fonttitle\kvtcb@before@boxedtitle\kvtcb@before@title\tcbtitletext\kvtcb@after@title\kvtcb@after@boxedtitle\egroup}%
      \setbox\tcb@titlebox\hbox{\tcbox[colframe=\tcb@trans@colframe,colback=\tcb@trans@colback,size=title,code={\pgfkeysalsofrom\tcb@trans@boxedstyle}]{\box\tcb@titlebox}}%
      %
      \tcbdimto\tcboxedtitleheight{\ht\tcb@titlebox+\dp\tcb@titlebox}%
      \tcbdimto\tcboxedtitlewidth{\wd\tcb@titlebox}%
      \tcbset{boxtitle/.cd,xshift=0pt,yshift=0pt,yshifttext=0pt,yshift*@#2,#1,adapt@#2}%
      \let\tcb@specialgeonodes@first\relax%
      \let\tcb@specialgeonodes@middle\relax%
      \let\tcb@specialgeonodes@last\relax%
      \def\tcb@specialgeonodes@unbroken{%
        \node[#4,name=title,at={([xshift=\kvtcb@xshift@boxedtitle,yshift=\kvtcb@yshift@boxedtitle]frame.#5)},
                minimum width=\tcboxedtitlewidth,minimum height=\tcboxedtitleheight]{};}%
      \cslet{tcb@specialgeonodes@#3}{\tcb@specialgeonodes@unbroken}%
      \def\tcb@specialgeonodes@hook{\csname tcb@specialgeonodes@\tcb@split@state\endcsname}%
      \preto\tcb@underlay@unbroken{\tcb@underlay@boxedtitle\pgftext[at={\pgfpointanchor{title}{center}}]{\box\tcb@titlebox}}%
      \cspreto{tcb@underlay@#3}{\tcb@underlay@boxedtitle\pgftext[at={\pgfpointanchor{title}{center}}]{\box\tcb@titlebox}}%
      \fi}}%
    },
  attach@title@boxed@top/.style n args={3}{attach@title@boxed={#1}{top}{first}{#2}{#3}},%
  attach@title@boxed@bottom/.style n args={3}{attach@title@boxed={#1}{bottom}{last}{#2}{#3}},%
  %
  attach boxed title to top left/.style={attach@title@boxed@top={#1}{above right}{north west}},
  attach boxed title to top center/.style={attach@title@boxed@top={#1}{above}{north}},
  attach boxed title to top right/.style={attach@title@boxed@top={#1}{above left}{north east}},
  attach boxed title to bottom left/.style={attach@title@boxed@bottom={#1}{below right}{south west}},
  attach boxed title to bottom center/.style={attach@title@boxed@bottom={#1}{below}{south}},
  attach boxed title to bottom right/.style={attach@title@boxed@bottom={#1}{below left}{south east}},
}


\newbox\tcb@waterbox

\def\tcb@setratio#1#2#3{\edef#1{\strip@pt\dimexpr\number\numexpr\number\dimexpr#2\relax*65536/\number\dimexpr#3\relax\relax sp\relax}}

\def\tcb@setratiorobust#1#2#3{\ifdim\dimexpr#3<1pt\tcb@setratio#1{#2}{1pt}\else\tcb@setratio#1{#2}{#3}\fi}

\def\tcb@comp@waterbox@stretch#1#2#3{%
  \tcb@setratiorobust\tcb@scale@x{#1\dimexpr#2}{\wd\tcb@waterbox}%
  \tcb@setratiorobust\tcb@scale@y{#1\dimexpr#3}{\ht\tcb@waterbox+\dp\tcb@waterbox}%
}

\def\tcb@comp@waterbox@zoom#1#2#3{%
  \tcb@comp@waterbox@stretch{#1}{#2}{#3}%
  \ifdim\dimexpr\tcb@scale@x pt\relax<\dimexpr\tcb@scale@y pt\relax\let\tcb@scale@y=\tcb@scale@x\else\let\tcb@scale@x=\tcb@scale@y\fi%
}

\def\tcb@comp@waterbox@overzoom#1#2#3{%
  \tcb@comp@waterbox@stretch{#1}{#2}{#3}%
  \ifdim\dimexpr\tcb@scale@x pt\relax>\dimexpr\tcb@scale@y pt\relax\let\tcb@scale@y=\tcb@scale@x\else\let\tcb@scale@x=\tcb@scale@y\fi%
}

\def\tcb@comp@waterbox@shrink#1#2#3{%
  \tcb@comp@waterbox@zoom{#1}{#2}{#3}%
  \ifdim\dimexpr\tcb@scale@x pt\relax>1pt\relax%
    \edef\tcb@scale@x{1}\edef\tcb@scale@y{1}%
  \fi%
}

\def\tcb@box@scaled@waterbox{\scalebox{\tcb@scale@x}[\tcb@scale@y]{\box\tcb@waterbox}}

\def\tcb@drawspec@watermark@@noclip{%
  \tcb@comp@wm%
  \node[opacity=\kvtcb@watermark@opacity,anchor=center] at (interior) {\tcb@box@scaled@waterbox};%
}

\def\tcb@drawspec@watermark@@clip{%
  \begin{tcbclipinterior}%
  \tcb@drawspec@watermark@@noclip%
  \end{tcbclipinterior}%
}

\def\tcb@drawspec@watermark@tikz#1{%
  \setbox\tcb@waterbox=\hbox{\pgfinterruptpicture{\pgfsetbaseline{0pt}\begin{tikzpicture}[color=\kvtcb@watermark@color]#1\end{tikzpicture}}\endpgfinterruptpicture}%
  \tcb@drawspec@watermark%
}

\def\tcb@drawspec@watermark@graphics#1{%
  \setbox\tcb@waterbox=\hbox{\pgfinterruptpicture{\includegraphics{#1}}\endpgfinterruptpicture}%
  \tcb@drawspec@watermark%
}

\def\tcb@drawspec@watermark@text#1{%
  \tcb@drawspec@watermark@tikz{\node[inner sep=0pt,align=flush center]{#1};}%
}


\tcbset{%
  watermark opacity/.store in=\kvtcb@watermark@opacity,%
  watermark color/.store in=\kvtcb@watermark@color,%
%
  watermark stretch/.code={\def\tcb@comp@wm{\tcb@comp@waterbox@stretch{#1}{\tcb@innerwidth}{\tcb@innerheight}}},%
  watermark zoom/.code={\def\tcb@comp@wm{\tcb@comp@waterbox@zoom{#1}{\tcb@innerwidth}{\tcb@innerheight}}},%
  watermark overzoom/.code={\def\tcb@comp@wm{\tcb@comp@waterbox@overzoom{#1}{\tcb@innerwidth}{\tcb@innerheight}}},%
  watermark shrink/.code={\def\tcb@comp@wm{\tcb@comp@waterbox@shrink{#1}{\tcb@innerwidth}{\tcb@innerheight}}},%
%
  watermark tikz/.style={overlay={\tcb@drawspec@watermark@tikz{#1}}},
  watermark tikz on/.style args={#1 is #2}{overlay #1={\tcb@drawspec@watermark@tikz{#2}}},%
  watermark graphics/.style={overlay={\tcb@drawspec@watermark@graphics{#1}}},
  watermark graphics on/.style args={#1 is #2}{overlay #1={\tcb@drawspec@watermark@graphics{#2}}},
  watermark text/.style={overlay={\tcb@drawspec@watermark@text{#1}}},
  watermark text on/.style args={#1 is #2}{overlay #1={\tcb@drawspec@watermark@text{#2}}},
  no watermark/.style={no overlay},
  clip watermark/.is choice,
  clip watermark/true/.code={\let\tcb@drawspec@watermark=\tcb@drawspec@watermark@@clip},
  clip watermark/false/.code={\let\tcb@drawspec@watermark=\tcb@drawspec@watermark@@noclip},
  clip watermark/.default=true,
  show bounding box/.style={border@line app={%
    \path[preaction={draw,line width=0.1pt,#1},draw,double=white,line width=1pt,dashed,opacity=0.5,#1]
    (current bounding box.south west) rectangle (current bounding box.north east);}},%
  show bounding box/.default={red},%
}

\def\tcb@tdraw@title@clip{%
  \begin{tcbcliptitle}%
  \tcb@tdraw@title@core%
  \end{tcbcliptitle}%
}

\def\tcb@tdraw@upper@clip{%
  \begin{tcbclipinterior}%
  \tcb@tdraw@upper@core%
  \end{tcbclipinterior}%
}

\def\tcb@tdraw@lower@clip{%
  \begin{tcbclipinterior}%
  \tcb@tdraw@lower@core%
  \end{tcbclipinterior}%
}


\def\tcb@process@ppbb{%
  \pgf@process{\pgfpointanchor{path picture bounding box}{south west}}%
  \pgf@xa\pgf@x\pgf@ya\pgf@y%
  \pgf@process{\pgfpointanchor{path picture bounding box}{north east}}%
  \pgf@xb\pgf@x\pgf@yb\pgf@y%
  \pgfsetfillopacity{\tcb@tikz@fill@graphics@opacity}%
  \pgfsetstrokeopacity{\tcb@tikz@fill@graphics@opacity}%
}

\def\tcb@process@ppbb@wh{%
  \tcb@process@ppbb%
  \tcbdimto\tcb@ppbb@width{\pgf@xb-\pgf@xa}%
  \tcbdimto\tcb@ppbb@height{\pgf@yb-\pgf@ya}%
}

\def\tcb@set@waterbox@to@graphics#1{%
  \setbox\tcb@waterbox=\hbox{\pgfinterruptpicture{\expandafter\includegraphics\expandafter[\tcb@tikz@fill@graphics@options]{#1}}\endpgfinterruptpicture}%
}

\def\tcb@set@waterbox@to@picture#1{%
  \setbox\tcb@waterbox=\hbox{\pgfinterruptpicture{\pgfsetbaseline{0pt}\begin{tikzpicture}#1\end{tikzpicture}}\endpgfinterruptpicture}%
}

\tikzset{%
  fill image opacity/.store in=\tcb@tikz@fill@graphics@opacity,%
  fill image opacity=1,%
  fill image scale/.store in=\tcb@tikz@fill@graphics@scale,%
  fill image scale=1,%
  fill image options/.store in=\tcb@tikz@fill@graphics@options,%
  fill image options=,%
  fill plain image/.style={path picture={%
    \node at (path picture bounding box.center) {\expandafter\includegraphics\expandafter[\tcb@tikz@fill@graphics@options]{#1}};
  }},
  fill plain picture/.style={path picture={%
    \tcb@set@waterbox@to@picture{#1}%
    \node at (path picture bounding box.center) {\box\tcb@waterbox};
  }},
  fill stretch image/.style={path picture={%
    \tcb@process@ppbb@wh%
    \node at (path picture bounding box.center) {\expandafter\includegraphics\expandafter[\tcb@tikz@fill@graphics@options,%
      width=\the\dimexpr\tcb@tikz@fill@graphics@scale\dimexpr\tcb@ppbb@width\relax,%
      height=\the\dimexpr\tcb@tikz@fill@graphics@scale\dimexpr\tcb@ppbb@height\relax]{#1}};
  }},
  fill stretch picture/.style={path picture={%
    \tcb@process@ppbb@wh%
    \tcb@set@waterbox@to@picture{#1}%
    \tcb@comp@waterbox@stretch{\tcb@tikz@fill@graphics@scale}{\tcb@ppbb@width}{\tcb@ppbb@height}%
    \node at (path picture bounding box.center) {\tcb@box@scaled@waterbox};%
  }},
  fill@overzoom/.style={path picture={%
    \tcb@process@ppbb@wh%
    #1%
    \tcb@comp@waterbox@overzoom{\tcb@tikz@fill@graphics@scale}{\tcb@ppbb@width}{\tcb@ppbb@height}%
    \node at (path picture bounding box.center) {\tcb@box@scaled@waterbox};%
  }},
  fill overzoom image/.style={fill@overzoom={\tcb@set@waterbox@to@graphics{#1}}},%
  fill overzoom picture/.style={fill@overzoom={\tcb@set@waterbox@to@picture{#1}}},%
  fill@zoom/.style={path picture={%
    \tcb@process@ppbb@wh%
    #1%
    \tcb@comp@waterbox@zoom{\tcb@tikz@fill@graphics@scale}{\tcb@ppbb@width}{\tcb@ppbb@height}%
    \node at (path picture bounding box.center) {\tcb@box@scaled@waterbox};%
  }},
  fill zoom image/.style={fill@zoom={\tcb@set@waterbox@to@graphics{#1}}},%
  fill zoom picture/.style={fill@zoom={\tcb@set@waterbox@to@picture{#1}}},%
  fill@shrink/.style={path picture={%
    \tcb@process@ppbb@wh%
    #1%
    \tcb@comp@waterbox@shrink{\tcb@tikz@fill@graphics@scale}{\tcb@ppbb@width}{\tcb@ppbb@height}%
    \node at (path picture bounding box.center) {\tcb@box@scaled@waterbox};%
  }},
  fill shrink image/.style={fill@shrink={\tcb@set@waterbox@to@graphics{#1}}},%
  fill shrink picture/.style={fill@shrink={\tcb@set@waterbox@to@picture{#1}}},%
  fill@tile/.style={path picture={%
    \tcb@process@ppbb%
    #1%
    \tcbdimto\tcb@ppbb@tilew{\wd\tcb@waterbox}%
    \tcbdimto\tcb@ppbb@tileh{\ht\tcb@waterbox+\dp\tcb@waterbox}%
    \pgf@xc\pgf@xa\pgf@yc\pgf@yb%
    \pgfutil@loop%
      \pgfutil@loop%
        \pgftext[x=\pgf@xc,y=\pgf@yc,left,top]{\copy\tcb@waterbox}%
        \ifdim\pgf@xc<\pgf@xb%
        \advance\pgf@xc\tcb@ppbb@tilew%
      \pgfutil@repeat%
      \ifdim\pgf@yc>\pgf@ya%
      \advance\pgf@yc-\tcb@ppbb@tileh%
      \pgf@xc\pgf@xa%
    \pgfutil@repeat%
  }},%
  fill tile image/.style={fill@tile={\tcb@set@waterbox@to@graphics{#1}}},%
  fill tile picture/.style={fill@tile={\tcb@set@waterbox@to@picture{#1}}},%
  fill tile picture*/.style 2 args={fill@tile={\tcb@set@waterbox@to@picture{#2}%
    \setbox\tcb@waterbox=\hbox{\scalebox{#1}{\box\tcb@waterbox}}}},%
  %
  fill plain image*/.style 2 args={fill image options={#1},fill plain image={#2}},%
  fill stretch image*/.style 2 args={fill image options={#1},fill stretch image={#2}},%
  fill overzoom image*/.style 2 args={fill image options={#1},fill overzoom image={#2}},%
  fill zoom image*/.style 2 args={fill image options={#1},fill zoom image={#2}},%
  fill shrink image*/.style 2 args={fill image options={#1},fill shrink image={#2}},%
  fill tile image*/.style 2 args={fill image options={#1},fill tile image={#2}},%
}

\tcbset{%
  frame style image/.style={frame style={fill=none,fill stretch image={#1}}},
  frame style tile/.style 2 args={frame style={fill=none,fill tile image*={#1}{#2}}},
  interior style image/.style={interior style={fill=none,fill stretch image={#1}}},
  interior style tile/.style 2 args={interior style={fill=none,fill tile image*={#1}{#2}}},
  title style image/.style={title style={fill=none,fill stretch image={#1}}},
  title style tile/.style 2 args={title style={fill=none,fill tile image*={#1}{#2}}},
}

\tcbset{%
  clip title/.is choice,
  clip title/true/.code={\let\tcb@tdraw@title=\tcb@tdraw@title@clip},
  clip title/false/.code={\let\tcb@tdraw@title=\tcb@tdraw@title@core},
  clip title/.default=true,
  clip upper/.is choice,
  clip upper/true/.code={\let\tcb@tdraw@upper=\tcb@tdraw@upper@clip},
  clip upper/false/.code={\let\tcb@tdraw@upper=\tcb@tdraw@upper@core},
  clip upper/.default=true,
  clip lower/.is choice,
  clip lower/true/.code={\let\tcb@tdraw@lower=\tcb@tdraw@lower@clip},
  clip lower/false/.code={\let\tcb@tdraw@lower=\tcb@tdraw@lower@core},
  clip lower/.default=true,
}


\tcbset{marker/.style={%
  skin=enhancedmiddle jigsaw,
  breakable,parbox=false,
  boxrule=0mm,leftrule=5mm,rightrule=5mm,boxsep=0mm,
  left=3mm,right=3mm,top=1mm,bottom=1mm,
  toptitle=1mm,bottomtitle=1mm,fonttitle=\bfseries,
  arc=0mm,outer arc=0mm,
  colback=yellow!10!white,colframe=red,
  watermark color=yellow!75!red!25!white,
  enlarge left by=-8mm,
  enlarge right by=-8mm,
  enlarge top by=0mm,
  enlarge bottom by=0mm,
  width=\the\dimexpr\linewidth+1.6cm\relax,
  frame style={top color=\kvtcb@colframe,bottom color=\kvtcb@colframe,middle color=yellow!75!\kvtcb@colframe},
  title style={left color=\kvtcb@colframe,right color=\kvtcb@colframe,middle color=yellow!75!\kvtcb@colframe},
  watermark tikz={\draw[line width=2mm] circle (1cm) node{\fontfamily{ptm}\fontseries{b}\fontsize{20mm}{20mm}\selectfont!};},
  watermark zoom=0.75,
}}


\def\tcb@border@prepare#1#2{%
  \tcbdimto\tcb@border@ts{#2+(#1)/2}%
  \ifdim\dimexpr\tcb@outer@arc>\tcb@border@ts\relax%
    \tcbdimto\tcb@border@arc{\tcb@outer@arc-\tcb@border@ts}%
  \else%
    \let\tcb@border@arc=\tcb@zpt%
  \fi%
}

\def\tcb@border@unbroken#1#2#3{%
  \tcb@border@prepare{#1}{#2}%
  \draw[line width=#1,rounded corners=\tcb@border@arc,#3]
    ([xshift=\tcb@border@ts,yshift=\tcb@border@ts]frame.south west)%
      rectangle ([xshift=-\tcb@border@ts,yshift=-\tcb@border@ts]frame.north east);%
}

\def\tcb@border@first#1#2#3{%
  \tcb@border@prepare{#1}{#2}%
  \draw[line width=#1,rounded corners=\tcb@border@arc,#3]
    ([xshift=\tcb@border@ts]frame.south west) --
    ([xshift=\tcb@border@ts,yshift=-\tcb@border@ts]frame.north west) --
    ([xshift=-\tcb@border@ts,yshift=-\tcb@border@ts]frame.north east) --
    ([xshift=-\tcb@border@ts]frame.south east);%
}

\def\tcb@border@middle#1#2#3{%
  \tcb@border@prepare{#1}{#2}%
  \draw[line width=#1,#3]
    ([xshift=\tcb@border@ts]frame.north west) -- ([xshift=\tcb@border@ts]frame.south west);%
  \draw[line width=#1,#3]
    ([xshift=-\tcb@border@ts]frame.north east) -- ([xshift=-\tcb@border@ts]frame.south east);%
}

\def\tcb@border@last#1#2#3{%
  \tcb@border@prepare{#1}{#2}%
  \draw[line width=#1,rounded corners=\tcb@border@arc,#3]
    ([xshift=\tcb@border@ts]frame.north west) --
    ([xshift=\tcb@border@ts,yshift=\tcb@border@ts]frame.south west) --
    ([xshift=-\tcb@border@ts,yshift=\tcb@border@ts]frame.south east) --
    ([xshift=-\tcb@border@ts]frame.north east);%
}


\def\tcb@draw@border@unbroken{%
  \let\tcb@border=\tcb@border@unbroken%
  \kvtcb@borderline%
}

\def\tcb@draw@border@first{%
  \let\tcb@border=\tcb@border@first%
  \kvtcb@borderline%
}

\def\tcb@draw@border@middle{%
  \let\tcb@border=\tcb@border@middle%
  \kvtcb@borderline%
}

\def\tcb@draw@border@last{%
  \let\tcb@border=\tcb@border@last%
  \kvtcb@borderline%
}

\tcbset{%
  border@line app/.code={\appto\kvtcb@borderline{#1}},%
  borderline/.style args={#1#2#3}{border@line app={\tcb@border{#1}{#2}{#3}}},%
  no borderline/.code={\def\kvtcb@borderline{}},%
}

\def\tcb@shadow@prepare#1#2{%
  \ifdim#2>0pt\relax\tcbdimto\tcb@shadow@ts{#1-#2/2}%%
  \else\tcbdimto\tcb@shadow@ts{#1+#2/2}\fi%
  \ifdim\dimexpr\tcb@outer@arc>\tcb@shadow@ts\relax%
    \tcbdimto\tcb@shadow@arc{\tcb@outer@arc-\tcb@shadow@ts}%
  \else%
    \let\tcb@shadow@arc=\tcb@zpt%
  \fi%
}

\def\tcb@arc@sha{\pgfsetcornersarced{\pgfqpoint{\tcb@shadow@arc}{\tcb@shadow@arc}}}%

\def\tcb@shadow@unbroken#1#2#3#4{%
  \tcb@shadow@prepare{#3}{#1}%
  \tcb@pathbase{fill,#4}{[xshift=#1+#3,yshift=#2+#3]frame.south west}{[xshift=#1-#3,yshift=#2-#3]frame.north east}%
    {\tcb@arc@sha}{\tcb@arc@sha}{\tcb@arc@sha}{\tcb@arc@sha}%
}

\def\tcb@shadow@first#1#2#3#4{%
  \tcb@shadow@prepare{#3}{#1}%
  \tcb@pathbase{fill,#4}{[xshift=#1+#3,yshift=#2+#3]frame.south west}{[xshift=#1-#3,yshift=#2-#3]frame.north east}%
    {\tcb@arc@zpt}{\tcb@arc@sha}{\tcb@arc@sha}{\tcb@arc@zpt}%
}

\def\tcb@shadow@middle#1#2#3#4{%
  \tcb@shadow@prepare{#3}{#1}%
  \tcb@pathbase{fill,#4}{[xshift=#1+#3,yshift=#2+#3]frame.south west}{[xshift=#1-#3,yshift=#2-#3]frame.north east}%
    {\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@zpt}%
}

\def\tcb@shadow@last#1#2#3#4{%
  \tcb@shadow@prepare{#3}{#1}%
  \tcb@pathbase{fill,#4}{[xshift=#1+#3,yshift=#2+#3]frame.south west}{[xshift=#1-#3,yshift=#2-#3]frame.north east}%
    {\tcb@arc@sha}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@sha}%
}

\def\tcb@draw@shadow@unbroken{%
  \let\tcb@shadow=\tcb@shadow@unbroken%
  \kvtcb@shadow%
}

\def\tcb@draw@shadow@first{%
  \let\tcb@shadow=\tcb@shadow@first%
  \kvtcb@shadow%
}

\def\tcb@draw@shadow@middle{%
  \let\tcb@shadow=\tcb@shadow@middle%
  \kvtcb@shadow%
}

\def\tcb@draw@shadow@last{%
  \let\tcb@shadow=\tcb@shadow@last%
  \kvtcb@shadow%
}

\tcbset{%
  shad@w app/.code={\appto\kvtcb@shadow{#1}},%
  shadow/.style args={#1#2#3#4}{shad@w app={\tcb@shadow{#1}{#2}{#3}{#4}}},%
  no shadow/.code={\def\kvtcb@shadow{}},%
  fuzzy shadow/.style args={#1#2#3#4#5}{shad@w app={%
    \begin{scope}[#5]%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3-4\dimexpr#4\relax}{opacity=0.01}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3-3\dimexpr#4\relax}{opacity=0.02}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3-2\dimexpr#4\relax}{opacity=0.04}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3-#4\relax}{opacity=0.07}%
      \tcb@shadow{#1}{#2}{#3}{opacity=0.11}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3+#4\relax}{opacity=0.11}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3+2\dimexpr#4\relax}{opacity=0.07}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3+3\dimexpr#4\relax}{opacity=0.04}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3+4\dimexpr#4\relax}{opacity=0.02}%
      \tcb@shadow{#1}{#2}{\the\dimexpr#3+5\dimexpr#4\relax}{opacity=0.01}%
  \end{scope}}},%
  %
  drop shadow/.style={shadow={0.9mm}{-0.9mm}{0mm}{opacity=0.5,#1}},
  drop shadow/.default={black!50!white},%
  drop midday shadow/.style={shadow={0mm}{-0.8mm}{-0.4mm}{opacity=0.5,#1}},
  drop midday shadow/.default={black!50!white},%
  halo/.style args={#1 with #2}{shadow={0mm}{0mm}{-#1}{opacity=0.5,#2}},
  halo/.default={0.9mm with yellow},%
  drop fuzzy shadow/.style={fuzzy shadow={1.0mm}{-1.0mm}{0mm}{0.12mm}{#1}},
  drop fuzzy shadow/.default={black!50!white},%
  drop fuzzy midday shadow/.style={fuzzy shadow={0mm}{-1.0mm}{-0.5mm}{0.12mm}{#1}},
  drop fuzzy midday shadow/.default={black!50!white},%
  fuzzy halo/.style args={#1 with #2}{fuzzy shadow={0mm}{0mm}{-#1}{0.12mm}{#2}},
  fuzzy halo/.default={1.0mm with yellow},%
  %
  drop shadow southeast/.style={shadow={0.9mm}{-0.9mm}{0mm}{opacity=0.5,#1}},%
  drop shadow southeast/.default={black!50!white},%
  drop shadow south/.style={shadow={0mm}{-0.8mm}{-0.4mm}{opacity=0.5,#1}},%
  drop shadow south/.default={black!50!white},%
  drop shadow southwest/.style={shadow={-0.9mm}{-0.9mm}{0mm}{opacity=0.5,#1}},%
  drop shadow southwest/.default={black!50!white},%
  drop shadow west/.style={shadow={-0.8mm}{0mm}{-0.4mm}{opacity=0.5,#1}},%
  drop shadow west/.default={black!50!white},%
  drop shadow northwest/.style={shadow={-0.9mm}{0.9mm}{0mm}{opacity=0.5,#1}},%
  drop shadow northwest/.default={black!50!white},%
  drop shadow north/.style={shadow={0mm}{0.8mm}{-0.4mm}{opacity=0.5,#1}},%
  drop shadow north/.default={black!50!white},%
  drop shadow northeast/.style={shadow={0.9mm}{0.9mm}{0mm}{opacity=0.5,#1}},%
  drop shadow northeast/.default={black!50!white},%
  drop shadow east/.style={shadow={0.8mm}{0mm}{-0.4mm}{opacity=0.5,#1}},%
  drop shadow east/.default={black!50!white},%
  drop fuzzy shadow southeast/.style={fuzzy shadow={1.0mm}{-1.0mm}{0mm}{0.12mm}{#1}},
  drop fuzzy shadow southeast/.default={black!50!white},%
  drop fuzzy shadow south/.style={fuzzy shadow={0mm}{-1.0mm}{-0.5mm}{0.12mm}{#1}},
  drop fuzzy shadow south/.default={black!50!white},%
  drop fuzzy shadow southwest/.style={fuzzy shadow={-1.0mm}{-1.0mm}{0mm}{0.12mm}{#1}},
  drop fuzzy shadow southwest/.default={black!50!white},%
  drop fuzzy shadow west/.style={fuzzy shadow={-1.0mm}{0mm}{-0.5mm}{0.12mm}{#1}},
  drop fuzzy shadow west/.default={black!50!white},%
  drop fuzzy shadow northwest/.style={fuzzy shadow={-1.0mm}{1.0mm}{0mm}{0.12mm}{#1}},
  drop fuzzy shadow northwest/.default={black!50!white},%
  drop fuzzy shadow north/.style={fuzzy shadow={0mm}{1.0mm}{-0.5mm}{0.12mm}{#1}},
  drop fuzzy shadow north/.default={black!50!white},%
  drop fuzzy shadow northeast/.style={fuzzy shadow={1.0mm}{1.0mm}{0mm}{0.12mm}{#1}},
  drop fuzzy shadow northeast/.default={black!50!white},%
  drop fuzzy shadow east/.style={fuzzy shadow={1.0mm}{0mm}{-0.5mm}{0.12mm}{#1}},
  drop fuzzy shadow east/.default={black!50!white},%
}


\newif\iftcb@isindraft
\def\tcb@draftmode{\tcbset{spartan,spartan@fit}}
\def\tcbstartdraftmode{\let\tcb@afteroptions@hook=\tcb@draftmode\tcb@isindrafttrue}
\def\tcbstopdraftmode{\let\tcb@afteroptions@hook=\@empty\tcb@isindraftfalse}

\def\tcbinterruptdraftmode{%
  \iftcb@isindraft%
    \tcbstopdraftmode%
    \let\tcbcontinuedraftmode=\tcbstartdraftmode%
  \else%
    \let\tcbcontinuedraftmode=\@empty%
  \fi}

\tcbset{%
  draftmode/.is choice,%
  draftmode/.default=true,%
  draftmode/true/.code=\tcbstartdraftmode,%
  draftmode/false/.code=\tcbstopdraftmode,%
}

\tcbset{%
  reset@skins/.style={%
    frame style=,interior style=,segmentation style=,@title style=,%
    colbacklower=black!15!white,%
    extend freelance=,extend freelancefirst=,extend freelancemiddle=,extend freelancelast=,%
    clear@spec,%
    watermark opacity=1.00,watermark color=\kvtcb@colback!85!\kvtcb@colframe,%
    watermark zoom=0.75,clip watermark,%
    clip title=false,clip upper=false,clip lower=false,%
    no borderline,no shadow,no underlay,no finish,tikz reset,at begin tikz reset,at end tikz reset,%
    boxed title style=,hbox boxed title,code={\let\tcb@specialgeonodes@hook\relax}%
  },
  initialize@reset=reset@skins,
}

\tcbuselibrary{skins@jigsaw}


tcbskinsjigsaw.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbskinsjigsaw.code.tex: Code for colorboxes with different skins
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{3.04}

\tcbuselibrary{skins}

\def\tcb@drawframe@pathjigsaw{%
  \tcb@pathboundary{tcb fill frame}{\tcb@boundaryframe@standardjigsaw}%
}

\def\tcb@boundary@pathfirstjigsaw@A{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\tcb@height-\kvtcb@top@rule}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@out\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \tcb@arc@ins\pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@boundary@pathfirstjigsaw@B{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@out\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@drawframe@pathfirstjigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundary@pathfirstjigsaw@B%
          \tcb@boundarytitle@standard%
        \else%
          \tcb@boundary@pathfirstjigsaw@A%
        \fi%
      \else%
        \tcb@boundary@pathfirstjigsaw@B%
      \fi%
    \else%
      \tcb@boundary@pathfirstjigsaw@A%
    \fi%
  }%
}

\def\tcb@boundary@pathmiddlejigsaw@A{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \pgfpathrectangle{\pgfpointorigin}{\pgfqpoint{\kvtcb@left@rule}{\tcb@height}}%
  \pgfpathrectangle{\pgfqpoint{\tcb@xa}{0pt}}{\pgfqpoint{\kvtcb@right@rule}{\tcb@height}}%
}

\def\tcb@boundary@pathmiddlejigsaw@B{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\tcb@height-\kvtcb@top@rule}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@boundary@pathmiddlejigsaw@C{%
  \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
  \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight}%
  \pgfpathmoveto{\pgfpointorigin}%
  \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
  \pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{0pt}}%
  \pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}%
  \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{0pt}}%
  \pgfpathclose%
}

\def\tcb@drawframe@pathmiddlejigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundary@pathmiddlejigsaw@C%
          \tcb@arc@zpt%
          \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule}%
          \tcbdimto\tcb@xb{\tcb@width-\kvtcb@right@rule}%
          \tcbdimto\tcb@yb{\tcb@height-\kvtcb@top@rule}%
          \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}{\pgfqpoint{\tcb@xb}{\tcb@yb}}%
        \else%
          \tcb@boundary@pathmiddlejigsaw@B%
        \fi%
      \else%
        \tcb@boundary@pathmiddlejigsaw@C%
      \fi%
    \else%
      \tcb@boundary@pathmiddlejigsaw@A%
    \fi%
  }%
}

\def\tcb@drawframe@pathlastjigsaw{%
  \tcb@pathboundary{tcb fill frame}{%
    \pgfseteorule%
    \iftcb@hasTitle%
      \iftcb@titlefilled%
        \ifdim\dimexpr\kvtcb@title@rule>0pt\relax%
          \tcb@boundaryframe@pathlast%
          \tcb@arc@zpt%
          \tcbdimto\tcb@ya{\kvtcb@bottom@rule+\tcb@innerheight+\kvtcb@title@rule}%
          \tcbdimto\tcb@xb{\tcb@width-\kvtcb@right@rule}%
          \tcbdimto\tcb@yb{\tcb@height-\kvtcb@top@rule}%
          \pgfpathrectanglecorners{\pgfqpoint{\kvtcb@left@rule}{\tcb@ya}}{\pgfqpoint{\tcb@xb}{\tcb@yb}}%
          \tcb@boundaryinterior@title@standard%
        \else%
          \tcb@boundaryframe@pathlast%
          \tcb@boundary@base{\kvtcb@left@rule}{\kvtcb@bottom@rule}%
            {\tcb@width-\kvtcb@right@rule}{\tcb@height-\kvtcb@top@rule}%
            {\tcb@arc@ins}{\tcb@arc@zpt}{\tcb@arc@zpt}{\tcb@arc@ins}%
        \fi%
      \else%
        \tcb@boundaryframe@pathlast%
      \fi%
    \else%
      \tcbdimto\tcb@xa{\tcb@width-\kvtcb@right@rule}%
      \pgfpathmoveto{\pgfpointorigin}%
      \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{0pt}{\tcb@height}}%
      \pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\tcb@height}}%
      \tcb@arc@ins\pgfpathlineto{\pgfqpoint{\kvtcb@left@rule}{\kvtcb@bottom@rule}}%
      \pgfpathlineto{\pgfqpoint{\tcb@xa}{\kvtcb@bottom@rule}}%
      \tcb@arc@zpt\pgfpathlineto{\pgfqpoint{\tcb@xa}{\tcb@height}}%
      \pgfpathlineto{\pgfqpoint{\tcb@width}{\tcb@height}}%
      \tcb@arc@out\pgfpathlineto{\pgfqpoint{\tcb@width}{0pt}}%
      \pgfpathclose%
    \fi%
  }%
}


\def\tcb@draw@shadowjigsaw@unbroken{%
  \let\tcb@shadow=\tcb@shadow@unbroken%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@first{%
  \let\tcb@shadow=\tcb@shadow@first%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@middle{%
  \let\tcb@shadow=\tcb@shadow@middle%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\def\tcb@draw@shadowjigsaw@last{%
  \let\tcb@shadow=\tcb@shadow@last%
  \begin{tcbinvclipframe}%
  \kvtcb@shadow%
  \end{tcbinvclipframe}%
}

\tcb@new@skin{enhanced jigsaw}{base@unbroken,%
  frame engine=pathjigsaw,interior titled engine=path,interior engine=path,segmentation engine=path,title engine=path,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@unbroken},%
  skin first=enhancedfirst jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedlast jigsaw}

\tcb@new@skin{enhancedfirst jigsaw}{base@first,%
  frame engine=pathfirstjigsaw,interior titled engine=pathfirst,interior engine=pathfirst,segmentation engine=path,title engine=pathfirst,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@first},%
  skin first=enhancedfirst jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedmiddle jigsaw}

\tcb@new@skin{enhancedmiddle jigsaw}{base@middle,%
  frame engine=pathmiddlejigsaw,interior titled engine=pathmiddle,interior engine=pathmiddle,segmentation engine=path,title engine=pathmiddle,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@middle},%
  skin first=enhancedmiddle jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedmiddle jigsaw}

\tcb@new@skin{enhancedlast jigsaw}{base@last,%
  frame engine=pathlastjigsaw,interior titled engine=pathlast,interior engine=pathlast,segmentation engine=path,title engine=pathlast,%
  set@extensions@preframe={\tcb@draw@shadowjigsaw@last},%
  skin first=enhancedmiddle jigsaw,skin middle=enhancedmiddle jigsaw,skin last=enhancedlast jigsaw}

\tcbset{%
  enhanced jigsaw/.style={skin=enhanced jigsaw},%
  frame engine/pathjigsaw/.style={frame code=\tcb@drawframe@pathjigsaw},
  frame engine/pathfirstjigsaw/.style={frame code=\tcb@drawframe@pathfirstjigsaw},
  frame engine/pathmiddlejigsaw/.style={frame code=\tcb@drawframe@pathmiddlejigsaw},
  frame engine/pathlastjigsaw/.style={frame code=\tcb@drawframe@pathlastjigsaw},
}


tcbtheorems.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbtheorems.code.tex: Code for theorems in colorboxes
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\RequirePackage{amsmath}

\def\tcb@hack@amsmath{\tcb@hack@currenvir\vskip-\abovedisplayskip}

\def\tcb@theo@form@namenumber#1#2{\hbox{#1~#2}}
\def\tcb@theo@form@numbername#1#2{\hbox{#2~#1}}
\def\tcb@theo@form@name#1#2{\hbox{#1}}

\def\tcb@theo@desc@form@std#1{\tcb@desc@col\kvtcb@desc@font\kvtcb@desc@delim@left#1\kvtcb@desc@delim@right}

\def\tcb@theo@title#1#2#3{%
  \ifdefempty{#2}{\setbox\z@=\hbox{#1}}{\setbox\z@=\tcb@theo@form{#1}{#2}}%
  \def\temp@a{#3}%
  \ifx\temp@a\@empty\relax%
    \unhbox\z@\kvtcb@terminatorsign%
  \else%
    \setbox\z@=\hbox{\unhbox\z@\kvtcb@separatorsign\ }%
    \hangindent\wd\z@%
    \hangafter=1%
    \mbox{\unhbox\z@}{\tcb@theo@desc@form{#3}}\kvtcb@terminatorsign%
  \fi%
}

\def\tcb@theo@listentry#1#2#3{%
  \def\kvtcb@listentry{\protect\numberline{#2}#3}%
}

\def\tcb@theo@label#1#2{%
  \def\temp@a{#2}%
  \ifx\temp@a\@empty%
  \else%
    \tcbset{label={#1:#2}}%
  \fi%
}

\tcbset{
  theorem/.style args={#1#2#3#4}{%
    step and label={#2}{#4},%
    title={\letcs\tcb@temp{the#2}\tcb@theo@title{#1}{\tcb@temp}{#3}}},%
  math upper/.style={before upper=$\displaystyle,after upper=$},%
  math lower/.style={before lower=$\displaystyle,after lower=$},%
  math/.style={math upper,math lower},%
  ams equation upper/.style={before upper=\tcb@hack@currenvir\equation,after upper=\endequation},%
  ams equation lower/.style={before lower=\tcb@hack@currenvir\equation,after lower=\endequation},%
  ams equation/.style={ams equation upper,ams equation lower},%
  ams equation* upper/.style={before upper=\tcb@hack@currenvir\csname equation*\endcsname,after upper=\endequation},%
  ams equation* lower/.style={before lower=\tcb@hack@currenvir\csname equation*\endcsname,after lower=\endequation},%
  ams equation*/.style={ams equation* upper,ams equation* lower},%
  ams align upper/.style={before upper=\tcb@hack@amsmath\align,after upper=\endalign},%
  ams align lower/.style={before lower=\tcb@hack@amsmath\align,after lower=\endalign},%
  ams align/.style={ams align upper,ams align lower},%
  ams align* upper/.style={before upper=\tcb@hack@amsmath\csname align*\endcsname,after upper=\endalign},%
  ams align* lower/.style={before lower=\tcb@hack@amsmath\csname align*\endcsname,after lower=\endalign},%
  ams align*/.style={ams align* upper,ams align* lower},%
  ams gather upper/.style={before upper=\tcb@hack@amsmath\gather,after upper=\endgather},%
  ams gather lower/.style={before lower=\tcb@hack@amsmath\gather,after lower=\endgather},%
  ams gather/.style={ams gather upper,ams gather lower},%
  ams gather* upper/.style={before upper=\tcb@hack@amsmath\csname gather*\endcsname,after upper=\endgather},%
  ams gather* lower/.style={before lower=\tcb@hack@amsmath\csname gather*\endcsname,after lower=\endgather},%
  ams gather*/.style={ams gather* upper,ams gather* lower},%
  ams nodisplayskip upper/.style={before upper=\vskip-\abovedisplayskip},%
  ams nodisplayskip lower/.style={before lower=\vskip-\abovedisplayskip},%
  ams nodisplayskip/.style={ams nodisplayskip upper,ams nodisplayskip lower},%
  highlight math style/.style={highlight math/.style={notitle,nophantom,#1}},%
  separator sign/.store in=\kvtcb@separatorsign,%
  separator sign colon/.style={separator sign={:}},%
  separator sign dash/.style={separator sign={\ --}},%
  separator sign none/.style={separator sign=},%
  terminator sign/.store in=\kvtcb@terminatorsign,%
  terminator sign colon/.style={terminator sign={:}},%
  terminator sign dash/.style={terminator sign={\ --}},%
  terminator sign none/.style={terminator sign=},%
  description delimiters/.code 2 args={\def\kvtcb@desc@delim@left{#1}\def\kvtcb@desc@delim@right{#2}},%
  description delimiters parenthesis/.style={description delimiters=()},
  description delimiters none/.style={description delimiters={}{}},
  description color/.code={\def\temp@a{#1}\ifx\temp@a\@empty\relax%
    \def\tcb@desc@col{}\else\def\tcb@desc@col{\color{#1}}\fi},%
  description color/.default=,
  description font/.store in=\kvtcb@desc@font,
  description font/.default=,
  description formatter/.code={\let\tcb@theo@desc@form=#1},%
  description formatter/.default={\tcb@theo@desc@form@std},%
  theorem name and number/.code={\let\tcb@theo@form=\tcb@theo@form@namenumber},
  theorem number and name/.code={\let\tcb@theo@form=\tcb@theo@form@numbername},
  theorem name/.code={\let\tcb@theo@form=\tcb@theo@form@name},
  theorem style/.is choice,
  theorem style/standard/.style={separator sign colon,description delimiters none,
    terminator sign none,theorem name and number,attach title},
  theorem style/change standard/.style={theorem style=standard,theorem number and name},
  theorem style/plain/.style={separator sign none,description delimiters parenthesis,
    terminator sign colon,theorem name and number,attach title to upper={\ }},
  theorem style/plain apart/.style={separator sign none,description delimiters parenthesis,
    terminator sign none,theorem name and number,attach title},
  theorem style/break/.style={theorem style=plain,attach title to upper={\par}},
  theorem style/change/.style={theorem style=plain,theorem number and name},
  theorem style/change apart/.style={theorem style=plain apart,theorem number and name},
  theorem style/change break/.style={theorem style=break,theorem number and name},
  theorem style/margin/.style={theorem style=plain,theorem name,before title=\makebox[0pt][r]{\thetcbcounter\ }},
  theorem style/margin apart/.style={theorem style=margin,attach title,terminator sign none},
  theorem style/margin break/.style={theorem style=margin,attach title to upper={\par}},
}

\newcommand{\new@tcbtheorem}[5][]{%
  \@@newtcolorbox[auto counter,#1]{#2}[3][]{#4,%
    title={\tcb@theo@title{#3}{\thetcbcounter}{##2}},%
    list entry={\protect\numberline{\thetcbcounter}##2},%
    code={\tcb@theo@label{#5}{##3}},%
    ##1}%
  \@@newtcolorbox[#1,no counter,list inside=]{#2*}[2][]{#4,%
    title={\tcb@theo@title{#3}{\@empty}{##2}},%
    ##1}%
}

\def\newtcbtheorem{\let\@@newtcolorbox\newtcolorbox%
  \new@tcbtheorem}

\def\renewtcbtheorem{\let\@@newtcolorbox\renewtcolorbox%
  \new@tcbtheorem}

\newcommand{\tcbmaketheorem}[5]{%
  \newtcolorbox{#1}[3][]{#3,theorem={#2}{#4}{##2}{#5:##3},##1}%
}

\newtcbox{\tcboxmath}[1][]{nobeforeafter,math upper,tcbox raise base,#1}
\newtcbox{\tcbhighmath}[1][]{highlight math,nobeforeafter,math upper,tcbox raise base,#1}

\tcbset{%
  reset@theorems/.style={%
    description formatter,description color,description font,
    highlight math style={colframe=red,colback=yellow!25!white},%
    theorem style=standard,%
  },
  initialize@reset=reset@theorems,
}


tcbxparse.code.tex
%% The LaTeX package tcolorbox - version 3.04 (2014/05/18)
%% tcbhooks.code.tex: Code for adding hooks
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2014 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
%\makeatletter
\tcb@set@library@version{3.04}

\RequirePackage{xparse}[2013/12/31]

\tcbset{%
  IfNoValueTF/.code args={#1#2#3}{\IfNoValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfValueTF/.code args={#1#2#3}{\IfValueTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  IfBooleanTF/.code args={#1#2#3}{\IfBooleanTF{#1}{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}},
  verbatim/.style={fontupper=\ttfamily,nobeforeafter,tcbox raise base,top=0pt,bottom=0pt,left=1mm,right=1mm,boxrule=0.3mm}
}

%-- tcolorbox --
\long\def\tcb@New@TColorBox#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcolorbox[#3,options@for=#1]}{\endtcolorbox}}

\def\DeclareTColorBox{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\NewTColorBox{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\RenewTColorBox{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

\def\ProvideTColorBox{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TColorBox%
  \tcb@process@newenvironment}

%-- tcolorbox (total) --
\long\def\tcb@New@TotalTColorBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\begin{tcolorbox}[#3,options@for=#1]#4\end{tcolorbox}}}

\def\DeclareTotalTColorBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\NewTotalTColorBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\RenewTotalTColorBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

\def\ProvideTotalTColorBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTColorBox%
  \tcb@process@newcommand}

%-- tcbox --
\long\def\tcb@New@TCBox#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]}}

\def\DeclareTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\NewTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\RenewTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

\def\ProvideTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBox%
  \tcb@process@newcommand}

%-- tcbox (total) --
\long\def\tcb@New@TotalTCBox#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbox[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBox{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\NewTotalTCBox{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\RenewTotalTCBox{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\def\ProvideTotalTCBox{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBox%
  \tcb@process@newcommand}

\DeclareTotalTCBox{\tcboxverb}{ O{} v }{verbatim,#1}{#2}

%-- tcboxfit --
\long\def\tcb@New@TCBoxFit#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]}}

\def\DeclareTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\NewTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\RenewTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBoxFit%
  \tcb@process@newcommand}

\long\def\tcb@New@TotalTCBoxFit#1#2#3#4{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcboxfit[#3,options@for=#1]{#4}}}

\def\DeclareTotalTCBoxFit{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\NewTotalTCBoxFit{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\RenewTotalTCBoxFit{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}

\def\ProvideTotalTCBoxFit{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TotalTCBoxFit%
  \tcb@process@newcommand}


%-- tcblisting --
\long\def\tcb@New@TCBListing#1#2#3{%
  \tcb@newenvironment{#1}{#2}{\tcblisting{#3,options@for=#1}}{\endtcblisting}}

\def\DeclareTCBListing{%
  \let\tcb@newenvironment\DeclareDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\NewTCBListing{%
  \let\tcb@newenvironment\NewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\RenewTCBListing{%
  \let\tcb@newenvironment\RenewDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

\def\ProvideTCBListing{%
  \let\tcb@newenvironment\ProvideDocumentEnvironment%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBListing%
  \tcb@process@newenvironment}

%-- tcbinputlisting --
\long\def\tcb@New@TCBInputListing#1#2#3{%
  \expandafter\tcb@newcommand\csname#1\endcsname{#2}{\tcbinputlisting{#3,options@for=#1}}%
}

\def\DeclareTCBInputListing{%
  \let\tcb@newcommand\DeclareDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\NewTCBInputListing{%
  \let\tcb@newcommand\NewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\RenewTCBInputListing{%
  \let\tcb@newcommand\RenewDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}

\def\ProvideTCBInputListing{%
  \let\tcb@newcommand\ProvideDocumentCommand%
  \let\tcb@process@newtcolorbox@continue\tcb@New@TCBInputListing%
  \tcb@process@newcommand}


arxiv.bbl
\begin{thebibliography}{10}\itemsep=-1pt

\bibitem{achanta_pami12}
R.~Achanta, A.~Shaji, K.~Smith, A.~Lucchi, P.~Fua, and S.~S�sstrunk.
\newblock Slic superpixels compared to state-of-the-art superpixel methods.
\newblock {\em IEEE TPAMI}, 2012.

\bibitem{arbelaez_cvpr12}
P.~Arbelaez, B.~Hariharan, C.~Gu, S.~Gupta, L.~Bourdev, and J.~Malik.
\newblock Semantic segmentation using regions and parts.
\newblock In {\em CVPR}, 2012.

\bibitem{boix_ijcv12}
X.~Boix, J.~M. Gonfaus, J.~van~de Weijer, A.~D. Bagdanov, J.~S. Gual, and
  J.~Gonz{\`a}lez.
\newblock Harmony potentials - fusing global and local scale for semantic image
  segmentation.
\newblock {\em IJCV}, 96(1):83--102, 2012.

\bibitem{carreira2012semantic}
J.~Carreira, R.~Caseiro, J.~Batista, and C.~Sminchisescu.
\newblock Semantic segmentation with second-order pooling.
\newblock In {\em Computer Vision--ECCV 2012}, pages 430--443. Springer, 2012.

\bibitem{carreira_ijcv12}
J.~Carreira, F.~Li, and C.~Sminchisescu.
\newblock Object recognition by sequential figure-ground ranking.
\newblock {\em IJCV}, 98(3):243--262, 2012.

\bibitem{carreira2012cpmc}
J.~Carreira and C.~Sminchisescu.
\newblock Cpmc: Automatic object segmentation using constrained parametric
  min-cuts.
\newblock {\em Pattern Analysis and Machine Intelligence, IEEE Transactions
  on}, 34(7), 2012.

\bibitem{simonyan2014return}
K.~Chatfield, K.~Simonyan, A.~Vedaldi, and A.~Zisserman.
\newblock Return of the devil in the details: Delving deep into convolutional
  nets.
\newblock In {\em BMVC}, 2014.

\bibitem{dhruv-new}
M.~Cogswell, X.~Lin, and D.~Batra.
\newblock Personal communication.
\newblock November 2014.

\bibitem{everingham2014pascal}
M.~Everingham, S.~Eslami, L.~Van~Gool, C.~Williams, J.~Winn, and A.~Zisserman.
\newblock The pascal visual object classes challenge: A retrospective.
\newblock {\em International Journal of Computer Vision}, 2014.

\bibitem{farabet2013learning}
C.~Farabet, C.~Couprie, L.~Najman, and Y.~LeCun.
\newblock Learning hierarchical features for scene labeling.
\newblock {\em IEEE TPAMI}, 35(8), 2013.

\bibitem{fulkerson2009class}
B.~Fulkerson, A.~Vedaldi, and S.~Soatto.
\newblock Class segmentation and object localization with superpixel
  neighborhoods.
\newblock In {\em CVPR}, 2009.

\bibitem{girshick2014rich}
R.~Girshick, J.~Donohue, T.~Darrell, and J.~Malik.
\newblock Rich feature hierarchies for accurate object detection and semantic
  segmentation.
\newblock {\em arXiv preprint http://arxiv.org/abs/1311.2524}, 2014.

\bibitem{hariharan2014hypercolumns}
B.~Hariharan, P.~A. an~R.~Girshick, and J.~Malik.
\newblock Hypercolumns for object segmentation and fine-grained localization.
\newblock {\em arXiv preprint http://arxiv.org/abs/1411.5752}, 2014.

\bibitem{BharathICCV2011}
B.~Hariharan, P.~Arbelaez, L.~Bourdev, S.~Maji, and J.~Malik.
\newblock Semantic contours from inverse detectors.
\newblock In {\em International Conference on Computer Vision (ICCV)}, 2011.

\bibitem{hariharan2014simultaneous}
B.~Hariharan, P.~Arbel{\'a}ez, R.~Girshick, and J.~Malik.
\newblock Simultaneous detection and segmentation.
\newblock In {\em Computer Vision--ECCV 2014}, 2014.

\bibitem{huang2013deep}
G.~B. Huang and V.~Jain.
\newblock Deep and wide multiscale recursive networks for robust image
  labeling.
\newblock {\em arXiv preprint arXiv:1310.0354}, 2013.

\bibitem{ion2011probabilistic}
A.~Ion, J.~Carreira, and C.~Sminchisescu.
\newblock Probabilistic joint image segmentation and labeling.
\newblock In {\em NIPS}, pages 1827--1835, 2011.

\bibitem{jia2014caffe}
Y.~Jia, E.~Shelhamer, J.~Donahue, S.~Karayev, J.~Long, R.~Girshick,
  S.~Guadarrama, and T.~Darrell.
\newblock Caffe: Convolutional architecture for fast feature embedding.
\newblock {\em arXiv preprint arXiv:1408.5093}, 2014.

\bibitem{krizhevsky2012imagenet}
A.~Krizhevsky, I.~Sutskever, and G.~E. Hinton.
\newblock Imagenet classification with deep convolutional neural networks.
\newblock In {\em NIPS}, 2012.

\bibitem{kuettel2012segmentation}
D.~Kuettel, M.~Guillaumin, and V.~Ferrari.
\newblock Segmentation propagation in imagenet.
\newblock In {\em ECCV}, 2012.

\bibitem{ladicky_iccv09}
L.~Ladick{\` y}, C.~Russell, P.~Kohli, and P.~H.~S. Torr.
\newblock Associative hierarchical {CRF}s for object class image segmentation.
\newblock {\em ICCV}, 2009.

\bibitem{lempitsky2011pylon}
V.~Lempitsky, A.~Vedaldi, and A.~Zisserman.
\newblock Pylon model for semantic segmentation.
\newblock In {\em NIPS}, pages 1485--1493, 2011.

\bibitem{li2014mean}
Y.~Li and R.~Zemel.
\newblock Mean field networks.
\newblock In {\em ICML Workshop on Learning Tractable Probabilistic Models},
  2014.

\bibitem{Li2013codemaps}
Z.~Li, E.~Gavves, K.~E.~A. van~de Sande, C.~G.~M. Snoek, and A.~W.~M.
  Smeulders.
\newblock Codemaps segment, classify and search objects locally.
\newblock In {\em ICCV}, 2013.

\bibitem{lim2009context}
J.~J. Lim, P.~Arbel{\'a}ez, C.~Gu, and J.~Malik.
\newblock Context by region ancestry.
\newblock In {\em ICCV}, 2009.

\bibitem{long2014fully}
J.~Long, E.~Shelhamer, and T.~Darrell.
\newblock Fully convolutional networks for semantic segmentation.
\newblock {\em arXiv preprint http://arxiv.org/abs/1411.4038}, 2014.

\bibitem{lucchi2011spatial}
A.~Lucchi, Y.~Li, X.~Boix, K.~Smith, and P.~Fua.
\newblock Are spatial and global constraints really necessary for segmentation?
\newblock In {\em ICCV}, 2011.

\bibitem{mostajabi2014robust}
M.~Mostajabi and I.~Gholampour.
\newblock A robust multilevel segment description for multi-class object
  recognition.
\newblock {\em Machine Vision and Applications}, 2014.

\bibitem{pinheiro2014recurrent}
P.~H.~O. Pinheiro and R.~Collobert.
\newblock Recurrent convolutional neural networks for scene labeling.
\newblock In {\em ICML}, 2014.

\bibitem{russakovsky2014imagenet}
O.~Russakovsky, J.~Deng, H.~Su, J.~Krause, S.~Satheesh, S.~Ma, Z.~Huang,
  A.~Karpathy, A.~Khosla, M.~Bernstein, et~al.
\newblock Imagenet large scale visual recognition challenge.
\newblock {\em arXiv:1409.0575}, 2014.

\bibitem{shotton_ijcv09}
J.~Shotton, J.~Winn, C.~Rother, and A.~Criminisi.
\newblock Textonboost for image understanding: Multi-class object recognition
  and segmentation by jointly modeling texture, layout, and context.
\newblock {\em IJCV}, 81(1), 2009.

\bibitem{simonyan2014very}
K.~Simonyan and A.~Zisserman.
\newblock Very deep convolutional networks for large-scale image recognition.
\newblock {\em arXiv preprint http://arxiv.org/abs/1409.1556}, 2014.

\bibitem{socher2011parsing}
R.~Socher, C.~C. Lin, A.~Y. Ng, and C.~D. Manning.
\newblock {Parsing Natural Scenes and Natural Language with Recursive Neural
  Networks}.
\newblock In {\em ICML}, 2011.

\bibitem{stoyanov2011empirical}
V.~Stoyanov, A.~Ropson, and J.~Eisner.
\newblock Empirical risk minimization of graphical model parameters given
  approximate inference, decoding, and model structure.
\newblock In {\em AISTATS}, 2011.

\bibitem{tarlow2012structured}
D.~Tarlow and R.~S. Zemel.
\newblock Structured output learning with high order loss functions.
\newblock In {\em AISTATS}, 2012.

\bibitem{UijlingsIJCV2013}
J.~R.~R. Uijlings, K.~E.~A. van~de Sande, T.~Gevers, and A.~W.~M. Smeulders.
\newblock Selective search for object recognition.
\newblock {\em International Journal of Computer Vision}, 104(2), 2013.

\bibitem{yadollahpour2013discriminative}
P.~Yadollahpour, D.~Batra, and G.~Shakhnarovich.
\newblock Discriminative re-ranking of diverse segmentations.
\newblock In {\em CVPR}, 2013.

\end{thebibliography}
