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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using \fcolorbox on a background that is itself colored; I don't need color inside the box, and I want its background to be transparent so that the background color shows through. The transparent package does not seem to work for this. How can I draw a transparent color?

share|improve this question
have you seen transparent-background-for-mdframed-environment – cmhughes Jun 11 '12 at 3:10
Why not use \fbox? – Stephan Lehmke Jun 11 '12 at 3:17
Can you please add to your question a complete and minimal document with the relevant settings? – Gonzalo Medina Jun 11 '12 at 3:22

In my ytableau package I sort of dealt with this question in the following way. Basically, my idea is that uncolored text (such as text produced by TeX in normal paragraphs) actually already has a transparent background, which shows up as white only because the default paper color is white. xcolor seems to actually "paint" a color in the background of any colored box, so even making a "white" \fcolorbox makes it an opaque white. This makes sense if you imagine putting such a box on top of another box that had been colored something else. As such, to draw a transparent box you need to not use \fcolorbox, but simply \fbox.

This has two deficiencies:

  • You have to use two different commands depending on whether or not you want color. This is, of course, how things usually are, but if you really want unity you will have to redefine \fcolorbox (or better, define your own colored-box command) that interprets, say, "clear" to mean \fbox. Since \fcolorbox has a number of optional arguments I feel this is more trouble than it is worth.

  • You can't color the frame of the \fbox alone. One way to do this is to put \color{<frame color>} before \fbox and then put \color{<text color>} inside \fbox, which is necessary to override the frame color for the text itself. Even if you want the text to be the default black.

For example, here is a "color-framed colored-text box":

\colorfbox{red}{black}{abc} def
share|improve this answer

Your Answer


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.