2

Using tcolorbox with xelatex, the font color is changed to white after the box when the box is broken. Minimal exemple :

\documentclass{minimal}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage{lipsum}
\newtcolorbox{test}{breakable} 
\begin{document}
\begin{test}
    \lipsum
\end{test}
This is written in white.
\end{document}

With pdflatex the last line is shown, not with xelatex.

7
  • it is probably a side effect of the changes preserve colors in such boxes with pdflatex/lualatex, github.com/T-F-S/tcolorbox/issues/110. As a work around you can set \normalcolor\lipsum, and better make a bug report. Sep 28, 2020 at 16:27
  • I don't understand the OP problem. Here is my TeX output
    – user108724
    Sep 28, 2020 at 16:52
  • I think this bug was already solved in recent versions. I've tested with tcolorbox v4.31 and it works.
    – Ignasi
    Sep 28, 2020 at 17:02
  • @UlrikeFisher It's not the same problem : text is black in both boxes. It turns white after the last part of the box : it's "This is written in white." which is white.
    – ib86
    Sep 28, 2020 at 17:16
  • @Ignasi OK I checked with versions 4.32 and 4.40 and it's not working. With 4.31 it's ok, thanks !
    – ib86
    Sep 28, 2020 at 17:16

1 Answer 1

1

Unfortunately, xelatex does not support color stacks which are used since tcolorbox v4.32 for breakable boxes. The implementation changed at several places and introduced this new error for xelatex.

I tried some hacks I used before. It seems that it is enough to reset the current color with \color{.} at the end of all things.

The following works for me:

\documentclass{minimal}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}
\usepackage{lipsum}

\makeatletter
\def\tcb@finalize@environment{%
  \color{.}% hack for xelatex
  \tcb@layer@dec%
}
\makeatother

\newtcolorbox{test}{breakable,colupper=blue}
\begin{document}
\begin{test}
\lipsum
\end{test}
This is written (not any longer) in white.
\end{document}

You must log in to answer this question.

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