Another approach using tcolorbox
options sidebyside
:
\documentclass[margin=5pt]{standalone}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{tcolorbox, xcolor, lmodern}
\tcbuselibrary{skins}
\definecolor{jblueleft}{RGB}{0, 79, 144}
\definecolor{jblueinner}{RGB}{240, 248, 255}
% my guess to missing definitions
\newcommand\bmv{\bm{v}}
\newcommand\ui{\mathbf{i}}
\newcommand\uj{\mathbf{j}}
\tcbset{
textmarker/.style={
enhanced,
sharp corners,
boxrule=0pt,
}
}
% end of my guess
\newsavebox{\exampleTitle}
\savebox\exampleTitle{%
\fontfamily{lmss}\bfseries
\textcolor{jblueleft}{Definition.}}
\newtcolorbox{exampleBox}{
textmarker,
borderline west={3pt}{0pt}{jblueleft},
colback=jblueinner,
before upper=\usebox\exampleTitle,
sidebyside,
lower separated=false,
sidebyside align=top,
sidebyside gap=5pt,
lefthand width=\the\wd\exampleTitle,
} % Define the box style.
\newcommand{\definition}[1]{%
\begin{exampleBox}
\tcblower
#1%
\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}
OP's example is incomplete: none of the definitions of commands \bmv
, \ui
, and \uj
and tcolorbox
style key textmaker
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.
\documentclass[margin=5pt]{standalone}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{tcolorbox, xcolor, lmodern}
\tcbuselibrary{skins}
\definecolor{jblueleft}{RGB}{0, 79, 144}
\definecolor{jblueinner}{RGB}{240, 248, 255}
% my guess to missing definitions
\newcommand\bmv{\bm{v}}
\newcommand\ui{\mathbf{i}}
\newcommand\uj{\mathbf{j}}
\tcbset{
textmarker/.style={
enhanced,
sharp corners,
boxrule=0pt,
}
}
% end of my guess
\makeatletter
\newtcolorbox{exampleBox}{
textmarker,
borderline west={3pt}{0pt}{jblueleft},
colback=jblueinner,
before upper=\@hangfrom{%
\fontfamily{lmss}\bfseries
\textcolor{jblueleft}{Definiton. }% note the space after "."
},
} % Define the box style.
\makeatother
\newcommand{\definition}[1]{%
\begin{exampleBox}
#1%
\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}
Best Answer
This is the revised version of my first answer. It requires
tcolorbox
with version2.80 (2014/03/31)
.To get an equivalent to the
figure*
environment fortcolorbox
, you have to use thefloat*
option instead of thefloat
option. The width of thetcolorbox
has to be adapted also, e.g.width=\textwidth
.If you want to have also the star analogon, you can use the following example code. Note that the star is placed after the name of the environment.