[Tex/LaTex] Using position arguments with starred tcolorbox environment

horizontal alignmentparacolpositioningtcolorbox

The {tcolorbox}* environment is interpreting position arguments in a way I would not anticipate.

When I include the *, the placement is unexpected–\begin{VocabBox}*[b]... does not get placed at the nearest reasonable bottom position, but rather, awkwardly at the end of the document.

If I exclude the *, the placement for \begin{VocabBox}[b]... is as expected.

These two MWEs should demonstrate my meaning (I could not recreate the behavior I was seeing with \documentclass[]{article} and had to use the document class I'm actually working in, \documentclass[]{svmono}):

[ Example 1 ]

\documentclass[]{svmono}
%%%%%% personally included packages %%%%%%%
\usepackage{paracol}
\usepackage[many]{tcolorbox}
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{lipsum}

%%%%%% definitions %%%%%%%%%%%%%%%%%%%%%%%%
\NewTColorBox{VocabBox}{ 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}
\begin{leftcolumn}%
\begin{VocabBox}*[b]
\lipsum[2]
\end{VocabBox}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{leftcolumn}
\begin{rightcolumn}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{rightcolumn}
\end{paracol}

\end{document}

[ Example 2]

\documentclass[]{svmono}
%%%%%% personally included packages %%%%%%%
\usepackage{paracol}
\usepackage[many]{tcolorbox}
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{lipsum}

%%%%%% definitions %%%%%%%%%%%%%%%%%%%%%%%%
\NewTColorBox{VocabBox}{ 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}
\begin{leftcolumn}%
\begin{VocabBox}[b]
\lipsum[2]
\end{VocabBox}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{leftcolumn}
\begin{rightcolumn}
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\lipsum[1]
\end{rightcolumn}
\end{paracol}

\end{document}

Question:

Why does the position algorithm give bizarre results for \begin{VocabBox}*[b], and can it be remedied without sidestepping the package?

Package info:

tcolorbox: CTAN Page
svmono: Download svmono.zip (*S*pringer *V*erlag *Mono*graph class)

Best Answer

I have a workaround for you. Let the float object flow into one column, calculate number of lines it takes and add \enlargethispage with negative value to the second column when dealing with *[b] and \vspace* when dealing with *[t], the value is best when related to the \baselineskip dimension. It is not an automatic way, esp. when adding \vspace* inside the paragraph(s), but it might help a little.

To compute number of lines automatically is probably for another question of yours as the VocabBox environment as it is defined now in the TeX file is in the outer mode and cannot be computed directly via the \setbox command as we use it frequently in TeX typesetting.

I enclose a TeX file and a preview of the result. We can run lua-, xe- and pdflatex.

%! *latex mal-tcolorbox.tex
% The svmono.cls file is available via:
% wget http://ftp.utia.cas.cz/pub/staff/studeny/monogr/svmono.cls
\documentclass[]{svmono}
%%%%%% personally included packages %%%%%%%
\usepackage{paracol}
\usepackage[many]{tcolorbox}
\usepackage[bottom]{footmisc}% places footnotes at page bottom
\usepackage{lipsum}
%%%%%% definitions
\NewTColorBox{VocabBox}{ 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}
\begin{leftcolumn}%
\begin{VocabBox}*[b]
  % *[b] <-- \enlargethispage; [b] is for one column
  % *[t] <-- \vspace*; [t] is for one column
\lipsum[2]
\end{VocabBox}
\lipsum[1-5]
\end{leftcolumn}
\begin{rightcolumn}
\enlargethispage{-11\baselineskip} % when using *[b]
%\vspace*{10\baselineskip} % when using *[t]
\lipsum[1-5]
\end{rightcolumn}
\end{paracol}
\end{document}

mwe

Related Question