The purpose of the mybox environment in the following document is to typeset a box in a blue background. The box may be split by page breaks. The algorithm used is similar to the one found in the boites package:

  • first the text is formatted in a vbox
  • then each line of the vbox is extracted from the vbox and output in a colorbox.

The document:




  % total height of original box
  % split original box in order to retrieve its first line
  \setbox\boxhead\vsplit\boxtail to 0pt
  % fix the height of the first line
  % restore original size

    \fboxsep 0pt
    \splittopskip 0pt
    \baselineskip 0pt
    \lineskiplimit 0pt
    \lineskip 0pt
        \colorbox{blue}{\hbox to \linewidth{\box\boxhead}\hfil}%




When looking with care (the following image shows the document opened in the evince pdf viewer), very thin white rules can be seen between the blue lines in the text formatted by the environment.

sample document

Has anybody any clues on how to eliminate them?

I know there are packages like mdframed that already provides this functionality using a different algorithm. But they do not work with the beamer class or in multicolumn environments, and they cannot be nested.


As pointed by others, this seems to be an issue with the pdf viewer. I tried several viewers (on Linux) and found that some of them shows the thin white rules and others do not.

Good pdf viewers:

  • qpdfview 0.4.9
  • adobe reader 9.5.5
  • okular 0.18.3
  • foxit reader (with wine)

Bad pdf viewers:

  • evince 3.10.3
  • epdfviewer 0.1.8
  • sumatra pdf 2.4 (with wine)
  • pdf-xchange (with wine)
  • Which pdf viewer do you use? I do not see any white lines. Apr 23 '12 at 2:07
  • @YiannisLazarides: evince, okular and zathura on Linux. With acroread I do not see the thin white lines.
    – Romildo
    Apr 23 '12 at 2:10
  • 1
    It is a problem with the viewer and not the code. Apr 23 '12 at 5:05

This is most likely a feature of the viewer, however you can workaround it by inserting a small negative skip (the smallest fraction of a point that works on your screen) so that the coloured boxes overlap. Depending on your requirements that may be enough or you may want to compensate by increasing the height of the box so

instead of


something like


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.