[Python-checkins] r66921 - in doctools/trunk: doc/config.rst sphinx/latexwriter.py

georg.brandl python-checkins at python.org
Thu Oct 16 21:37:58 CEST 2008


Author: georg.brandl
Date: Thu Oct 16 21:37:57 2008
New Revision: 66921
Log:
Add a caveat about LaTeX titles and authors, and properly escape
a title that comes from the document itself.
Modified:
 doctools/trunk/doc/config.rst
 doctools/trunk/sphinx/latexwriter.py
Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst	(original)
+++ doctools/trunk/doc/config.rst	Thu Oct 16 21:37:57 2008
@@ -442,8 +442,12 @@
 here.)
 * *targetname*: file name of the LaTeX file in the output directory.
 * *title*: LaTeX document title. Can be empty to use the title of the
- *startdoc*.
- * *author*: Author for the LaTeX document.
+ *startdoc*. This is inserted as LaTeX markup, so special characters like a
+ backslash or ampersand must be represented by the proper LaTeX commands if
+ they are to be inserted literally.
+ * *author*: Author for the LaTeX document. The same LaTeX markup caveat as
+ for *title* applies. Use ``\and`` to separate multiple authors, as in:
+ ``'John \and Sarah'``.
 * *documentclass*: Must be one of ``'manual'`` or ``'howto'``. Only "manual"
 documents will get appendices. Also, howtos will have a simpler title
 page.
Modified: doctools/trunk/sphinx/latexwriter.py
==============================================================================
--- doctools/trunk/sphinx/latexwriter.py	(original)
+++ doctools/trunk/sphinx/latexwriter.py	Thu Oct 16 21:37:57 2008
@@ -337,7 +337,9 @@
 if len(node.children) != 1 and not isinstance(node.children[0], nodes.Text):
 self.builder.warn('document title is not a single Text node')
 if not self.elements['title']:
- self.elements['title'] = node.astext()
+ # text needs to be escaped since it is inserted into
+ # the output literally
+ self.elements['title'] = node.astext().translate(tex_escape_map)
 self.this_is_the_title = 0
 raise nodes.SkipNode
 elif isinstance(node.parent, nodes.section):


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /