15

Sometimes I want to draw tcolorboxes without frames and although I use boxrule=0pt some border frame is still visible. I would like to know why.

As an example, take a look at next code which draws a bicolor box.

\documentclass{article}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{tcblisting}{bicolor, colback=blue!15, 
         colbacklower=white, boxrule=0pt}
This is an example of a \emph{bicolor} \texttt{tcolorbox}
\end{tcblisting}

\end{document}

enter image description here

As you can see the frame around the box is clearly visible. I've tested with different viewers and all of them show the border.

My opinion is that this border shows a little difference between frame dimensions and inner upper and lower parts, but I'm not sure because boxsep=0pt doesn't affect it. But colframe=white hiddes it because the paper is also white. This could be a solution except if background is colorful (like in beamer). And I would like to understand what happens.

If I use an empty skin nothing except the text is shown, but I don't now how to reproduce a bicolor skin from an empty one.

  • 1
    Ulrike Fischer gave the answer I also would have given. In your case, the frame is drawn as a filled rectangle with near-black color. Then, the same space is filled with the upper and lower part of the bicolor interior. Theoretically, you should see nothing of the frame anymore. But many previewers show a ghost line with 0pt width. frame hidden switches the frame drawing completely off. – Thomas F. Sturm May 29 '15 at 6:20
  • @ThomasF.Sturm Thank's for confirming it and for tcolorbox, of course! – Ignasi May 29 '15 at 6:42
14

You can use frame hidden

 \documentclass{article}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}

\begin{document}

\begin{tcblisting}{bicolor, colback=blue!15,
         colbacklower=white, boxrule=0pt,frame hidden}
This is an example of a \emph{bicolor} \texttt{tcolorbox}
\end{tcblisting}

\end{document}

enter image description here

  • Thanks, but do you know why the frame is seen even with boxrule=0pt? – Ignasi May 28 '15 at 21:28
  • Imho pixel rounding. You get a border also with \begin{tikzpicture} \fill[gray] (0,0)rectangle (1,1); \fill[white] (0,0)rectangle (1,1); \end{tikzpicture}. – Ulrike Fischer May 28 '15 at 22:04
  • @UlrikeFischer Yes, that's exactly the reason. tcolorbox draws the frame first, then the interior is drawn above. – Thomas F. Sturm May 29 '15 at 6:15
6

Not sure if this is what you wanted, but you can add \tcbset{colframe=white} to your preamble (or locally).

Output

enter image description here

Code

\documentclass{article}
\usepackage{lmodern}
\usepackage[most,listings]{tcolorbox}

\tcbset{colframe=white}

\begin{document}

\begin{tcblisting}{bicolor, colback=blue!15,colbacklower=white, boxrule=0pt}
This is an example of a \emph{bicolor} \texttt{tcolorbox}
\end{tcblisting}

\end{document}
  • As I already commented, this solution only works if background is also white. – Ignasi May 28 '15 at 21:27
  • @Ignasi Oh I had missed that line. Wouldn't setting it using the colour of the background work? Unless the background has multiple colours (which would be quite ugly). – Alenanno May 28 '15 at 21: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.