diff options
author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-11-17 19:29:00 +0000 |
---|---|---|
committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-11-17 19:29:00 +0000 |
commit | c1e00733c0c1f52392026a5beee4e5d02f136645 (patch) | |
tree | 14804a04ddd15402fe29b568842b323841ad988e | |
parent | de5e2881dcabcb0da591f164e03ba7bcb3564573 (diff) | |
download | docutils-c1e00733c0c1f52392026a5beee4e5d02f136645.tar.gz |
Add option --use-latex-abstract.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4817 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | HISTORY.txt | 3 | ||||
-rw-r--r-- | docutils/writers/latex2e/__init__.py | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index 8a1d38a1e..f96de4939 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -87,7 +87,8 @@ Changes Since 0.4 * docutils/writers/latex2e/__init__.py: - - Image width unit ``px`` is translated to ``pt``: + - Add option --use-latex-abstract. + - Image width unit ``px`` is translated to ``pt``. - Add image height support. - Fix: image width ``70%`` is converted ``0.700\linewidth``. bug #1457388 diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index 6619e8f0c..1abdbe2a8 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -79,6 +79,11 @@ class Writer(writers.Writer): ['--use-latex-docinfo'], {'default': 0, 'action': 'store_true', 'validator': frontend.validate_boolean}), + ('Use LaTeX abstract environment for the documents abstract.' + 'Per default the abstract is an unnumbered section.', + ['--use-latex-abstract'], + {'default': 0, 'action': 'store_true', + 'validator': frontend.validate_boolean}), ('Color of any hyperlinks embedded in text ' '(default: "blue", "0" to disable).', ['--hyperlink-color'], {'default': 'blue'}), @@ -2009,6 +2014,9 @@ class LaTeXTranslator(nodes.NodeVisitor): and self.use_latex_toc): self.body.append('\\renewcommand{\\contentsname}{') self.context.append('}\n\\tableofcontents\n\n\\bigskip\n') + elif ('abstract' in self.topic_classes + and self.settings.use_latex_abstract): + raise nodes.SkipNode else: # or section titles before the table of contents. # BUG: latex chokes on center environment with # "perhaps a missing item", therefore we use hfill. @@ -2052,8 +2060,14 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_topic(self, node): self.topic_classes = node['classes'] + if ('abstract' in self.topic_classes + and self.settings.use_latex_abstract): + self.body.append('\\begin{abstract}\n') def depart_topic(self, node): + if ('abstract' in self.topic_classes + and self.settings.use_latex_abstract): + self.body.append('\\end{abstract}\n') self.topic_classes = [] if 'contents' in node['classes'] and self.use_latex_toc: pass |