2

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)

  • I think you meant to say \begin{VocabBox*} instead of \begin{VocabBox}*. I don't seem to have the svmono class so I can't test it. – Peter Grill Apr 10 '14 at 3:53
  • A tip for solvers to get that class file: wget http://ftp.utia.cas.cz/pub/staff/studeny/monogr/svmono.cls – Malipivo Apr 10 '14 at 5:22
  • The same happens for the article class. – egreg Apr 10 '14 at 7:37
  • The same happens for figure and figure* instead of VocaBox (using article). On my system, for both examples and tcolorbox OR figure all the floats are placed at the end of the document. So, it is not a tcolorbox issue. I guess, it has to do with paracol and how to specify floats for paracol. I'm not familiar with paracol. Maybe, somebody can help who is. – Thomas F. Sturm Apr 10 '14 at 11:53
  • @PeterGrill The syntax is \begin{VocabBox}* – Mackie Messer Apr 10 '14 at 15:42
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.