Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following code that generate a box with text content:

\documentclass{report}

\usepackage{color}
\usepackage{lipsum}
\newcommand\tipbox[1]{%
  \begin{center}%
    \fcolorbox{black}{white}{%
      \begin{minipage}[t]{\dimexpr\textwidth-2\fboxsep-2\fboxrule}%
        #1%
      \end{minipage}}%
  \end{center}}

\begin{document}
\lipsum[1]
\tipbox{\lipsum[1]}
\lipsum[1]
\tipbox{\lipsum[1]}
\end{document}

However, in the generated PDF, it does not show the lines properly at 100% zoom. See the screenshots taken from Foxit Reader (note missing left border):

Foxit Reader

and from TeXworks reader (note missing top border):

TeXworks pdf reader

If I increase the zoom to a larger number I can see all the lines. I haven't tried to print to see the results. Is this a PDF reader issue or a problem with my box? How to fix this?

share|improve this question
3  
Seems like a problem of the pdf viewer. Evince is doing fine, in Acrobat Reader (Linux version), the different edges are displayed at different zoom levels. –  Caramdir Feb 22 '11 at 20:49
    
@Caramdir Hi, the problem occurs at 100% zoom or less. With more than 100% they show all the lines. –  Weslei Feb 22 '11 at 21:11
1  
@Caramdir: technically evince is doing wrong and acrobat is correct. The rasterization rules for PDF are counterintuitive. –  Lev Bishop Feb 22 '11 at 21:55
    

1 Answer 1

up vote 19 down vote accepted

Change \usepackage{color} to \usepackage{xcolor} or for even better results (the lines meet properly in the corners of the box at all zoom levels) \usepackage[xcdraw]{xcolor}.

Background: this is a problem only with certain PDF viewers. Ironically, the PDF viewers that display the problem are the ones which are implementing the PDF spec correctly (see "Scan Conversion Rules" section 10.6.4). The other PDF viewers use an antialiasing type of algorithm that is strictly against the spec but is more forgiving of certain faulty assumptions that you might make when generating the PDF (for example the assumption that a line that is strictly to the left of a white rectangle will never be obscured by that rectangle).

share|improve this answer
    
That is it!!! Thank you very much, it worked perfectly! –  Weslei Feb 23 '11 at 12:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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