[Tex/LaTex] Font color is always black in mdframed

mdframedtikz-pgf

When building the MWE below in Linux (Centos, TeXLive 2013, mdframed=1.9b,2013/07/01) I get the expected red text on pale yellow inside red rounded rectangle in the body, and red on full yellow in the PGF one-node diagram at the bottom. [first image]

When building the MWE below in Windows 7 (Cygwin, TeXLive 2014, mdframed=1.9b,2013/07/01) I get unexpected black text on pale yellow inside red rounded rectangle in the body, and red on full yellow in the PGF one-node diagram at the bottom. [second image]

EDIT: in all cases I was using xelatex. Using luatex and pdflatex I get red on yellow, as desired and expected.

When I modify the MWE (comment out the \usepackage[tikz]{mdframed} and uncomment the \usepackage{mdframed} I get red text on pale yellow inside red not-rounded rectangle (as I would expect) in the body, and red on full yellow in the PGF one-node diagram at the bottom. [third image; top and left lines hidden due to PDF rendering, I think — they're there when I change zoom levels]

It appears to be ignoring the fontcolor directive in mdframed (and font={c\color{red}, tested but not shown in MWE; font={\sffamily} does the expected as shown in MWE output) when using framemethod=tikz under Windows/Cygwin.

TikZ picture included at bottom of MWE to verify that TikZ colors work. Also, font colors work elsewhere (not shown) outside mdframed.

Why is this happening, and what can I do about it?

\documentclass[letterpaper,10pt,onecolumn,twoside]{article}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage[tikz]{mdframed}
%\usepackage{mdframed}
\usepackage{lipsum}

\tikzset{
  main node/.style={rectangle,draw=red,thick,fill=yellow,
                    rounded corners,font=\color{red}\sffamily},
}

\begin{document}

\lipsum[1]
\begin{mdframed}[linecolor=red,roundcorner=3pt,backgroundcolor=yellow!60,
                 font={\sffamily},fontcolor=red]
\lipsum[2]
\end{mdframed}
\lipsum[3]

\bigskip\noindent
\begin{tikzpicture}
\node[main node]{Red on yellow\strut};
\end{tikzpicture}

\end{document}

''\listfiles'' output, working as expected

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
    tikz.sty    2010/10/13 v2.10 (rcs-revision 1.76)
     pgf.sty    2008/01/15 v2.10 (rcs-revision 1.12)
  pgfrcs.sty    2010/10/25 v2.10 (rcs-revision 1.24)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v2.10 (rcs-revision 1.7)
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
   xetex.def    2013/04/29 v0.96 LaTeX color/graphics driver for XeTeX (RRM/JK)

  pgfsys.sty    2010/06/30 v2.10 (rcs-revision 1.37)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2008/07/18  (rcs-revision 1.7)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v2.10 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v2.10 (rcs-revision 1.1)
  pgffor.sty    2010/03/23 v2.10 (rcs-revision 1.18)
 pgfkeys.sty
 pgfkeys.code.tex
  pgffor.code.tex
    tikz.code.tex
mdframed.sty    2013/07/01 1.9b: mdframed
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  xparse.sty    2013/07/28 v4582 L3 Experimental document command parser
   expl3.sty    2013/07/28 v4582 L3 Experimental code bundle wrapper
 l3names.sty    2012/12/07 v4346 L3 Namespace for primitives
l3bootstrap.sty    2013/07/28 v4581 L3 Experimental bootstrap code
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
l3basics.sty    2013/07/28 v4581 L3 Basic definitions
 l3expan.sty    2013/07/24 v4565 L3 Argument expansion
    l3tl.sty    2013/07/28 v4581 L3 Token lists
   l3seq.sty    2013/07/28 v4581 L3 Sequences and stacks
   l3int.sty    2013/07/28 v4581 L3 Integers
 l3quark.sty    2013/07/21 v4564 L3 Quarks
   l3prg.sty    2013/07/28 v4581 L3 Control structures
 l3clist.sty    2013/07/28 v4581 L3 Comma separated lists
 l3token.sty    2013/07/28 v4581 L3 Experimental token manipulation
  l3prop.sty    2013/07/28 v4581 L3 Property lists
   l3msg.sty    2013/07/28 v4581 L3 Messages
  l3file.sty    2013/07/28 v4581 L3 File and I/O operations
  l3skip.sty    2013/07/28 v4581 L3 Dimensions and skips
  l3keys.sty    2013/07/28 v4581 L3 Experimental key-value interfaces
    l3fp.sty    2013/07/09 v4521 L3 Floating points
   l3box.sty    2013/07/28 v4581 L3 Experimental boxes
l3coffins.sty    2012/09/09 v4212 L3 Coffin code layer
 l3color.sty    2012/08/29 v4156 L3 Experimental color support
l3luatex.sty    2013/07/28 v4581 L3 Experimental LuaTeX-specific functions
l3candidates.sty    2013/07/24 v4576 L3 Experimental additions to l3kernel
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
zref-abspage.sty    2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty    2012/04/04 v2.24 Module base for zref (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
needspace.sty    2010/09/12 v1.3d reserve vertical space
md-frame-1.mdf    2013/07/01\ 1.9b: md-frame-1
  lipsum.sty    2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
 ***********

\listfiles output, not working as expected

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
    tikz.sty    2013/12/13 v3.0.0 (rcs-revision 1.142)
     pgf.sty    2013/12/18 v3.0.0 (rcs-revision 1.14)
  pgfrcs.sty    2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty    2014/04/25 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/05/08 v1.15 key=value parser (DPC)
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
   xetex.def    2014/04/28 v4.01 LaTeX color/graphics driver for XeTeX (RRM/JK)

  pgfsys.sty    2013/11/30 v3.0.0 (rcs-revision 1.47)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.0 (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.0 (rcs-revision 1.25)
 pgfkeys.sty
 pgfkeys.code.tex
 pgfmath.sty
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
mdframed.sty    2013/07/01 1.9b: mdframed
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  xparse.sty    2014/05/05 v4740 L3 Experimental document command parser
   expl3.sty    2014/05/20 v4814 L3 programming layer (loader)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
expl3-code.tex    2014/05/20 v4814 L3 programming layer
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
zref-abspage.sty    2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty    2012/04/04 v2.24 Module base for zref (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
needspace.sty    2010/09/12 v1.3d reserve vertical space
md-frame-1.mdf    2013/07/01\ 1.9b: md-frame-1
  lipsum.sty    2011/04/14 v1.2 150 paragraphs of Lorem Ipsum dummy text
 ***********

\listfiles output, updated on Linux server, not expected output

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
    tikz.sty    2013/12/13 v3.0.0 (rcs-revision 1.142)
     pgf.sty    2013/12/18 v3.0.0 (rcs-revision 1.14)
  pgfrcs.sty    2013/12/20 v3.0.0 (rcs-revision 1.28)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
  pgfrcs.code.tex
 pgfcore.sty    2010/04/11 v3.0.0 (rcs-revision 1.7)
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2010/04/23 v1.9 graphics configuration of TeX Live
   xetex.def    2015/03/25 v4.04 LaTeX color/graphics driver for XeTeX (TeX Liv
e/RRM/JK)
  pgfsys.sty    2013/11/30 v3.0.0 (rcs-revision 1.47)
  pgfsys.code.tex
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
 pgfcore.code.tex
pgfcomp-version-0-65.sty    2007/07/03 v3.0.0 (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.0 (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.0 (rcs-revision 1.25)
 pgfkeys.sty
 pgfkeys.code.tex
 pgfmath.sty
 pgfmath.code.tex
  pgffor.code.tex
    tikz.code.tex
mdframed.sty    2013/07/01 1.9b: mdframed
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  xparse.sty    2015/06/15 v5630 L3 Experimental document command parser
   expl3.sty    2015/06/15 v5630 L3 programming layer (loader)
expl3-code.tex    2015/06/15 v5630 L3 programming layer
l3unicode-data.def    2015/03/01 v5544 L3 Unicode data
l3xdvipdfmx.def
etoolbox.sty    2015/05/04 v2.2 e-TeX tools for LaTeX (JAW)
zref-abspage.sty    2012/04/04 v2.24 Module abspage for zref (HO)
zref-base.sty    2012/04/04 v2.24 Module base for zref (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
needspace.sty    2010/09/12 v1.3d reserve vertical space
md-frame-1.mdf    2013/07/01\ 1.9b: md-frame-1
  lipsum.sty    2014/07/27 v1.3 150 paragraphs of Lorem Ipsum dummy text
 ***********

Expected and wanted

Not expected and not wanted

Expected but not wanted

Best Answer

This appears to be a bug between mdframed and newer xelatex than I had had on my server. When I updated TeXLive on my server I got an updated xelatex than I'd previously had and got results consistent with the xelatex on my workstation. (Further research details shown above.)

From comments above, xelatex exhibits other problems I had not run into yet. I switched to lualatex and now get the expected results.

Related Question