I'd like to split a tcolorbox
environment into two columns like this:
+---------------------------------------------------------------------------+
| Definition. Lorem ipsum dolor sit amet, consectetur adipiscing elit. |
| Praesent ac sem commodo, venenatis nisl ac, pharetra arcu. | <-- tcolorbox
| Cras accumsan pharetra facilisis. Vivamus mattis vulputate |
| dui, quis vulputate metus pretium a. |
+---------------------------------------------------------------------------+
I first tried putting a two-column table into the tcolorbox, but this did not even compile (LaTeX error: floats lost). I then tried putting two minipages (one for Definition., the rest for the text) inside the tcolorbox to split it in half, but alignment is corrupted in such a way that I don't really even know how to describe the problem:
\documentclass{standalone}
\usepackage{tcolorbox, xcolor, lmodern}
\definecolor{jblueleft}{RGB}{0, 79, 144}
\definecolor{jblueinner}{RGB}{240, 248, 255}
\newtcolorbox{exampleBox}{textmarker,
borderline west={3pt}{0pt}{jblueleft},
colback=jblueinner} % Define the box style.
\newcommand{\definition}[1]{
\begin{exampleBox}
\fboxsep=0pt
\noindent\begin{minipage}[t]{0.5\linewidth}
{\fontfamily{lmss}\selectfont\textcolor{jblueleft}{\textbf{Definition}.}}
\end{minipage}
\hfill
\begin{minipage}[t]{0.5\linewidth}
#1
\end{minipage}
\end{exampleBox}
}
\begin{document}
\definition{For a particle traversing a 2-dimensional path \(c\) in a force field \(\bmv F(x,y)=f(x,y)\ui+g(x,y)\uj\), the work integral is
\begin{align*}
W&=\int_c \bmv F\cdot\,\mathrm d\bmv r\\
&=\int_c f(x,y)\,\mathrm dx+\int_c g(x,y)\,\mathrm dy
\end{align*}}
\end{document}
The following gives this erroneous output:
Best Answer
Another approach using
tcolorbox
optionssidebyside
:OP's example is incomplete: none of the definitions of commands
\bmv
,\ui
, and\uj
andtcolorbox
style keytextmaker
are provided. I used my guess instead.Hmm,
\@hangfrom
, which comes from LaTeX2e kernel, will make the example shorter. Output is the same as above.