[Tex/LaTex] tcolorbox Spanning Two Columns in {paracol} Environment

horizontal alignmentparacolparcolumnstcolorbox

The paracol environment allows figures to span two columns by using an asterisk in the figure's environment declaration: \begin{figure*} ... \end{figure*}.

I'm not familiar with the guts of why that works, and I was curious to know if there's something analogous for an environment derived from tcolorbox (like \newtcolorbox{NewBox}[1][!htbp]{...float=#1}). That is, in this example, can I get a NewBox that spans both paracol columns the way I wrongly assumed \begin{NewBox*} ... \end{NewBox*} would.

PS The tag below is "parcolumns" because I don't have a high enough reputation to create the tag 'paracol' (in reference to this CTAN package: http://www.ctan.org/pkg/paracol)

Best Answer

This is the revised version of my first answer. It requires tcolorbox with version 2.80 (2014/03/31).

To get an equivalent to the figure* environment for tcolorbox, you have to use the float* option instead of the float option. The width of the tcolorbox has to be adapted also, e.g. width=\textwidth.

If you want to have also the star analogon, you can use the following example code. Note that the star is placed after the name of the environment.

\documentclass{article}
\usepackage{paracol}
\usepackage[many]{tcolorbox}% version 2.80 (2014/03/31)

\usepackage{lipsum}

\NewTColorBox{NewBox}{ s O{!htbp} }{%
  floatplacement={#2},
  IfBooleanTF={#1}{float*,width=\textwidth}{float},
  colframe=blue!50!black,colback=blue!10!white,% any tcolorbox options here
  }

\begin{document}

\begin{paracol}{2}
\sloppypar
\lipsum[1]
\begin{NewBox}
Single column float.
\end{NewBox}
\switchcolumn
\begin{NewBox}[!h]
Single column float.
\end{NewBox}
\lipsum[2]

\lipsum[3]
\switchcolumn
\lipsum[4]

\begin{NewBox}*
Double column float.
\end{NewBox}

\lipsum[5]
\switchcolumn
\lipsum[6]
\end{paracol}

\end{document}

enter image description here

enter image description here

Related Question