Since you are constructing a titled colored box, I would suggest to consider the packages mdframed
or tcolorbox
for your task.
The following example code uses tcolorbox
version 3.04 (2014/05/18)
. An automatically numbered bluebox
is contructed which includes the wrapfigure
and takes 4 parameters described in the following code.
For easy references, the cleveref
package is also included which defines the \Cref
macro used in the example.
\documentclass{scrartcl}
\usepackage[skins,xparse]{tcolorbox}% version 3.04
\usepackage{wrapfig,cleveref}
\usepackage{lipsum}
% optional #1: width of the box
% optional #2: further tcolorbox options
% mandatory #3: title (caption text)
% mandatory #4: label of the box
\NewTColorBox[auto counter,
Crefname={Box}{Boxes},crefname={box}{boxes}]% <-- replace with your boxname
{bluebox}{ O{3.00in} O{} m m }{%
enhanced,width=#1,before=\wrapfigure{L}{#1},after=\endwrapfigure,
size=fbox,left=0.25cm,right=0.25cm,toptitle=0.2cm,bottom=0.2cm,
top=0.2cm,bottomtitle=0.2cm,
colframe=blue!10!white,interior hidden,coltitle=black,fonttitle=\bfseries,
title code={\draw[line width=.1cm,red,shorten <=0.25cm+3pt,shorten >=0.25cm+3pt]
(title.south west)--(title.south east);},
borderline={0.4pt}{0pt}{black,sharp corners},
title={Box~\thetcbcounter: #3},label={#4},#2}
\begin{document}
Box~\ref{boxlabel} defines all the terminologies used in this paper.
\Cref{boxlabel} defines all the terminologies used in this paper.
\lipsum[4-5]
\begin{bluebox}{My caption here}{boxlabel}
\lipsum[4]
\end{bluebox}
\lipsum[3-5]
\end{document}
Forget about caption
:
\documentclass{article}
\makeatletter
\renewcommand{\fnum@figure}{Fig. \thefigure}
\makeatother
\begin{document}
\begin{figure}
Drawing here
\caption{Caption here}
\end{figure}
\end{document}
Here I just modified LaTeX command that shows in your captions. Now it displays as you want.
Best Answer
Not discussing your
adjustbox
/minipage
solution here, Werner already mentionedEither way, here is a solution, that does work. Also provided is the usage of
\newenvironment
to make your life a little bit easier.Minimal working example (MWE) I
MWE II
Output