[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-30 Thread jfbu

Le 28/09/2019 à 16:52, Pieter Claeys a écrit :

That was already fine for me, I
just needed some Greek translation


Hi Pieter

I have submitted a PR to Sphinx

https://github.com/sphinx-doc/sphinx/pull/6711

With it, xelatex would have been used by default
(with an added fix see discussion at
https://github.com/reutenauer/polyglossia/issues/306)

This will be integrated hopefully into Sphinx 2.3.0
or 2.2.1 if there is such a release.

Don't set explicitely 'fontpkg', 'fontenc' or any
such key then, all is automatic from language = 'el'

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/qmska8%242ekd%241%40blaine.gmane.org.


[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-29 Thread jfbu

Hi Pieter

Le 30/09/2019 à 00:00, jfbu a écrit :

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.



arrgggh ... I now understand the problem.

The GNU-FreeFont for Bold Monospace does not support the Greek Script!

The non bold monospace does support it.

This is annoying limitation of GNU FreeMono

But this give me occasion to insist that xelatex by itself
does not solve problems if you don't have appropriate fonts...

One could have hoped however that polyglossia would not
raise a build crashing error but use some substitute.

Indeed the reported error in my github polyglossia ticket
arises in strange circumstances

This being said you can probably fix it (untested) this way

latex_elements = {
'fontpkg': r'''
\setmainfont{FreeSerif}[
  Extension  = .otf,
  UprightFont= *,
  ItalicFont = *Italic,
  BoldFont   = *Bold,
  BoldItalicFont = *BoldItalic
]
\setsansfont{FreeSans}[
  Extension  = .otf,
  UprightFont= *,
  ItalicFont = *Oblique,
  BoldFont   = *Bold,
  BoldItalicFont = *BoldOblique,
]
\setmonofont{FreeMono}[
  Extension  = .otf,
  UprightFont= *,
  ItalicFont = *,
  BoldFont   = *,
  BoldItalicFont = *,
]
''',
}

(and of course latex_engine = 'xelatex')

What this does is modify the monospace font to
use the normal variant even for Bold and Italic
because only the upright variant supports the Greek script.

(but my mwe at https://github.com/reutenauer/polyglossia/issues/306
throws an error only on second usage of \ttfamily,
and output looked fine and seemingly did use bold FreeMono
even for Greek --- this is all Greek to me! )


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/qmrb5l%247jjq%241%40blaine.gmane.org.


[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-29 Thread jfbu

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.


[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-29 Thread jfbu

Le 28/09/2019 à 16:52, Pieter Claeys a écrit :

*About pdflatex with greek*
I then then got quite a bit further, only  remaining problem was that
pdflatex erorred on the copyright © and trademark ™ characters. Deleting
those built the document, and indeed, as you mentioned, every roman
character was converted to Greek alphabet. That was already fine for me, I
just needed some Greek translation:-)


Hi Pieter,

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).

To fix that I added this to my conf.py

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
'papersize': 'a4paper',

'fontenc': r'\usepackage[LGR,T1]{fontenc}',

'preamble': r'''
\AtBeginDocument{\renewcommand\ensureascii[1]{{\fontencoding{T1}\selectfont#1}}}
'''
}


where the fix is the 'preamble' key

(by the way I suppressed X2 from fontenc options, because this is for cyrillic 
support)

The bug is that babel package (which provides \ensureascii) uses PU encoding
which is some device of package hyperref for bookmarks.

I believe this is a bug of babel. (perhaps a known issue)

This being said, Greek language is **not** supported by Sphinx + pdflatex
(I should have stated that clearer earlier but I was not sure
myself, nothing existed in Sphinx documentation, even before
I started botchering it ;-) )
mainly for the reasons I stated which is that the set-up is
fine
only for a document using exclusively the Greek script and
nothing Ascii/Latin.

Thus I am **very** glad that Sphinx + xelatex does work for you...

Last remark: the \ensureascii things is for LaTeX babel package
version 3.9i or later, babel is one of those packages which do
not bother communicating to user a complete change log
matching version numbers and release dates and the relatively
new github repo has no tags. But with some digging in babel.dtx
I found
% \changes{babel~3.9i}{2014/02/14}{Macro added, to replace
%\cs{textlatin} and friends}
thus I
guess this means you need TeXLive 2014 at least.
(Sphinx currently officially requires TeXLive 2015 at least
or Distro packaging of the same like Debian thus we are
safe supposedly).

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/qmqaku%244sf2%241%40blaine.gmane.org.


[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-28 Thread Pieter Claeys

>
>
> Hi Jean-François,
many thanks for your support sharing this information. I never imagined 
having to dive so deep into this; all I wanted was a Greek translation ;-) 

Goo news: So, I have almost nailed it!

*About Windows vs Linux*
When indeed I tried the same small project (with *pdflatex *engine, 
language=el, and #'fontenc': r'\usepackage[LGR,X2,T1]{fontenc}' on a fresh 
Ubuntu, it works. Just had to do some trial-and-error with installing 
different texlive packages, then it works. Lesson learned: Don't use 
Windows / MikTex...

*About pdflatex with greek*
I then then got quite a bit further, only  remaining problem was that 
pdflatex erorred on the copyright © and trademark ™ characters. Deleting 
those built the document, and indeed, as you mentioned, every roman 
character was converted to Greek alphabet. That was already fine for me, I 
just needed some Greek translation :-)

*A venture into xelatex*
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.

Note: Actually I tried xelatex before, but got stuck on an error:
Package polyglossia Error: The current roman font does not contain the Greek 
(polyglossia) Please define \greekfont with \newfontfamily. \sphinxmaketitle

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.

-- 
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/6d512680-3250-473f-b2ad-110dc1ec5b05%40googlegroups.com.


[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-26 Thread jfbu

Le 27/09/2019 à 00:24, jfbu a écrit :

Le 26/09/2019 à 21:25, Pieter Claeys a écrit :

OK, right, I've trimmed it down even further.
I don't have perl installed so 'make latexpdf' isn't an option at the
moment; I do two-step  'make latex' and then 'pdflatex .tex'

I've got the most basic setup now - see attached files
- an index.rst
- a conf.py
- a python requirements.txt

For me, pdflatex stops with the error at \sphinxmaketitle
Would be interesting to know if that builds on your machine...



Hi, thanks for small project.

I don't seem to have issues with it at my locale:

greektest$ make latex
Sphinx v2.2.0 en cours d'exécution
Chargement des traductions [el]...fait
création du répertoire de sortie... fait
construction en cours [mo]:targets for 0 po files that are out of date
construction en cours[latex]: all documents
updating environment: [nouvelle configuration] 1 added, 0 changed, 0 removed
lecture des sources...[100%] index
recherche des fichiers périmésaucun résultat
pickling environment... fait
checking consistency... fait
processing greektest.tex... index
résolution des références...
fait
writing... fait
copying TeX support files... copie des fichiers de support Tex...
fait
compilation réussi.

Les fichiers LaTex se trouvent dans _build/latex.
Run 'make' in that directory to run these through (pdf)latex
(use `make latexpdf' here to do that automatically).


(the above uses French language for user interaction ; unfortunately
quite a few strings were badly translated by some contributor some
months ago -- see for example "compilation réussi" -- I have fixed
dozens of strings at transifex but this will have to wait next major release
for incorporation)

Then

greektest$ cd _build/latex/
latex$ pdflatex greektest
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded 
format=pdflatex)
[ lots of console output ...]
Package rerunfilecheck Warning: File `greektest.out' has changed.
(rerunfilecheck)    Rerun to get outlines right
(rerunfilecheck)    or use package `bookmark'.


LaTeX Font Warning: Some font shapes were not available, defaults substituted.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

  )

Output written on greektest.pdf (5 pages, 85188 bytes).
Transcript written on greektest.log.


Thus no error (but an invitation to execute pdflatex again)

Your error with \sphinxmaketitle can come from a custom latex_documents docclass
see https://github.com/sphinx-doc/sphinx/pull/6683

Note: running pdflatex once is definitly not enough:
as LaTeX reports you need at least one additional runs.

A make.bat is provided that you will find in the latex build repertory

As you are on Windows it uses old Sphinx approach hence does *not* use
latexmk hence does not require Perl

I don't know the Windows syntax but on Linux it would be make all-pdf
in the LaTeX build repertory to get the PDF correctly done

I tried the same with TeXLive 2018 and it compiles the same.

I tried also with Sphinx 2.1.2 with same result.

I would need

1. greektest.tex

2. greektest.log after the failed pdflatex run

Ideally if you add manually the line to greektest.tex

\tracingmacros1

immediately after the line

\begin{document}

and execute

pdflatex --halt-on-error greektest.tex

the greektest.log file will contain important information to debug the problem.

Make sure you remove the latex build repertory first and do a clean make latex 
at root of project.



Some additional remarks :


1. Sphinx does not support truly multilingual documents for latex output.

2. If you pass "el" as language which will translate as "greek" LaTeX
documentclass option, the ENTIRE document MUST be GREEK.
Any Latin string such as "" will look like "" in PDF.
This is caused by the fact that babel with "greek" will make LGR
the main font encoding. There is NO WAY with pdflatex to get ascii "a"
to automatically trigger back T1 font encoding. LaTeX was conceived
as requiring user extra manual markup like \fontencoding{T1}\selectfont

And one sees "γρεεκτεστ" in PDF output which originates in "greektest"
for the project title.

(this is despite your \usepackage[LGR,T1]{fontenc}. The "greek" option
will make LGR main encoding anyhow)

3. This problem disappears if the LaTeX document uses "english" as option.
Then Sphinx latex writer has a mechanism to handle with the help of
subsitutefont package Greek letters. If Greek letters are 90% of document
it will still mostly work.

All of the above is with traditional pdflatex.


I suggest you try rather

latex_engine = "xelatex"

and then do NOT customize "fontenc" key at all.

Recent Sphinx uses then GNU FreeFont which supports Greek script.

It works well at my locale : Latin words show up as Latin in PDF output,
and Greek is rendered correctly including Table of contents etc...

In fact I don't think there is really Sphinx support for PDF
(via make latex and then pdflatex)
together with Greek as main document lang

[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-26 Thread jfbu

Le 26/09/2019 à 21:25, Pieter Claeys a écrit :

OK, right, I've trimmed it down even further.
I don't have perl installed so 'make latexpdf' isn't an option at the
moment; I do two-step  'make latex' and then 'pdflatex .tex'

I've got the most basic setup now - see attached files
- an index.rst
- a conf.py
- a python requirements.txt

For me, pdflatex stops with the error at \sphinxmaketitle
Would be interesting to know if that builds on your machine...



Hi, thanks for small project.

I don't seem to have issues with it at my locale:

greektest$ make latex
Sphinx v2.2.0 en cours d'exécution
Chargement des traductions [el]...fait
création du répertoire de sortie... fait
construction en cours [mo]:targets for 0 po files that are out of date
construction en cours[latex]: all documents
updating environment: [nouvelle configuration] 1 added, 0 changed, 0 removed
lecture des sources...[100%] index
recherche des fichiers périmésaucun résultat
pickling environment... fait
checking consistency... fait
processing greektest.tex... index
résolution des références...
fait
writing... fait
copying TeX support files... copie des fichiers de support Tex...
fait
compilation réussi.

Les fichiers LaTex se trouvent dans _build/latex.
Run 'make' in that directory to run these through (pdf)latex
(use `make latexpdf' here to do that automatically).


(the above uses French language for user interaction ; unfortunately
quite a few strings were badly translated by some contributor some
months ago -- see for example "compilation réussi" -- I have fixed
dozens of strings at transifex but this will have to wait next major release
for incorporation)

Then

greektest$ cd _build/latex/
latex$ pdflatex greektest
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded 
format=pdflatex)
[ lots of console output ...]
Package rerunfilecheck Warning: File `greektest.out' has changed.
(rerunfilecheck)Rerun to get outlines right
(rerunfilecheck)or use package `bookmark'.


LaTeX Font Warning: Some font shapes were not available, defaults substituted.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

 )

Output written on greektest.pdf (5 pages, 85188 bytes).
Transcript written on greektest.log.


Thus no error (but an invitation to execute pdflatex again)

Your error with \sphinxmaketitle can come from a custom latex_documents docclass
see https://github.com/sphinx-doc/sphinx/pull/6683

Note: running pdflatex once is definitly not enough:
as LaTeX reports you need at least one additional runs.

A make.bat is provided that you will find in the latex build repertory

As you are on Windows it uses old Sphinx approach hence does *not* use
latexmk hence does not require Perl

I don't know the Windows syntax but on Linux it would be make all-pdf
in the LaTeX build repertory to get the PDF correctly done

I tried the same with TeXLive 2018 and it compiles the same.

I tried also with Sphinx 2.1.2 with same result.

I would need

1. greektest.tex

2. greektest.log after the failed pdflatex run

Ideally if you add manually the line to greektest.tex

\tracingmacros1

immediately after the line

\begin{document}

and execute

pdflatex --halt-on-error greektest.tex

the greektest.log file will contain important information to debug the problem.

Make sure you remove the latex build repertory first and do a clean make latex 
at root of project.

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/qmjdq3%242gru%241%40blaine.gmane.org.


Re: [sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-26 Thread Pieter Claeys
OK, right, I've trimmed it down even further.
I don't have perl installed so 'make latexpdf' isn't an option at the 
moment; I do two-step  'make latex' and then 'pdflatex .tex'

I've got the most basic setup now - see attached files
- an index.rst
- a conf.py
- a python requirements.txt

For me, pdflatex stops with the error at \sphinxmaketitle
Would be interesting to know if that builds on your machine... 


-- 
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/84504797-7dd3-4798-9e13-c192c443dfec%40googlegroups.com.


index.rst
Description: Binary data
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -

project = 'greektest'
copyright = '2019, PieterC'
author = 'PieterC'

# The full version, including alpha/beta/rc tags
release = '2.2'


# -- General configuration ---

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'venv']

# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "el"

# PieterC make UUID strings for gettext
gettext_uuid = True

locale_dirs = ["./locales"]

# -- Options for HTML output -

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
'papersize': 'a4paper',

'fontenc': r'\usepackage[LGR,X2,T1]{fontenc}',
}Sphinx==2.2.0
sphinx-intl==2.0.0
sphinx-rtd-theme==0.4.3


