From 400a68c18030a642d4d9c1a45b4003ab468ccba9 Mon Sep 17 00:00:00 2001 From: grubert Date: Wed, 25 Aug 2004 08:04:18 +0000 Subject: [PATCH] Add ``\PreloadUnicodePage{n}`` to the header if in LaTeX code uses unicode. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2542 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- HISTORY.txt | 4 ++++ docutils/writers/latex2e.py | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 1ef9fc421..3cd21bdf1 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -19,6 +19,10 @@ Changes Since 0.3.5 - Directive "sectnum" now accepts "prefix", "suffix", and "start" options. Thanks to Lele Gaifax. +* docutils/writers/latex2e.py: + + - Add ``\PreloadUnicodePage{n}`` to the header if in LaTeX code + uses unicode. Release 0.3.5 (2004-07-29) ========================== diff --git a/docutils/writers/latex2e.py b/docutils/writers/latex2e.py index 21f679a20..43395a588 100644 --- a/docutils/writers/latex2e.py +++ b/docutils/writers/latex2e.py @@ -573,7 +573,11 @@ class LaTeXTranslator(nodes.NodeVisitor): fontenc = '\\usepackage[T1]{fontenc}\n' else: fontenc = '' - + input_encoding = self.encoding % self.to_latex_encoding(settings.output_encoding) + if self.to_latex_encoding(settings.output_encoding) == 'utf8': + # preload unicode to avoid ``Please insert PrerenderUnicode`` message, + # when rendering the first ``\section``. + input_encoding += '\\PreloadUnicodePage{0}\n' if self.settings.graphicx_option == '': self.graphicx_package = '\\usepackage{graphicx}\n' elif self.settings.graphicx_option.lower() == 'auto': @@ -593,7 +597,7 @@ class LaTeXTranslator(nodes.NodeVisitor): '\\usepackage{babel}\n', # language is in documents settings. fontenc, '\\usepackage{shortvrb}\n', # allows verb in footnotes. - self.encoding % self.to_latex_encoding(settings.output_encoding), + input_encoding, # * tabularx: for docinfo, automatic width of columns, always on one page. '\\usepackage{tabularx}\n', '\\usepackage{longtable}\n', -- 2.11.4.GIT