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: do not allow splitting for :option: roles #9925
Comments
What is LaTeX engine, pdflatex or xelatex? Update: surely xelatex, as I reproduced it with it. With the default setting I can not reproduce: from
and default settings (in particular letter size paper). Could you post the actual LaTeX mark-up as seen in the {\hyperref[\detokenize{index:cmdoption-11}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} It appears that But, for xelatex, fonts behave differently. Try this in conf.py
The actual bug here may be that the linebreaks were not observed with sphinx/sphinx/texinputs/sphinxlatexstyletext.sty Lines 77 to 80 in edd1478
\texttt{} with pdflatex prevents them...
|
Memo: this issue also has to do with the
which was added at #6888 to the latex preamble when using Without it |
Yes, I use |
I can confirm this fixes the problem! You can build my project with:
|
Use these options: {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}} {\hyperref[\detokenize{demo:cmdoption-Wno-shift-overflow3}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{\sphinxhyphen{}Wno\sphinxhyphen{}shift\sphinxhyphen{}overflow3}}}}}. |
Ok thanks for confirmation this is exactly same mark-up as I observed at my locale (i was in the dark for a while was asking for more details). The root cause is the diverging behaviour of This appears as an after-effect of the fact it was configured to not apply TeX ligatures such as replacing I am not sure how to proceed now, because, although possibly not good for options, breaking at |
I see, makes sense. What about emitting something like |
|
Btw. I've just tried the
|
From quick look this is simply due to xelatex font being wider. In both cases some lines are overfull with TeX going into the margin because it does not know how to break things. Also it spreads white space in the line to try to fill it which explains the layout of non-overfull lines. Perhaps you can try to add this to
or some other factor. But this will not fix the fact that TeX which is conceived to typeset natural language has no a priori knowledge of breaking overlong lines. Or try to find another font, the default is doing
|
I mean overlong lines with symbols such as |
I think it is fine to prevent line-breaking in literals. A similar change was recently made for HTML (#9929), so that would be consistent. |
Thanks for tip, yes I will make PR. In retrospect line splitting was already prohibited in inline literals and parsed literals at dashes, with |
@marxin I guess having each |
.. |gol| raw:: latex
\\
Use these options: :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`\ |gol| :option:`-Wno-shift-overflow3`. |
Exactly, that's too much of the vertical spacing. |
Great, that works perfectly, I'm going to use it very likely (note one does not need the |
LaTeX: prohibit also with xelatex linebreaks at dashes in literal text (not code-blocks) (fixes #9925)
Thanks for the fix. One more question: how difficult would it be to add a new directive: ..optionlisting:
:option:`-fdiagnostics-plain-output`
:option:`-fdiagnostics-show-location`:samp:`=[once|every-line]`
:option:`-fdiagnostics-color`:samp:`=[auto|never|always]` That would emit |
please raise a new issue/feature request for discussion |
Sure, done in #9995. |
Describe the bug
For:
I don't want to allow splitting of the options:
How to Reproduce
Build the snippet
Expected behavior
No response
Your project
Build the snippet
Screenshots
No response
OS
Linux
Python version
3.8
Sphinx version
4.3.0
Sphinx extensions
No response
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: