Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX: user injected \color commands in topic or admonition boxes may cause color leaks in PDF due to upstream framed.sty bug #10633

Closed
jfbu opened this issue Jul 3, 2022 · 0 comments

Comments

@jfbu
Copy link
Contributor

jfbu commented Jul 3, 2022

Describe the bug

Boxes may leak colors from inside. Here is an example, with 5.x/5ffe1e87. It would have been even worse before merge of #10619 and also c327f09 (relates #10610).

How to Reproduce

Color leaks
===========

.. contents::

A section
---------

Paragraph should be black but isn't.

.. warning:: This is blue as requested.

   BUT FRAMING IS INVISIBLE!


Paragraph should be black. It is... by luck probably.

.. caution:: Beware LaTeX color leaks! (which may make things invisible).

   They are caused by an upstream framed.sty bug, but we know the cure.

Paragraph should be black.

and use this for conf.py

latex_elements = {
    'preamble': r"""
\def\sphinxstyletopictitle #1{\leavevmode\color{red}% color for contents
                                \textcolor{green}{\textbf{#1}}% colored title
                                \par\medskip}
\renewenvironment{sphinxwarning}[1]
  {\begin{sphinxheavybox}\sphinxstrong{#1} \color{blue}}{\end{sphinxheavybox}}
""",
}

Expected behavior

No color leaks...

Your project

See example

Screenshots

Capture d’écran 2022-07-03 à 14 26 57

OS

Mac

Python version

CPython 3.10.4

Sphinx version

5.x/5ffe1e879

Sphinx extensions

No response

Extra tools

No response

Additional context

This is caused by an upstream framed.sty bug which constructs a \vbox without needed extra group for compatibility with the way \color command internally works.

I will push a fix next.

@jfbu jfbu added this to the 5.1.0 milestone Jul 3, 2022
@jfbu jfbu closed this as completed in 2ac802f Jul 3, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant