I would like to have infoboxes in my thesis work, with background color, where I can define parameters and some code snippets. I have the following code as of now, which is sort of what I want except the boxes end up showing huge margins top and bottom, and they are not floating in text, leaving large gaps in text.
Code: Select all
% info-boxes
\definecolor{MyGray}{rgb}{0.95,0.95,0.95}
\makeatletter\newenvironment{graybox}{%
\begin{center}
\begin{lrbox}{\@tempboxa}\begin{minipage}{0.9\textwidth}}{\end{minipage}\end{lrbox}%
\colorbox{MyGray}{\usebox{\@tempboxa}}
\end{center}
}\makeatother
Code: Select all
%infoboxes
\usepackage{float}
%allows use of "@" before \begin{document}
\makeatletter
% this creates a custom and simpler ruled box style
\newcommand\floatc@simplerule[2]{{\@fs@cfont #1 #2}\par}
\newcommand\fs@simplerule{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@simplerule
\def\@fs@pre{\hrule height.8pt depth0pt \kern4pt}%
\def\@fs@post{\kern4pt\hrule height.8pt depth0pt \kern4pt \relax}%
\def\@fs@mid{\kern8pt}%
\let\@fs@iftopcapt\iftrue}
\makeatother
%this code block defines the new and custom floatbox float environment
\floatstyle{simplerule}
\newfloat{floatbox}{thp}{lob}[section]
\floatname{floatbox}{Text Box}
Thanks in advance!