#71 latex2e: options to use ucs+utf8x for utf8 input encoding

Kirill Smelkov

As already described in docs/user/latex.txt#text-encoding, utf8x is
non-standard, but covers a lot more unicode than shipped with latex

I need this stuff for my russian docs, and also it was already on TODO
list, so let's implement it.

The way it is implemented is through two new latex2e specific options:




The first one says "use utf8x instead of utf8, if output encoding is
utf8", and the latter allows to specify ucs package options.

Docs updated, few tests written.
docutils/docs/dev/todo.txt | 18 -----------
docutils/docs/user/config.txt | 20 ++++++++++++
docutils/docs/user/latex.txt | 12 ++++++-
docutils/docutils/writers/latex2e/__init__.py | 25 ++++++++++++++-
docutils/test/test_writers/test_latex2e.py | 41 +++++++++++++++++++++++++
5 files changed, 95 insertions(+), 21 deletions(-)


  • Günter Milde
    Günter Milde

    We already have too many options. This is why I prefer:

    b) scan "stylesheets" and "latex-preamble" options and use ``utf8x``
    if it contains ``ucs``

    My initial objection to this way was that it prevented giving options
    to the ucs package (as "stylesheets" does not allow package options).

    However, since the introduction of the "latex-preamble" config
    setting, this is no longer an issue. (Also, options given to
    "documentoptions" are passed on to the packages.)

  • Kirill Smelkov
    Kirill Smelkov

    I've started implementing stylesheet/latex-preamble scanning, but I have to say I feel discomfort with the idea.
    So I'd like to discuss it first - not to waste time.

    First, currently stylesheets and latex-preable are included after $requirements. doing \usepackage{ucs} there is too late -- it has to be before \usepackage[utf8x]{inputenc}.

    So we either have to somehow introduce another latex-pre-preamble, or use some kind of marking in latex-preamble, like

    % docutils: ucs[options]

    I see second variant as much less clear and confusing, than two new options.

    If we go latex-pre-preamble route, are we going to implement ucs scanning in robust way? in particluar filtering comments (easy) and handling subincludes (needs TeX parsing). I'd go the easy route, but there are cases, where doc system uses \inputenc stuff in subpackages.

    All this is overcomable for sure, but maybe let's not do magic? After all explicit is better than implicit.

    I don't insist, I just want to clarify and discuss.

  • Kirill Smelkov
    Kirill Smelkov

    And as to documentclass options going to other packages options -- true, but I feel relying on it a bit unflexible. Yes, this is used for babel (we set language in documentclass), but for ucs, I'd try to provide options explicitly.

    I don't insist though.

  • Kirill Smelkov
    Kirill Smelkov

    • status: open --> closed-rejected