Fail to build a Thai book using pdflatex when notebook/md has Thai characters as title or header. Need some help
See original GitHub issueI’m trying to build a pdf from the Jupyter notebook by doing…
- Create a test book using ‘$ jupyter-book create myb’
- Add some Thai characters into ‘_config.yml’ (title and author)
- Add some Thai characters into ‘intro.md’ (Header 1), ‘notebooks.ipynb’ (Header 1, Header 2, text-body), ‘markdown.md’ (Header 1, Header 2, text-body)
- Build the html using ‘$ jupyter-book build myb/’ <-- No problem. Show Thai language correctly.
- Create the pdf using ‘$ jupyter-book build myb/ --builder pdflatex’ <-- There is some problems in the book title, author, chapter title.
Expectation I expected the book to properly show the Thai characters as on the website (image below)
Problem Thai characters in the book title, author, chapter title (Header1 ,2 ,3 …) displays incorrectly (image below).
I’ve attached both the test book (the source files after modifications mentioned above) and the console output after trying to create the pdf.
Error: `Package pgfplots Warning: running in backwards compatibility mode (unsuitable t ick labels; missing features). Consider writing \pgfplotsset{compat=1.18} into your preamble. on input line 93.
geometry driver: auto-detecting geometry detected driver: xetex (./book.out) (./book.out) (/usr/local/texlive/2022/texmf-dist/tex/generic/stringenc/se-ascii-print.def) Missing character: There is no ไ (U+0E44) in font [FreeSansBold.otf]/OT:script= latn;language=dflt;! Missing character: There is no ท (U+0E17) in font [FreeSansBold.otf]/OT:script= latn;language=dflt;! Missing character: There is no ย (U+0E22) in font [FreeSansBold.otf]/OT:script= latn;language=dflt;!`
List my environment
Jupyter Book : 0.13.0 nbconvert : 6.5.0 Sphinx-external-toc : 0.2.4 MyST-Parser : 0.15.2 MyST-NB : 0.13.2 Sphinx Book Theme : 0.8.1 Jupyter-Cache : 0.4.3 NbClient : 0.5.13
Version of Python. : 3.8 OS : MacOS 12.3.1
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@AakashGfude It doesn’t work, probably because it was placed in the wrong place (I’ve never used latex before (-_-);;; )
From the comments that you and @mmcky sent to me, I have changed the preamble from
– to -->
It works well !!! as shown below.
Thank you both of you (@mmcky, @AakashGfude) for pointing me in the right direction.
@tubekmtil I had a quick search and came across
https://tex.stackexchange.com/questions/113359/latex-and-thai-language
which may contain some helpful hints for you.
My suggestion would be to edit:
_build/latex/book.tex
usingxelatex
to see if you can get theLaTeX
side of things working, thenlatex
preamble viasphinx
configuration in_config.yml
.https://jupyterbook.org/en/stable/advanced/sphinx.html#manual-sphinx-configuration
and the sphinx docs for a custom
preamble
https://www.sphinx-doc.org/en/master/latex.html
so it would look something like
and that get’s added to the preamble.
@AakashGfude any other tips / ideas here?