Re: [sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-26 Thread Pieter Claeys
Thanks for reply already.
- My customclass wasn't the problem (it was just a copy of the spinxmanual
class with a slightly modified title. Now it crashes on \sphinxtmakeitle .
Which would maybe indicate that other 'built-in' strings cause the issue as
well.
- Using sphinx 2.1.2
- Building on Windows using MikTeX 2.9 (pdf latex version: *This is pdfTeX,
Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7000 64-bit*)
- the rst file is english; using sphinx-intl that fetches greek locale to
build

I'll try to isolate the problem a bit more in a separate project.

On Thu, Sep 26, 2019 at 6:12 PM jfbu  wrote:

> Hi
>
> Le 26/09/2019 à 17:16, Pieter Claeys a écrit :
> > Hi,
> > I'm stuck on trying to generate a PDF of a greek translation (language
> code 'el')
> >
> > What I'm doing:
> > - "make latex"  -> produce .tex  file
> > - then, open with TexWorks and create pdf (or use pdflate command-line)
> >
> > That doesn't work, and based on reading the documentation, I added to
> latex_elements in conf.py
> >
> > latex_elements = {
> > 'fontenc': r'\usepackage[LGR]{fontenc}',
> > 'textgreek': r'\usepackage{textalpha,alphabeta}',
> >
> >
> > But still I'm stuck at
> >
> > |
> > Packageinputenc Error:Unicodecharacter Α(U+0391)
> > (inputenc)notsetup forusewithLaTeX.
> >
> > Seethe inputenc packagedocumentation forexplanation.
> > TypeH forimmediate help.
> >  ...
> >
> > l.98...Απαιτήσειςσυστήματος}
> > |
> >
> > Which is caused by the line 98 in the .tex file:
> > |
> > \chapter{Απαιτήσειςσυστήματος}
> > |
> >
> > *
> > *
> > Anyone with experience with this?
> >
> >
> > The top of my .tex file is:
> > |
> >
> > %%GeneratedbySphinx.
> >
> > \def\sphinxdocclass{report}
> >
> > \documentclass[a4paper,10pt,greek]{sphinxmanual_customqaweb}
> >
> > \ifdefined\pdfpxdimen
> >
> >   \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
> >
> > \fi\sphinxpxdimen=.75bp\relax
> >
> >
> > \PassOptionsToPackage{warn}{textcomp}
> >
> > \usepackage[utf8]{inputenc}
> >
> > \ifdefined\DeclareUnicodeCharacter
> >
> > %support both utf8 andutf8x syntaxes
> >
> >  \ifdefined\DeclareUnicodeCharacterAsOptional
> >
> >\def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}}
> >
> >  \else
> >
> >\let\sphinxDUC\DeclareUnicodeCharacter
> >
> >  \fi
> >
> >  \sphinxDUC{00A0}{\nobreakspace}
> >
> >  \sphinxDUC{2500}{\sphinxunichar{2500}}
> >
> >  \sphinxDUC{2502}{\sphinxunichar{2502}}
> >
> >  \sphinxDUC{2514}{\sphinxunichar{2514}}
> >
> >  \sphinxDUC{251C}{\sphinxunichar{251C}}
> >
> >  \sphinxDUC{2572}{\textbackslash}
> >
> > \fi
> >
> > \usepackage{cmap}
> >
> > \usepackage[LGR]{fontenc}
> >
> > \usepackage{amsmath,amssymb,amstext}
> >
> > \usepackage{babel}
> >
> > \usepackage{substitutefont}
> >
> >
> >
> > \usepackage{times}
> >
> > \expandafter\ifx\csname T@LGR\endcsname\relax
> >
> > \else
> >
> > %LGR was declared asfont encoding
> >
> >  \substitutefont{LGR}{\rmdefault}{cmr}
> >
> >  \substitutefont{LGR}{\sfdefault}{cmss}
> >
> >  \substitutefont{LGR}{\ttdefault}{cmtt}
> >
> > \fi
> >
> > \expandafter\ifx\csname T@X2\endcsname\relax
> >
> >  \expandafter\ifx\csname T@T2A\endcsname\relax
> >
> >  \else
> >
> >  %T2A was declared asfont encoding
> >
> >\substitutefont{T2A}{\rmdefault}{cmr}
> >
> >\substitutefont{T2A}{\sfdefault}{cmss}
> >
> >\substitutefont{T2A}{\ttdefault}{cmtt}
> >
> >  \fi
> >
> > \else
> >
> > %X2 was declared asfont encoding
> >
> >  \substitutefont{X2}{\rmdefault}{cmr}
> >
> >  \substitutefont{X2}{\sfdefault}{cmss}
> >
> >  \substitutefont{X2}{\ttdefault}{cmtt}
> >
> > \fi
> >
> >
> > \usepackage{textalpha,alphabeta}
> >
> > \usepackage[Sonny]{fncychap}
> >
> > \ChNameVar{\Large\normalfont\sffamily}
> >
> > \ChTitleVar{\Large\normalfont\sffamily}
> >
> > \usepackage{sphinx}
> >
> >
> > \fvset{fontsize=\small}
> >
> > \usepackage{geometry}
> >
> >
> > %Includehyperref last.
> >
> > \usepackage{hyperref}
> >
> > %Fixanchor placement forfigures withcaptions.
> >
> > \usepackage{hypcap}%it must be loaded after hyperref.
> >
> > %Setup styles of URL:it should be placed after hyperref.
> >
> > \urlstyle{same}
> >
> >
> > \usepackage{sphinxmessages}
> >
> > \setcounter{tocdepth}{1}
> >
> >
> >
> >
> > \title{QAWebEnterpriseUserGuide}
> >
> > \date{26de Σεπτεμβρίουde 2019}
> >
> > \release{}
> >
> > \author{Barco}
> >
> > \newcommand{\sphinxlogo}{\vbox{}}
> >
> > \renewcommand{\releasename}{}
> >
> > \makeindex
> >
> > \begin{document}
> >
> >
> > \ifdefined\shorthandoff
> >
> >  \ifnum\catcode`\=\string=\active\shorthandoff{=}\fi
> >
> >  \ifnum\catcode`\"=\active\shorthandoff{"}\fi
> >
> > \fi
> >
> >
> > \pagestyle{empty}
> >
> > \sphinxmaketitle
> >
> > \pagestyle{plain}
> >
> > \sphinxtableofcontents
> >
> > \pagestyle{normal}
> >
> > \phantomsection\label{\detokenize{index::doc}}
> >
> >
> >
> >
> > \chapter{Απαιτήσειςσυστήματος}
> >
> >
> \label{\detokenize{system-requirements:system-requirements}}\label{\detokenize{system-requirements:requirements-system}}\label{\detokenize{system-requirements::

[sphinx-users] Re: how to render PDF over latex of a greek translation (language 'el')

2019-09-26 Thread jfbu
Hi

Le 26/09/2019 à 17:16, Pieter Claeys a écrit :
> Hi,
> I'm stuck on trying to generate a PDF of a greek translation (language code 
> 'el')
> 
> What I'm doing:
> - "make latex"  -> produce .tex  file
> - then, open with TexWorks and create pdf (or use pdflate command-line)
> 
> That doesn't work, and based on reading the documentation, I added to 
> latex_elements in conf.py
> 
> latex_elements = {
> 'fontenc': r'\usepackage[LGR]{fontenc}',
> 'textgreek': r'\usepackage{textalpha,alphabeta}',
> 
> 
> But still I'm stuck at
> 
> |
> Packageinputenc Error:Unicodecharacter Α(U+0391)
> (inputenc)notsetup forusewithLaTeX.
> 
> Seethe inputenc packagedocumentation forexplanation.
> TypeH forimmediate help.
>  ...
>  
> l.98...Απαιτήσειςσυστήματος}
> |
> 
> Which is caused by the line 98 in the .tex file:
> |
> \chapter{Απαιτήσειςσυστήματος}
> |
> 
> *
> *
> Anyone with experience with this?
> 
> 
> The top of my .tex file is:
> |
> 
> %%GeneratedbySphinx.
> 
> \def\sphinxdocclass{report}
> 
> \documentclass[a4paper,10pt,greek]{sphinxmanual_customqaweb}
> 
> \ifdefined\pdfpxdimen
> 
>   \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
> 
> \fi\sphinxpxdimen=.75bp\relax
> 
> 
> \PassOptionsToPackage{warn}{textcomp}
> 
> \usepackage[utf8]{inputenc}
> 
> \ifdefined\DeclareUnicodeCharacter
> 
> %support both utf8 andutf8x syntaxes
> 
>  \ifdefined\DeclareUnicodeCharacterAsOptional
> 
>    \def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}}
> 
>  \else
> 
>    \let\sphinxDUC\DeclareUnicodeCharacter
> 
>  \fi
> 
>  \sphinxDUC{00A0}{\nobreakspace}
> 
>  \sphinxDUC{2500}{\sphinxunichar{2500}}
> 
>  \sphinxDUC{2502}{\sphinxunichar{2502}}
> 
>  \sphinxDUC{2514}{\sphinxunichar{2514}}
> 
>  \sphinxDUC{251C}{\sphinxunichar{251C}}
> 
>  \sphinxDUC{2572}{\textbackslash}
> 
> \fi
> 
> \usepackage{cmap}
> 
> \usepackage[LGR]{fontenc}
> 
> \usepackage{amsmath,amssymb,amstext}
> 
> \usepackage{babel}
> 
> \usepackage{substitutefont}
> 
> 
> 
> \usepackage{times}
> 
> \expandafter\ifx\csname T@LGR\endcsname\relax
> 
> \else
> 
> %LGR was declared asfont encoding
> 
>  \substitutefont{LGR}{\rmdefault}{cmr}
> 
>  \substitutefont{LGR}{\sfdefault}{cmss}
> 
>  \substitutefont{LGR}{\ttdefault}{cmtt}
> 
> \fi
> 
> \expandafter\ifx\csname T@X2\endcsname\relax
> 
>  \expandafter\ifx\csname T@T2A\endcsname\relax
> 
>  \else
> 
>  %T2A was declared asfont encoding
> 
>    \substitutefont{T2A}{\rmdefault}{cmr}
> 
>    \substitutefont{T2A}{\sfdefault}{cmss}
> 
>    \substitutefont{T2A}{\ttdefault}{cmtt}
> 
>  \fi
> 
> \else
> 
> %X2 was declared asfont encoding
> 
>  \substitutefont{X2}{\rmdefault}{cmr}
> 
>  \substitutefont{X2}{\sfdefault}{cmss}
> 
>  \substitutefont{X2}{\ttdefault}{cmtt}
> 
> \fi
> 
> 
> \usepackage{textalpha,alphabeta}
> 
> \usepackage[Sonny]{fncychap}
> 
> \ChNameVar{\Large\normalfont\sffamily}
> 
> \ChTitleVar{\Large\normalfont\sffamily}
> 
> \usepackage{sphinx}
> 
> 
> \fvset{fontsize=\small}
> 
> \usepackage{geometry}
> 
> 
> %Includehyperref last.
> 
> \usepackage{hyperref}
> 
> %Fixanchor placement forfigures withcaptions.
> 
> \usepackage{hypcap}%it must be loaded after hyperref.
> 
> %Setup styles of URL:it should be placed after hyperref.
> 
> \urlstyle{same}
> 
> 
> \usepackage{sphinxmessages}
> 
> \setcounter{tocdepth}{1}
> 
> 
> 
> 
> \title{QAWebEnterpriseUserGuide}
> 
> \date{26de Σεπτεμβρίουde 2019}
> 
> \release{}
> 
> \author{Barco}
> 
> \newcommand{\sphinxlogo}{\vbox{}}
> 
> \renewcommand{\releasename}{}
> 
> \makeindex
> 
> \begin{document}
> 
> 
> \ifdefined\shorthandoff
> 
>  \ifnum\catcode`\=\string=\active\shorthandoff{=}\fi
> 
>  \ifnum\catcode`\"=\active\shorthandoff{"}\fi
> 
> \fi
> 
> 
> \pagestyle{empty}
> 
> \sphinxmaketitle
> 
> \pagestyle{plain}
> 
> \sphinxtableofcontents
> 
> \pagestyle{normal}
> 
> \phantomsection\label{\detokenize{index::doc}}
> 
> 
> 
> 
> \chapter{Απαιτήσειςσυστήματος}
> 
> \label{\detokenize{system-requirements:system-requirements}}\label{\detokenize{system-requirements:requirements-system}}\label{\detokenize{system-requirements::doc}}
> 
> |
> 
> 
> 
> 


I tried a skeleton project containing only this index.rst

===
Welcome to FOO's documentation!
===

*
Απαιτήσεις συστήματος
*


and

language = 'el'
latex_elements = {
'fontenc': r'\usepackage[LGR]{fontenc}',
'textgreek': r'\usepackage{textalpha,alphabeta}',
}

and "make latexpdf" works for me and produces seemingly valid PDF.

Perhaps your LaTeX installation is old?
You seem to be using a custom class maybe this is related to the problem?


I am not familiar with typesetting Greek documents with LaTeX + 
\usepackage{babel}
and will check some docs later

>From testing directly with LaTeX it seems simply using "greek" as
documentclass option should be enough in combination with babel. The
non-existing times font in Greek encoding is automatically
substituted.

By the way, if one only specifies languag