-
Notifications
You must be signed in to change notification settings - Fork 130
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
Fix #656: Sphinx 5.1.0 has modified some internal LaTeX macros #657
Conversation
Thanks a lot for this PR, it's very much appreciated, as always!
I think it's good to have that comment, it's very helpful for people like me, who don't really understand all that (La)TeX magic! I don't really mind if it's a Python or a LaTeX comment.
That's great!
Yes, I also checked it, everything looks fine.
TBH, I don't really understand the details, but I'm glad that you are fixing it, however you see fit!
I don't really understand any of this. I'm just ignoring it. If you happen to know an easy solution, please let me know!
But I guess the "multiple pdfs" are Maybe the converter settings could be changed to avoid this? Do you know what "with page group" means?
I don't know where this comes from, but I'll search for
Yes I've seen that before. It's annoying because it doesn't affect
Yeah, I've seen that, I have to look into it.
That's great! |
I did not as I don't practice graphics inclusions often enough... turns out this tex.sx question i.e. https://tex.stackexchange.com/questions/76273/multiple-pdfs-with-page-group-included-in-a-single-page-warning has by luck some quite informative answer. So whenever you include 2 pdfs in the same page you may encounter the problem, depending how the pdf's were produced... one gets indeed the warning from using
test file (refereed to as I tested that adding
does let the warning go away. It seems from some other answers at the tex.sx question that although PDFTeX does a bad job at emitting most of the time the warning for no real reason in some cases though the output has problems and warning is justified. I tested with luatex and there seems to be no warnings with my test file. I then made the mistake to test above file with xetex (
This already happens with the above test file reduced to trying to include either one of the two files so is another issue. Sorry for gory details, I hate this too, but only to be complete
However, then Anyway it looks as if something is fishy with file And a Sorry for long, I hate this too when it turns out this way (and I will not try to report this "upstream"). As has been recently aptly commented by some passer-by:
|
The "Font warnings" are another can of worms. I only looked briefly (well not so briefly sadly and worst is that I did not complete fully investigation) at
As far as I can tell for now this is triggered by
At thsi stage my guess is that And some other things such as
These things can usually be ignored if some correct glyph ends up in PDF, although sometimes it needlessly enlarge PDF size from loading a substitute font. (all of the above with "font" meaning one of those famous TeX fonts with only room for 128 or 256 glyphs each.) |
Apart from the LaTeX font headaches, I checked the source and it seems this originates in that part of
where there is seemingly a missing backtick avec
I was told an easy solution already more than a year ago at latex3/latex2e#478 but I had forgotten about it (and opened earlier today a new isse latex3/latex2e#905 at their project, but it is almost a duplicate). Thus: The LaTeX warnings related to
It may be worthwile to add
to preamble. This causes a LaTeX build error in case a font is missing a character glyph... (since TeXLive 2021 release), and is mostly very useful in the context of Unicode engines (xetex, luatex) and OpenType fonts. |
Yes the colon is part of the reference but there is no target with this name. This originates in
from
so it should be either one of them I guess. Assuming "current page" in this context is web page for HTML output and in the LaTeX output it should go to start of included notebook? (not sure). This looks more like some upstream issue ( A LaTeX-hacker approach would be to modify |
Thanks a lot for the fix and for your detailed analysis. I've created separate issues from your comments above. |
Fix #656
I hesitated between leaving comments inside the LATEX_PREAMBLE or rather move them out as Python comments. In the end I dif leave a latex comment about
\nbsphinxincludegraphics
but it should probably be removed.This commit ensures compatibility with Sphinx 5.1.0 which has changed some internal macros related to rendering of code-boxes. The legacy code is left exactly identical when it is detected Sphinx is
< 5.1.0
. The new code opens up possibility to use some of the 5.1.0 added extensions regarding separate customizability of border widths and paddings.I tested it by compiling the nbsphinx.pdf with Sphinx at least at sphinx-doc/sphinx@cdde699 which adds to Sphinx 5.1.0 a fix related to code-blocks but unrelated to current nbsphinx (which does not use
verbatimwithframe=false
). The pdf output looks ok.About this:
It proved elusive for this task to not use any internal Sphinx LaTeX macro (i.e. with
@
in its name), if we want to benefit from the styling and properties of Sphinx Verbatim in a custom way (in particular without actually using sphinxVerbatim environement itself for this type of cell).Additional notes not related to this PR, for archival.
side notes:There were some numerous slightly annoying LaTeX iterated warnings, urelated to this PR:
They all seem to follow some earlier warning:
I am using latest TeXLive 2022.
Other latex warnings:
and
As I use Python 3.10.4 I received this Python warning:
Edit:
I forgot to mention that the PDF output contains some stderr cell at bottom of page 35:
which I mention in passing.
It also illustrates the Sphinx 5.1.0 added feature that in case a long code line wraps,
it is able to accept a page break.
Formerly it would have stayed at bottom of first page as an unbreakable block.