I'm trying to create an environment that provides a framed box within a report. My current problems are:
- The interparagraph spacing does not match the body text spacing (the space within the box is small)
- The box caption prints but can't be cross-referenced (the labels aren't getting through)
\documentclass[parskip=half,twocolumn,landscape]{scrreprt}
\usepackage{lipsum}
\usepackage{caption,mdframed,newfloat,xcolor}
\usepackage{varioref}
\usepackage{cleveref}
\setkomafont{disposition}{\bfseries\color{orange}}
\RedeclareSectionCommand[
beforeskip=-.75\baselineskip,
afterskip=.5\baselineskip]{subsection}
\definecolor{orangeBackground}{RGB}{254,240,222}
\DeclareCaptionFont{orange}{\color{orange}}
\DeclareFloatingEnvironment[fileext=frm,placement={!ht},name=Box]{smallboxfloat}
\mdfdefinestyle{aFrameBox}{%
linecolor=orange,
nobreak=true, % prevents page breaking
outerlinewidth=0.5pt,
innertopmargin=0.5\baselineskip,
innerbottommargin=\baselineskip,
innerrightmargin=11pt,
innerleftmargin=11pt,
backgroundcolor=orangeBackground
}
\newenvironment{smallbox}[2]{%
\begin{smallboxfloat}
\begin{mdframed}[style=aFrameBox]%
\captionsetup{labelfont={bf,orange}, font={bf,orange}, format=plain,justification=justified,singlelinecheck=false}
\caption{#1}\label{#2}
}{\end{mdframed}\end{smallboxfloat}}
\begin{document}
\begin{smallbox}{Box title}{box:label}
\lipsum[1-2]
\end{smallbox}
\subsection{Title}
\lipsum[1-2] \Vref{box:label}
\end{document}
varioref
andcleveref
are not getting well with each other. I thinkcleveref
itself is enough.