7

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)

2
  • I've left parcolumns since it is a tag for text set in parallel columns regardless of package. paracol has been added, though. I also deleted multicol which somehow got added but isn't relevant here. (It concerns the package by the same name but that's not relevant as far as I can see.)
    – cfr
    Commented Mar 26, 2014 at 2:03
  • Please add a Minimal Working Example.
    – cfr
    Commented Mar 26, 2014 at 2:04

1 Answer 1

12

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

2
  • In this example, does {NewBox}* accept position arguments, and if so how are they passsed: \begin{NewBox}[h]*... or \begin{NewBox}*[h]...? Commented Apr 3, 2014 at 18:32
  • 1
    Yes, you can give position arguments by \begin{NewBox}*[h] :-) Commented Apr 4, 2014 at 5:32

You must log in to answer this question.

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