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: framed coloured boxes in highlighted code (e.g. highlighted diffs using Pygments style 'manni') inherit thickness of code-block frame #10638

Closed
jfbu opened this issue Jul 4, 2022 · 1 comment

Comments

@jfbu
Copy link
Contributor

jfbu commented Jul 4, 2022

Describe the bug

Capture d’écran 2022-07-04 à 16 37 38

How to Reproduce

.. code-block:: diff

   diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
   index b67722c1b..33164755b 100644
   --- a/sphinx/texinputs/sphinx.sty
   +++ b/sphinx/texinputs/sphinx.sty
   @@ -6,7 +6,7 @@
    %
    
    \NeedsTeXFormat{LaTeX2e}[1995/12/01]
   -\ProvidesPackage{sphinx}[2022/06/30 v5.1.0 LaTeX package (Sphinx markup)]
   +\ProvidesPackage{sphinx}[2022/07/04 v5.1.0 LaTeX package (Sphinx markup)]
    
    % provides \ltx@ifundefined
    % (many packages load ltxcmds: graphicx does for pdftex and lualatex but

and this in conf.py:

latex_elements = {
    'sphinxsetup': 'verbatimborder=5pt',
}
pygments_style = 'manni'

Expected behavior

Diff lines get not ovewritten by border

Your project

See example

Screenshots

See above

OS

Mac

Python version

3.10.4

Sphinx version

5.0.0

Sphinx extensions

No response

Extra tools

No response

Additional context

Cause of this is that the Sphinx LaTeX sets the \fboxrule length to the configured frame width. But in rare cases, the Pygments highlighter may use \fcolorbox which uses \fboxrule current value. This is what happens here. More often Pygments style may use \colorbox which depends on \fboxsep which is also modified during duration of rendering a code-block. But in all cases, Pygments LaTeX styling sets \fboxsep to zero so there is no trouble there.

@jfbu jfbu added this to the 5.1.0 milestone Jul 4, 2022
@jfbu jfbu closed this as completed in d4c8e84 Jul 4, 2022
jfbu added a commit that referenced this issue Jul 5, 2022
@jfbu jfbu changed the title LaTeX: modifying code-blocks border widths may render highlighted diffs unreadable in certain styles LaTeX: framed coloured boxes in highlighted code (e.g. highlighted diffs using Pygments style 'manni') inherit thickness of code-block frame Jul 5, 2022
@jfbu jfbu reopened this Jul 8, 2022
@jfbu
Copy link
Contributor Author

jfbu commented Jul 8, 2022

I reopened (without testing first) because I thought, while I was reviewing the codebase, that if the code-block was inside a warning-type notice directive the problem could be there still, as the code sets \fboxrule but in fact no, this \fboxrule setting is not visible by the syntax highlighting (because it is done at a place the syntax highlighting has already been transformed into TeX boxes). So closing ...

@jfbu jfbu closed this as completed Jul 8, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 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