Skip to content

Conversation

@jfbu
Copy link
Contributor

@jfbu jfbu commented Nov 16, 2025

Close #14064.

jfbu added 4 commits November 16, 2025 11:51
This makes our best to let fancyvrb "obeytabs" feature work for Sphinx,
and will work if TABs are only at "top level", however there is core
deficiency of the "obeytabs" feature of fancyvrb that TABs in Verbatim
can not be inside a macro argument, as is mandatory for Sphinx with
commandchars=\\\{\} to render the Pygments highlighting mark-up macros.

So I am keeping this branch only for not wasting the time which was
devoted to exploratory work, but there is no way we can do this without
redefining ourselves entirely the way \FV@Tab (\FV@TrueTab) acts, if we
want to keep a LaTeX solution.

A much much easier way would be to actually have all TABs converted to
spaces, as is what happens with code-block contents, also in the case
of literalinclude so that we do not have to solve ourself a grave
upstream deficiency of fancyvrb.sty.
They can not attow come from code-blocks contents, having been replaced
with spaces prior to be recorded in the .tex file, but they can arise
from literalinclude directive.

However, only top-level TABs will obey tab stops.  So if the included
file is Python source code containing say:

    mystring = "foo<tab>bar"

then the TAB will end-up inside a Pygments LaTeX macro and will not try
to obey tab stop locations.  But it does work for TABs inside a pure
text file for which Pygments will have found nothing to highlight.
@jfbu
Copy link
Contributor Author

jfbu commented Nov 16, 2025

The test failures seem to be one more instance of something wrong related to parallel testing. Possibly related with #13996.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LaTeX: with literalinclude directives, TABs are converted in PDF into 8 spaces, independently of their location

1 participant