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: prohibit also with xelatex linebreaks at dashes in literal text (not code-blocks) (fixes #9925) #9949
Conversation
tbh, not sure if this should go into 4.3.2 or future 4.x release |
I've just tried your branch with |
Can be seen here:
|
thanks for feedback, but I can't reproduce the problem I compiled your demo, it does use xelatex:
and I see no problem in pdf |
edit: this was before I saw your edit "git checkout sphinx-testing" trying out now... no, it does work for me. I do not see any suspicious linebreak at a dash. |
You are right! I forgot to run |
thanks for test file... |
I feel this is not a critical bug. So it's better to merge this into the 4.x branch |
Whether or not to allow linebreaks is matter of debate because user of pdf can not reflow the displayed text, and overfull lines may lead to loss of data beyond page border. Since Sphinx 1.5, inline literals allow linebreaks after the characters ".", ",", ";", "?", "!", "/" and "\" (cf the inlineliteralwraps key of latex_elements['sphinxsetup']). With pdflatex the dash "-" does not allow a linebreak when used with a monospace font (btw the dash is escaped to \sphinxhyphen{} which expands back to a dash). But this failed with xelatex, so previous commits ensured nobreak behaviour by redefining \sphinxhyphen to be \sphinxhyphennobreak when encountered in inline and parsed literals. This commit adds \sphinxhyphenin{inline,parsed}literal macros which default to \sphinxhyphennobreak and thus allow to customize how the dashes from sources will behave in such contexts in pdf output.
thanks @tk0miya I have rebased on 4.x and will merge after testing completes |
Fix #9925
The behaviour of xelatex diverged from the one of pdflatex: the latter prohibited linebreaks at dashes in literal text (not code-blocks) as after effect of monospace font. But not so with xelatex. Now it will be prohibited for both, even if not using monospace font for the literal text rendering.
Linebreaks at dashes encountered in regular text will still be happening (on purpose).
The PR also fixes some truly misleading comments in sphinxlatexstyletext.sty file