controlling position of tcolorbox

I am attempting to control the position of a boxed insert created using the tcolorbox package. However I cannot fully control the position of the box as for figures and tables, for example using for example htpb!. Here is an example that replicates the issue:

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{lipsum}
\begin{document}
\lipsum[2-6]
\begin{tcolorbox}[float=htpb!, title=A box]
This is a box!\\
With a couple lines.
\end{tcolorbox}
Some more text.
\end{document}


I would like the box to appear before "some more text."

• Do you really need the floating of the box? – user31729 Jun 13 '17 at 12:25
• Just remove the float=htpb!, and the box will appear exactly where you put it in the code. – Tiuri Jun 13 '17 at 12:27

There's no need to let this box to float around (I never needed it for tcolorbox yet). Just remove the float option.

\documentclass{article}
\usepackage{tcolorbox}
\usepackage{lipsum}
\begin{document}
\lipsum[2-6]

\begin{tcolorbox}[title=A box]
This is a box!\\
With a couple lines.
\end{tcolorbox}

Some more text.
\end{document}

• Thanks...this works for my MWE but not for my more complex real example. In the real example I have the sequence: table 1, figure, table 2, box, and the box appears after table 1 no matter what I have tried (including this suggestion). I'm not sure if that's enough information...I will try to come up with a MWE that fully captures the issue – tvg Jun 13 '17 at 12:58
• @tvg: Of course, your other tables and figures are floating away then -- and you're changing the question now – user31729 Jun 13 '17 at 13:00
• truth. trying to figure out the real problem... – tvg Jun 13 '17 at 13:04