Skip to content

Links for French documentation PDF is broken: LaTeX issue with non-ASCII characters? #75770

Closed

Description

@fabrice
mannequin
BPO 31589
Nosy @vstinner, @benjaminp, @ned-deily, @ezio-melotti, @JulienPalard, @Linkid, @jfbu, @miss-islington
PRs
  • [WIP] bpo-31589: Build PDF using xelatex for better UTF8 support. #3940
  • bpo-31589: Add config for LaTeX handling of stray Unicode chars in PDF #4069
  • [3.6] bpo-31589 : Build PDF using xelatex for better UTF8 support. (GH-3940) #4683
  • [2.7] bpo-31589 : Build PDF using xelatex for better UTF8 support. (GH-3940) #16636
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-05-07.20:08:39.378>
    created_at = <Date 2017-09-26.08:59:09.198>
    labels = ['type-bug', 'docs']
    title = 'Links for French documentation PDF is broken: LaTeX issue with non-ASCII characters?'
    updated_at = <Date 2019-10-08.03:42:55.283>
    user = 'https://bugs.python.org/fabrice'

    bugs.python.org fields:

    activity = <Date 2019-10-08.03:42:55.283>
    actor = 'miss-islington'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2019-05-07.20:08:39.378>
    closer = 'mdk'
    components = ['Documentation']
    creation = <Date 2017-09-26.08:59:09.198>
    creator = 'fabrice'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31589
    keywords = ['patch']
    message_count = 25.0
    messages = ['303024', '303028', '303498', '303501', '303502', '303503', '303562', '303586', '303587', '303590', '303592', '304016', '304499', '304717', '307469', '307472', '307490', '307493', '307502', '307506', '307507', '307515', '341810', '341838', '354162']
    nosy_count = 10.0
    nosy_names = ['vstinner', 'benjamin.peterson', 'ned.deily', 'ezio.melotti', 'docs@python', 'mdk', 'linkid', 'fabrice', 'jfbu', 'miss-islington']
    pr_nums = ['3940', '4069', '4683', '16636']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31589'
    versions = ['Python 2.7']

    Activity

    1. added
      docs
      on Sep 26, 2017
    2. JulienPalard commented on Sep 26, 2017

      @JulienPalard
      Member

      Hi Fabrice,

      Thanks for reporting.

      The whole archives/ directory is completly missing for french and japanese, I'll take a look.

      Bug is probably really near https://github.com/python/docsbuild-scripts/blob/master/build_docs.py#L222

    3. JulienPalard commented on Oct 1, 2017

      @JulienPalard
      Member

      Problem happen during pdflatex, I tried a local build and got:

      ! Package hyperref Error: Wrong DVI mode driver option `dvipdfmx',
      (hyperref) because pdfTeX or LuaTeX is running in PDF mode.

      See the hyperref package documentation for explanation.
      Type H <return> for immediate help.
      ...

      l.4362 \ProcessKeyvalOptions{Hyp}

      ?
      ! Emergency stop.

    4. ezio-melotti commented on Oct 1, 2017

      @ezio-melotti
      Member

      FWIW most of the errors I met while trying to build the pdfs of the main docs were caused by the presence of non-latin1 characters. French should be limited to the latin1 range and the error you pasted doesn't seem to be related, however that might explain while the Japanese docs are also missing (unless this issue got fixed in the meanwhile -- I haven't built the pdfs in a while).

    5. added
      type-bug
      on Oct 1, 2017
    6. JulienPalard commented on Oct 1, 2017

      @JulienPalard
      Member

      After an upgrade of my venv, the error is now:

      Latexmk: applying rule 'pdflatex'...
      Rule 'pdflatex': File changes, etc:
      Changed files, or newly in use since previous run(s):
      'faq.aux'
      'faq.out'
      'faq.toc'
      Latexmk: Maximum runs of pdflatex reached without getting stable files
      Latexmk: All targets (faq.pdf) are up-to-date
      Latexmk: Did not finish processing file 'faq.tex':
      'pdflatex' needed too many passes

    7. JulienPalard commented on Oct 1, 2017

      @JulienPalard
      Member

      One difference I see in the logs of sucessfully building the faq.tex and failing to build it is:

      Package hyperref Warning: Token not allowed in a PDF string (Unicode):

      Looks like if I remove all non-ascii characters from titles, it builds again.

    8. JulienPalard commented on Oct 3, 2017

      @JulienPalard
      Member

      For the record, I can reproduce the issue with this minimal test file:

      mdk@windhowl$ ls -lah
      total 108K
      drwxr-xr-x 2 mdk mdk 4.0K Oct 2 21:15 .
      drwxrwxrwt 18 root root 96K Oct 2 21:15 ..
      -rw-r--r-- 1 mdk mdk 196 Oct 2 21:13 faq.tex

      mdk@windhowl$ cat faq.tex
      \documentclass[a4,10pt,french]{report}

      \usepackage[utf8x]{inputenc}
      \usepackage[T1,T2A]{fontenc}
      \usepackage{babel}

      \begin{document}
      \tableofcontents
      \chapter{FAQ sur Python éh}
      \end{document}

      mdk@windhowl$ latexmk faq 2>&1 | tail -n 15
      (/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-0.def) [2] (./faq.aux) )
      Output written on faq.dvi (2 pages, 608 bytes).
      Transcript written on faq.log.
      Latexmk: Log file says output to 'faq.dvi'
      Rule 'latex': File changes, etc:
      Changed files, or newly in use since previous run(s):
      'faq.aux'
      'faq.toc'
      Latexmk: Maximum runs of latex reached without getting stable files
      Latexmk: Did not finish processing file 'faq':
      'latex' needed too many passes
      Latexmk: Use the -f option to force complete processing,
      unless error was exceeding maximum runs of latex/pdflatex.
      Latexmk: applying rule 'latex'...
      Latexmk: All targets (faq.dvi) are up-to-date

      Also, according to matrixise, it works with xelatex.

    9. vstinner commented on Oct 3, 2017

      @vstinner
      Member

      Julien: Is there any reason why you want to use utf8x in specific?

      https://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc

      """
      utf8x vs. utf8 (inputenc)
      (...)
      The simple answer is that utf8x is to be avoided if possible. It loads the ucs package, which for a long time was unmaintained (although there is now a new maintainer) and breaks various other things.
      """

    10. changed the title [-]Links for French documentation pdf is broken[/-] [+]Links for French documentation PDF is broken: LaTeX issue with non-ASCII characters?[/+] on Oct 3, 2017
    11. JulienPalard commented on Oct 3, 2017

      @JulienPalard
      Member

      I personally do not care about using utf8x, it has been introduced in:

      r74549 | benjamin.peterson | 2009-08-24 12:42:36 -0500 (Mon, 24 Aug 2009) | 1 line
      fix pdf building by teaching latex the right encoding package

        # Get LaTeX to handle Unicode correctly
        latex_elements = {'inputenc': r'\usepackage[utf8x]{inputenc}'}

      I tried with utf8 instead and it yielded a different set of errors, so I did not tried much. But utf8-induced bugs may be easier to fix that utf8x-induced bugs, I don't know.

    12. vstinner commented on Oct 3, 2017

      @vstinner
      Member

      (Oh sorry, I misunderstand what you wrote. I understood that Python didn't use utf8x yet and you proposed to start using it.)

    13. 1 remaining item

    14. JulienPalard commented on Oct 17, 2017

      @JulienPalard
      Member

      Finally have a combination of latex engines that work for every cases, did a PR on docsbuild-scripts:

      python/docsbuild-scripts#34

      I already pulled xelatex on docs.iad1.psf.io via python/psf-salt@989a771#diff-6fb01fe8bbc22a54d234a57ad58e291e

      Also opened a few related issue sphinx-doc side to track my thoughts:

    15. jfbu commented on Oct 21, 2017

      jfbumannequin
      Mannequin

      I have made a PR at #4069 which enhances conf.py with some pdflatex extra Unicode configuration. I tested it with building PDF English documentation at master (at https://github.com/python/cpython/tree/db60a5bfa5d5f7a6f1538cc1fe76f0fda57b524e) and at 3.6 branch (at https://github.com/python/cpython/tree/1e78ed6825701029aa45a68f9e62dd3bb8d4e928) and also French documentation at 3.6 (at python/python-docs-fr@76b522b). The changes are only for pdflatex builds: if latex_engine is set to xelatex, lualatex, or platex (automatic if language is ja), nothing is modified.

    16. ned-deily commented on Dec 2, 2017

      @ned-deily
      Member

      New changeset 7324b5c by Ned Deily (Julien Palard) in branch 'master':
      bpo-31589 : Build PDF using xelatex for better UTF8 support. (bpo-3940)
      7324b5c

    17. ned-deily commented on Dec 2, 2017

      @ned-deily
      Member

      New changeset 2ad350a by Ned Deily (Miss Islington (bot)) in branch '3.6':
      [3.6] bpo-31589 : Build PDF using xelatex for better UTF8 support. (GH-3940) (bpo-4683)
      2ad350a

    18. JulienPalard commented on Dec 3, 2017

      @JulienPalard
      Member

      Due to bpo-32200, we switched on xelatex, it however did **not** fixed the french builds as expected, maybe because we're using an old version of xelatex.

      The issue:

      ! Improper discretionary list.
      <recently read> }
                  
      l.359 ...{PyObject} \PYG{o}{*}\PYG{n}{t}\PYG{p}{;}
                                                    
      ? 
      ! Emergency stop. 
      

      The version of texlive-xetex on the build server: 2013.20140215-1ubuntu0.1

      The version I tried: 2017.20171128-1

      I'm not having the 2013 version on Debian. I'm trying now with 2014.20141024-2+deb8u1, and I'm trying to understand the error message too.

    19. jfbu commented on Dec 3, 2017

      jfbumannequin
      Mannequin

      I can confirm the "Improper discretionary list" error from xetex build is a xetex bug which is present at XeTeX 0.99992 and absent at XeTeX 0.99996 and presumably all more recent releases.

      It was seen at sphinx-doc/sphinx#3546 and reported to XeTeX mailing list at http://tug.org/pipermail/xetex/2017-March/027056.html

    20. JulienPalard commented on Dec 3, 2017

      @JulienPalard
      Member

      XeTeX 0.99996 was released in march 2016, so it's not even in Ubuntu 16.04 Xenial Xerus. On docs.iad1.psf.io we're having Ubuntu 14.04 (an LTS ending around february 2019).

    21. jfbu commented on Dec 3, 2017

      jfbumannequin
      Mannequin

      On-going discussion at http://tug.org/pipermail/xetex/2017-December/027212.html has brought new element that polyglossia's French module is broken with xetex since TeXLive2016. We had only one problem, we now have two on our hands.

      Possibly Sphinx could be default use babel + French, not polyglossia + French, as the former is maintained but apparently less so the latter.

      I tested that TeXLive 2015 (fully updated) and test document showing the sphinx-doc/sphinx#3546 problem now compiles fine if using

      latex_elements = {
          'babel': r'\usepackage{babel}',
      }

      in conf.py file, to override polyglossia which is default for Sphinx with xelatex.

    22. JulienPalard commented on Dec 3, 2017

      @JulienPalard
      Member

      For me, french compile correctly with current state of cpython's conf.py and texlive-xetex 2017.20171128-1, if it helps.

      I tried (not enough) and fail to test locally with a texlive-xetex from 2013 (I should try with a VM maybe, Debian won't let me install packages from 2013 on my sid...).

    23. jfbu commented on Dec 3, 2017

      jfbumannequin
      Mannequin

      Related sphinx-doc/sphinx#4272

      It is stated there that using babel-french in place of polyglossia-french avoids the "Improper discretionary list" xetex problem starting with xetex 0.99992 (i.e. TeXLive 2015) whereas with polyglossia-french the earliest xetex version I could test with success is 0.99996 (TL2016). But starting with TL2016, polyglossia-french as the issue sphinx-doc/sphinx#4272

      With TeXLive 2014, using babel-french does not avoid the "Improper discretionary list" xetex problem. I don't know how this maps to Debian packaging. One needs xetex 0.99992 at minimum.

    24. JulienPalard commented on May 7, 2019

      @JulienPalard
      Member

      The download links are now working, EWDurbin upgraded the servers and it solved a few issues, also now when a build fail we do no longer erase the old PDF, so the links should always work.

      Thanks for reporting and don't hesistate to open a new issue if problem happen again (but maybe on the https://github.com/python/docsbuild-scripts/ issue tracker).

    25. vstinner commented on May 7, 2019

      @vstinner
      Member

      Thanks Julien for taking care of the documentation :-) It is good to have
      you aboard.

    26. miss-islington commented on Oct 8, 2019

      @miss-islington
      Contributor

      New changeset d9b3216 by Miss Islington (bot) in branch '2.7':
      bpo-31589 : Build PDF using xelatex for better UTF8 support. (GH-3940)
      d9b3216

    27. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      docstype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions