-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
DOC: build of numpy-user.pdf reports Missing Chinese characters with font FreeSerif #22930
Comments
TBF, we have given up trying to support the PDF documentation. It is buggy, and we don't have the resources to deal with it. If you or someone else wants to work on it, go for it. |
@charris I am interested into any problem you might have with PDF documentation, to the extent they relate to core Sphinx. Yesterday the build of
I will have a quick look at it, despite (as I somewhat theatrically said) lacking familiarity with |
Documenting for future references the (few) other problems I see at this time. Working with numpy commit a28f4f2 tagged
I did a build of the HTML docs at my locale (which has perhaps a lacunary environment; also sphinx_design pinned Sphinx to It is strange that the produced TeX file contains indeed the mark-up for such an extra one-row table Could it have to do with some EDIT: I do see a
line in Only other problems I see: Multiply defined references reported during build of
Undefined references for
EDIT: after installing
for some reason (don't know why the page count decreased...). Also there are now
type warnings. Build of I do not see any other obvious problem to be identified from the LaTeX logs. |
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 9546db5f2..42a943661 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -248,11 +248,30 @@ def setup(app):
#latex_use_parts = False
latex_elements = {
- 'fontenc': r'\usepackage[LGR,T1]{fontenc}'
+# Sphinx documentation says
+# Do not use this key for a latex_engine other than 'pdflatex'.
+# So commenting out this setting (FreeSerif which is currently
+# the default font used by Sphinx with xelatex has Greek support)
+# 'fontenc': r'\usepackage[LGR,T1]{fontenc}'
}
# Additional stuff for the LaTeX preamble.
latex_elements['preamble'] = r'''
+% Fix for some missing characters (arise in author names in Release Notes)
+% TeXLive provides Harano Aji Mincho font but unfortunately it is missing
+% the 业 (U+4E1A). So using SimSun which is among my system fonts.
+% Successfull build of numpy-user.pdf checked with numpy 1.24.1
+\newfontfamily\ChineseFont{SimSun}
+\catcode`琴\active\protected\def琴{{\ChineseFont\string琴}}
+\catcode`春\active\protected\def春{{\ChineseFont\string春}}
+\catcode`鈴\active\protected\def鈴{{\ChineseFont\string鈴}}
+\catcode`猫\active\protected\def猫{{\ChineseFont\string猫}}
+\catcode`傅\active\protected\def傅{{\ChineseFont\string傅}}
+\catcode`立\active\protected\def立{{\ChineseFont\string立}}
+\catcode`业\active\protected\def业{{\ChineseFont\string业}}
+\catcode`(\active\protected\def({{\ChineseFont\string(}}
+\catcode`)\active\protected\def){{\ChineseFont\string)}}
+
% In the parameters section, place a newline after the Parameters
% header
\usepackage{xcolor} fixes the reported problem. Unfortunately as indicated in commented part, my LaTeX installation has only one Chinese supporting font and it is lacking one of the ideograms. Perhaps I did not install a complete TeXLive. So I used a system font coming with my mac os and I have no idea if this will work on your build system. I also tried using For time being I will make only a PR for the |
All duplicate references complaints from the PDF build of doc/source/reference/maskedarray.generic.rst
doc/source/reference/routines.fft.rst:
doc/source/reference/routines.linalg.rst:
doc/source/reference/random/index.rst:
doc/source/reference/typing.rst:
(the complaints are only LaTeX warnings, ending up in the console output and log, which latexmk summarizes at the end, but it does not prevent latexmk from doing the needed number of runs) |
Indeed, I was testing on a partial TeXLive. On a complete TeXLive 2022 I found fonts supporting all characters:
The above is done with So one can adapt #22930 (comment) to use one of these fonts (each character can be picked on a chosen font, but as we have some font supporting all problematic characters and potentially further ones popping up in future, simpler to pick one). |
If you have fixes that should be added, go ahead and make a PR. |
Unfortunately, there is no mechanism provided by (Xe)LaTeX to automatically fall-back on some rescue font when the main document font does not support a character. But one can configure each problematic character to use a specific font, and the FandolSong font from TeXLive-based LaTeX distributions provides for all currently needed such problematic characters. An un-needed and even possibly detrimental usage of the latex_elements 'fontenc' key is removed in passing. Close: numpy#22930
Unfortunately, there is no mechanism provided by (Xe)LaTeX to automatically fall-back on some rescue font when the main document font does not support a character. But one can configure each problematic character to use a specific font, and the FandolSong font from TeXLive-based LaTeX distributions provides for all currently needed such problematic characters. Close: numpy#22930
Unfortunately, there is no mechanism provided by (Xe)LaTeX to automatically fall-back on some rescue font when the main document font does not support a character. But one can configure each problematic character to use a specific font, and the FandolSong font from TeXLive-based LaTeX distributions provides for all currently needed such problematic characters. Close: numpy#22930
Issue with current documentation:
I wanted to test the PDF build of documentation for 1.24, and the build ended with this report:
Then I checked log file where the page numbers are indicated (339 and 363 for my build but my virtual environment was lacking some stuff so warnings were reported about doxygen and scipy, perhaps I am missing pages in my build) and this actually maps to the Release notes for 1.23.3 and 1.21.4.
Indeed here is a screenshot for the 1.21.4 Release pages in the PDF for 1.23 release
By the way according to Google translate
傅立业
indicated missing in this screenshot (page 363 in my build of 1.24.1 documentation) meansFourier
...Idea or request for content:
Unfortunately I personally am very little familiar with
xelatex
but I think it should be possible to configure it to switch to another font for CJK ideograms, I can not help currently though, but surely others will.By the way, with recent LaTeX (since 2021) one can (via
\tracinglostchars3
in the preamble) let such missing characters cause a LaTeX build error... if one really really wishes this.Completely unrelated note: I wanted to test how the PDF looked with Sphinx development tip (future 6.1.0). It does look fine (code-blocks with rounded corners and background gray, tables with rows of alternating grayish colors). I had to install
sphinx_design
and then reinstall Sphinx assphinx_design
pins it to<6
.The text was updated successfully, but these errors were encountered: