I have defined a command that uses the minipage
environment to format an "example" question within my document.
\newcounter{Example}
\newcommand{\example}[3]{%
\refstepcounter{Example}
\fbox{%
\begin{minipage}{\textwidth}
\subsubsection{Example \theExample:\textsf{\ #1}}
{\leftskip 1em \rightskip 1em
#2
}
\vskip 0.5em
\colorbox{lightergray}{%
\begin{minipage}[c]{0.98\textwidth}
#3
\end{minipage}%
}
%end subsubsection{Example}
\end{minipage}
}%
}
(This code creates a command \example{<title>}{<question>}{<answer>}
).
To produce this:
However I need this to be able to split across multiple page breaks. At the moment the following is produced at a page break:
This is not desirable. I know this is because of the minipage environment. Is there a way that I can produce this same output whilst allowing page breaks? (Ideally I would like no border at the bottom of the first page and no top border on the new page.)
I am compiling with TeX4ht
so require either common packages or standard LaTeX/TeX.
I understand a type of list environment may be useful here but I'm unsure how to apply this to this specific case.
Best Answer
Alternative: Use
tcolorbox
(Gonzalo Medina was proposing it while I wrote this answer ;-)) with thebreakable
option. There is a huge number of options for the shape, colours etc -- it's impossible to show them all here in a small example.