2

When I use the monochrome option with the article class, the background of the mdframed frames is completely black. Is it a bug or just my misuse of the monochrome option?

\documentclass{article}
%\documentclass[monochrome]{article}

\usepackage{xcolor}
\usepackage{mdframed}

\begin{document}

Some text. {\color{blue!45}This text is blue (or black if the monochrome option is specified)}

\begin{mdframed}
    More text
\end{mdframed}

\end{document}

Without monochrome: Without monochrome

With monochrome: With monochrome

0

1 Answer 1

4

With the standard framemethod the background is basically one large \rule whose color is changed to white by default. If you disable colors with the monochrome option this rule gets black.

You could use the tikz framemethod instead. And consider to switch to tcolorbox which is much more flexible and stable than mdframed.

\documentclass{article}

\usepackage[monochrome]{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\begin{document}

{\color{white}\rule{2cm}{2cm}} %black with monochrome.

Some text. {\color{blue!45}This text is blue (or black if the monochrome option is specified)}

\begin{mdframed}
    More text
\end{mdframed}

\end{document}

enter image description here

1
  • Thank you for the precision which explains why the background is black and for the solution with framemethod=tikz which I will adopt for the moment. I will switch to tcolorbox for my next documents. I notice that you use the monochrome option when loading the xcolor package instead of using it as an option when declaring the class of the document; Is it equivalent or is one better than the other? Jul 22, 2022 at 12:00

You must log in to answer this question.

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