Hi Pieter,

Le 28/09/2019 à 16:52, Pieter Claeys a écrit :
Another half a day later I now see that this was caused by a line that I
added to sphinxmanual.cls (named sphinxmanual_customqaweb.cls). I add an
extra image on the title page, with this line:
{\sphinxincludegraphics{celabel_1639.png}\par}
... which cases the polyglossia problem on xelatex ,   not on pdflatex.
I still don't understand why this breaks things ; it's almost identical as
the \sphinxlogo  method
     \begin{flushright}%
       \sphinxlogo
       \py@HeaderFamily
       {\Huge \@title \par}
       {\itshape\LARGE \py@release\releaseinfo \par}
       \vfill
       {\LARGE
         \begin{tabular}[t]{c}
           \@author
         \end{tabular}\kern-\tabcolsep
         \par}
       {\sphinxincludegraphics{celabel_1639.png}\par} %THIS LINE CAUSES
%POLYGLOSSIA ERROR (but not when placed just below \sphinxlogo...)
       \vfill\vfill
       {\large
        %\@date \par
        \vfill
        \py@authoraddress \par
       }%
     \end{flushright}%\par


Anyway, I worked around this problem using the latex_logo feature, which
can also put an image on the title page,I see now, as I discovered by
seeing the \sphinxlogo line.

Out of curiosity I would like to understand why the \sphinxincludegraphics
causes the problem - guess I'm too latex newbie for that. But that's just
nice to have.


I. You have a talent for finding core LaTeX bugs. (or perhaps here
a polyglossia bug).

The problem arises from a bad interaction with "draft" option
of \includegraphics LaTeX. Turns out the draft option triggers
some typesetting in monospace font in some box. By itself
this is ok, but \py@HeaderFamily does \sffamily\bfseries

Turns out that issueing \ttfamily after the \bfseries triggers
the problem. This explains why the location of \sphinxincludegraphics
matters.

I have raised a ticket

https://github.com/reutenauer/polyglossia/issues/306

but it may be a fontspec issue rather. I am not familiar
enough with polyglossia to tell.

II.

Only answering that bit. I think you have hit against some bug
of core LaTeX package babel in presence of hyperref.

(I may make a bug report after some more digging to make sure
I have well analyzed the problem).


See

https://github.com/latex3/babel/issues/30

III.

Indeed it works out of the box (at least on Linux) when latex_engine=xelatex. So I will switch to building everything (all languages) with xelatex (please warn me if that's a bad idea). I have some Chinese, Korean and Japanse translations on the longer term roadmap, so xelatex hopefully deals with that as well.


For Japanese, don't set latex_engine. Sphinx uses platex which is
a special latex engine especially for Japanese support. It will
do this automatically on language="ja".

For Chinese, I think xelatex + \usepackage{xeCJK} will work,
and you can see there

https://github.com/sphinx-doc/sphinx/pull/6398/files

that it is automatized now in Sphinx 2.1.0
Again, no need to set latex_engine, it is now automatically 'xelatex' for 
Chinese

For Korean, perhaps the Chinese setting will work? (CJK = Chinese, Japanese, 
Korean)
But you need to manually set latex_engine to 'xelatex'
and use the 'fontenc' key to add r'\usepackage{xeCJK}'

Best,

Jean-François

--
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/qmr9ir%2447ac%241%40blaine.gmane.org.

Reply via email to