Add a caveat about LaTeX titles and authors, and properly escape

a title that comes from the document itself.
This commit is contained in:
Georg Brandl 2008-10-16 19:37:57 +00:00
parent 23d578da81
commit efd474b296
2 changed files with 9 additions and 3 deletions

View File

@ -442,8 +442,12 @@ These options influence LaTeX output.
here.) here.)
* *targetname*: file name of the LaTeX file in the output directory. * *targetname*: file name of the LaTeX file in the output directory.
* *title*: LaTeX document title. Can be empty to use the title of the * *title*: LaTeX document title. Can be empty to use the title of the
*startdoc*. *startdoc*. This is inserted as LaTeX markup, so special characters like a
* *author*: Author for the LaTeX document. 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" * *documentclass*: Must be one of ``'manual'`` or ``'howto'``. Only "manual"
documents will get appendices. Also, howtos will have a simpler title documents will get appendices. Also, howtos will have a simpler title
page. page.

View File

@ -337,7 +337,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
if len(node.children) != 1 and not isinstance(node.children[0], nodes.Text): if len(node.children) != 1 and not isinstance(node.children[0], nodes.Text):
self.builder.warn('document title is not a single Text node') self.builder.warn('document title is not a single Text node')
if not self.elements['title']: 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 self.this_is_the_title = 0
raise nodes.SkipNode raise nodes.SkipNode
elif isinstance(node.parent, nodes.section): elif isinstance(node.parent, nodes.section):