2

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."

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

1 Answer 1

3

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}
3
  • 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
    Commented Jun 13, 2017 at 12:58
  • @tvg: Of course, your other tables and figures are floating away then -- and you're changing the question now
    – user31729
    Commented Jun 13, 2017 at 13:00
  • truth. trying to figure out the real problem...
    – tvg
    Commented Jun 13, 2017 at 13:04

You must log in to answer this question.

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