My problem is that wants to create a environment that can create a minipage with a background color and some text in it.
I can make this by doing it by hand, but I have a lot of boxes, and to write mostly the same over and over again is to my a bit redundant.
Code: Select all
\documentclass[12pt,a4paper]{book} % Book settings + layout
\usepackage{xcolor} % Extended colors
\usepackage{color} % Color extended names
%DEFINE ENVIRONMENT BLOCK
% Riddle
\newenvironment{Riddle}{ % Riddle environment
\begin{center} % Centering minipage
\colorbox[HTML]{F8E0E0} { % Set's the color of minipage
\begin{minipage}[b]{380px} % Starts minipage
\textbf{Riddle: }\\ \itshape % Set's title and starts italic for text
\end{minipage}} % End minipage
}{\end{center}} % End Riddle environment
\begin{document}
\begin{center}
\colorbox[HTML]{F8E0E0}{
\begin{minipage}[c]{380px}
\textbf{Riddle: }\\ \textit{some text here}
\end{minipage}
}
\end{center}
Some other text
\begin{Riddle}
some text here
\end{Riddle}
\end{document}
Code: Select all
% Riddle
\newenvironment{Riddle}{ % Riddle environment
\begin{center} % Centering minipage
\colorbox[HTML]{F8E0E0} { % Set's the color of minipage
\begin{minipage}[b]{380px} % Starts minipage
\textbf{Riddle: }\\ \itshape % Set's title and starts italic for text
\end{minipage}} % End minipage
}{\end{center}} % End Riddle environment