1

I see \fcolorbox making very thin white lines between the border of a box and the dark background and at the corners of the border. Here is an example:

\documentclass{article}
\usepackage{colortbl}
\begin{document}

\fcolorbox{black}{black}{\quad}

\end{document}

When enlarged, the result looks like the following when viewed in macOS Preview.app:

zoomin

How can I remove those lines for \fcolorbox? Thanks.

Remove thin white line in dark colored cells and Very thin white line in colortbl deal with the problem for \columncolor.

3
  • 4
    Rendering problem --- okular and evince show lines or not depending on the magnification. I tend to blame antialiasing algorithms normally (well, basically the exception to the antialiasing algorithm that is added to avoid wiping out sub-pixel lines, that is).
    – Rmano
    Commented Jul 1, 2021 at 6:51
  • 1
    There is no point using \fcolorbox with the same color for the background and the frame. You should use \colorbox instead and you will never have thin white lines since you will have only one colored rectangle... Commented Jul 1, 2021 at 10:44
  • 1
    Oh, I used the same color to make the lines clear and noticeable. But, anyway, thanks for pointing it out.
    – chan1142
    Commented Jul 1, 2021 at 10:51

1 Answer 1

4

This is a rendering problem --- okular and evince show lines or not depending on the magnification. I tend to blame antialiasing algorithms normally (well, basically the exception to the antialiasing algorithm that is added to avoid wiping out sub-pixel lines, that is).

enter image description here

...this is what each one of the viewers thinks it's a 400% zoom 😏.

You can try to see if a TikZ equivalent (which draws the background in a different way) comes out more resilient to the problem.

\documentclass{article}
\usepackage{colortbl}
\usepackage{tikz}
\newcommand{\tikzcolorbox}[3]{\tikz[baseline]\node[fill=#1,draw=#2]{#3 };}
\begin{document}

\fcolorbox{black}{black}{\quad\textcolor{white}{Text}\quad}

\tikzcolorbox{black}{black}{\quad\textcolor{white}{Text}\quad}

\end{document}

It seems to fix the problem at least in evince:

enter image description here

5
  • Thanks. Would there be a way to enlarge the background part marginally (like the overhang option of \cellcolor) so that white lines are hidden on all viewers?
    – chan1142
    Commented Jul 1, 2021 at 8:12
  • No, sorry, I don't know it. But what do you need to put into the \framebox? Because if you just want a black blob maybe a \vrule will work much better.
    – Rmano
    Commented Jul 1, 2021 at 8:21
  • Thanks. It was just an example. I have put texts in many \fcolorboxs in a document and some people noticed and mentioned (complained about) the white lines. I was wondering if I could \renewcommand it somehow. Anyway I'm glad it's a viewer problem.
    – chan1142
    Commented Jul 1, 2021 at 8:24
  • 1
    I added a possible TikZ solution --- it fixes the problem in evince, YMMV....
    – Rmano
    Commented Jul 1, 2021 at 8:50
  • 1
    Superb! Thanks!
    – chan1142
    Commented Jul 1, 2021 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .