I have defined a command that uses the minipage environment to format an "example" question within my document.

            \subsubsection{Example \theExample:\textsf{\ #1}}
                {\leftskip 1em \rightskip 1em 


                \vskip 0.5em

            %end subsubsection{Example}     

(This code creates a command \example{<title>}{<question>}{<answer>}).

To produce this:

Current output of above code

However I need this to be able to split across multiple page breaks. At the moment the following is produced at a page break:

Undesired page splitting

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.

  • 2
    Use the tcolorbox package. Jun 16, 2015 at 16:36
  • why the }{ % and } % forcing word spaces? Jun 16, 2015 at 16:42
  • @DavidCarlisle I'm not really sure. Why do people use those? I thought it was to stop LaTeX thinking there's a line break there. Jun 16, 2015 at 16:53
  • 1
    @HarrySmith a linebreak is a space so ...}% has no space after the } but you have ....} % which forces a space in that position, as you have space token before the % Jun 16, 2015 at 17:11

1 Answer 1


Alternative: Use tcolorbox (Gonzalo Medina was proposing it while I wrote this answer ;-)) with the breakable 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.




\newtcbtheorem[auto counter]{example}{My Example}{arc=0pt, auto outer arc, breakable,left=2pt,right=2pt,colback=LightBlue,colbacktitle=LightBlue,coltitle=black,title after break={Continued from Example \thetcbcounter},titlerule=0pt}{examples}


In \ref{examples:brontosaurs}, we will see that...

\begin{example}{Theory on Brontosaurs}{brontosaurs}


enter image description here

  • 1
    I've looked at the tcolorbox package but found that TeX4ht had problems compiling it. I'm trying to stick to either very common packages or standard LaTeX/TeX because I need both .pdf documents and .html files. Jun 16, 2015 at 16:51
  • @HarrySmith: You did not mention tex4ht at all in your post. Well, I posted a possible solution before tex4ht was mentioned, I won't delete it
    – user31729
    Jun 16, 2015 at 16:53
  • 3
    @HarrySmith -- please add your TeX4ht/ .html requirement to the statement of your question. Jun 16, 2015 at 16:53
  • 1
    Updated. I will certainly use this package for future documents, though! Jun 16, 2015 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.