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: fix #8686 Text can fall out of code-block at end of page #10577
Conversation
modified: sphinx/texinputs/sphinxlatexliterals.sty
modified: sphinx/texinputs/sphinxlatexliterals.sty
…en wrapping This maintains existing behavior.
Ready for review. In case of line wrapping the code line number is printed only once as is currently case. So this fixes #8686 with no other change to output. From this project |
The squashed commit message was written via the GitHub interface and is not hard-wrapped :-( |
This does not fix entirely sphinx-doc#10610 but it does sufficiently for it not to require reverting sphinx-doc#10577 which tried to solve sphinx-doc#8686 conundrum. In extreme cases, the sphinx-doc#8686 problem meant that some contents disappearing at page bottom, so it is probably better that to maintain sphinx-doc#10577 which will avoid anysuch overflow of code beyond its frame, even though in some specific cases (a colored entity such as a long string is partly on both pages), some syntax highlighting gets lost. There are anyhow other issues with colors for wrapped code lines, even with no pagebreaks involved, such as sphinx-doc#10615. This patch does not change the situation there.
This does not fix entirely sphinx-doc#10610 but it does sufficiently for it not to require reverting sphinx-doc#10577 which tried to solve sphinx-doc#8686 conundrum. In extreme cases, the sphinx-doc#8686 problem meant that some contents disappeared at page bottom, so it is probably better to maintain sphinx-doc#10577 which will avoid any such overflow of code beyond its frame, even though in some specific cases (a colored entity such as a long string is partly on both pages), some syntax highlighting gets lost. There are anyhow other issues with colors for wrapped code lines, even with no pagebreaks involved, such as sphinx-doc#10615. This patch does not change the situation there.
due to limitations of LaTeX |
This is short but deep hack into
fancyvrb
package which is used for legacy reasons by Sphinx LaTeX. It fixes #8686 issue in a way compatible with emphasized lines and line numbers. However it currently has breaking change that the line number is repeated identically for each piece of a wrapped line, whereas until now it is indicated only once, at the first line coming out from wrapped one.edit: the breaking changed about code line numbers has been removed in a later commit. And WIP status was thus removed.
Keeping this as WIP for the moment as I need to do some more testing. And I am hesitating if the PR should be on master and not 5.x.At the LaTeX level, I have made some internal name and interface changes for reasons of coherence but I feel it is very unlikely anyone actually modified or used the internal macros, so I don't consider this a breaking change.
Example of output (from the mwe at #8686):
(this was before removal of repeated code line number)
On sees the number 2 is repeated all along.
I can add some extras to not repeat but this means some complications.(update: done)I think it is very unlikely fancyvrb (in view of its recent changes over the last years) will ever change the core stuff we hacked into, so it seems reasonably safe. Nevertheless it is deep hack and things work in a delicate equilibrium with fancvyvrb internal dealings.
Relates