-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Word wrap in codeblocks does not work if a long line is enclosed in quotations marks #5974
Comments
Could you try latest Sphinx release? On my local, it seems working fine. |
Thank you for your suggestion. I upgraded to Sphinx 1.8.3 tried the build and got the same result. |
Thanks for detailed report. At my locale if I create a file <div class="nachrichten infobox {if (count($meine_wiedervorlagen//ROW) > 0) then 'borderBottom' else ()}"> and then execute This is with testpygmentize$ pygmentize -V
Pygments version 2.2.0, (c) 2006-2017 by Georg Brandl. I thus realized my pygmentize was not updated in the virtualenv I use for Sphinx. I have now updated to 2.3.1. Console output looks now like this: but To debug this, it would be nice if you could make the small project containing only this code-block and zip the The LaTeX code you post is exactly as expected. |
Inside the LaTeX build repertory where the tex file is produced there should be a |
Yes that's it. If I dump my After sorting lines I can see the two files differ but I don't have time right now to investigate more. I am posting here the I am doing this with
You can fix temporarily your issue perhaps (I am not sure if your full document would need a bigger
with mine added to source of your project. |
I am SOOOO stupid! Of course you are using a custom Pygments style. According to here when the style specifies a background color for some elements the LaTeX formatter uses I tested all styles, and only three cause the problem on your MWE: I thus guess you have
in your |
Notice that can override that
(you will then get same syntax coloring as if no
The latter allows Personally on Unixen I do either To get available styles (apart from "sphinx" one)
|
Dear @jfbu, you are obviously not stupid. On the contrary, your solution is on point: We indeed used the Encore une fois, merci beaucoup, thank you once again. |
At 3.5.0 line wrapping in code-blocks even for tokens on a colored background will be possible (#8854). However this will need to be added to conf.py:
With the example of this ticket:
and also
(to reproduce the original problem), the following output is obtained: This is with Pygments version: 2.7.4 and 3.x branch of Sphinx (3.5.0 upcoming release). (edit actually the screen shot is fom a build with master branch which has not same font as 3.x branch for code-blocks, sorry for imprecision) In LaTeX, colored boxes are unbreakable, so the effect is achieved by treating each character individually. Hnce the hard-wrap as seen above. (also some PDF viewers might have problems with many successive small colored boxes and show artefact lines at joining) Generally speaking the hard-wrap (if activated via the Here it is first realized by the latex code that something very long has no break point (and this is aftereffect of being in a One may wish a less radical second stage regarding colored tokens, and that it could still do the linebreaks at spaces only. I will open a feature request :) |
Dear all,
we encountered a problem with one of our codeblocks where a quite long line is enclosed in simple quotations marks
"
: The line is flowing out of the codebox and off the page in the pdf output:The minimal example looks like this in the rst-source code:
Which turns into this LaTeX via
make latex
:and like this in the pdf output via
pdflatex SIPAMBestPracticesDoku.tex
:Removing the quotations marks
"
fixes the issue in the PDF but leaves us without syntax highlighting and a warning (index.rst:12: WARNING: Could not lex literal_block as "html". Highlighting skipped.
) atmake latex
:rst-source without quotation marks:
LaTeX without quotation marks:
PDF without quotation marks:
As suggested by @jfbu over in #3110 who could not reproduce my problem, I am opening this new issue.
Because @jfbu suspected a problem with Pygmentize I upgraded it from 2.2.0 to the latest 2.3.1 but this did not do the trick.
The used versions of all the software are:
I would be very happy to provide additional information and try out proposed solutions.
Thank you for your great work, cheers
Dennis
The text was updated successfully, but these errors were encountered: