diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2014-02-28 14:15:59 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2014-02-28 14:15:59 +0000 |
commit | 85d02d9b029d4572f7163c6dbe2895a9953dbe69 (patch) | |
tree | 50befbcd7c07101c277493b373b5465f971366e4 | |
parent | 5b5a3adf301be7e3e360ba993d96d84ee84b3cec (diff) | |
download | docutils-85d02d9b029d4572f7163c6dbe2895a9953dbe69.tar.gz |
Apply [ 116 ] by Kirill Smelkov. No hardcode \\\\large for subtitle.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7745 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | HISTORY.txt | 1 | ||||
-rw-r--r-- | docutils/writers/latex2e/__init__.py | 7 | ||||
-rw-r--r-- | test/functional/expected/standalone_rst_latex.tex | 5 | ||||
-rw-r--r-- | test/functional/expected/standalone_rst_xetex.tex | 5 | ||||
-rwxr-xr-x | test/test_writers/test_latex2e.py | 6 |
5 files changed, 20 insertions, 4 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index c519ea310..063f9b862 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -19,6 +19,7 @@ Changes Since 0.11 * docutils/writers/latex2e/__init__.py - Fix [ 239 ] Latex writer glues paragraphs with figure floats. + - Apply [ 116 ] by Kirill Smelkov. Don't hardcode \large for subtitle. * docutils/writers/odf_odt/__init__.py diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index 28c1fbfad..8187cae6a 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -658,6 +658,10 @@ PreambleCmds.subtitle = r""" % subtitle (for topic/sidebar) \providecommand*{\DUsubtitle}[2][class-arg]{\par\emph{#2}\smallskip}""" +PreambleCmds.documentsubtitle = r""" +% subtitle (in document title) +\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}""" + PreambleCmds.table = r"""\usepackage{longtable,ltcaption,array} \setlength{\extrarowheight}{2pt} \newlength{\DUtablewidth} % internal use in tables""" @@ -1903,7 +1907,7 @@ class LaTeXTranslator(nodes.NodeVisitor): title = [''.join(self.title)] + self.title_labels if self.subtitle: title += [r'\\ % subtitle', - r'\large{%s}' % ''.join(self.subtitle) + r'\DUdocumentsubtitle{%s}' % ''.join(self.subtitle) ] + self.subtitle_labels self.titledata.append(r'\title{%s}' % '%\n '.join(title)) # \author (empty \author prevents warning with \maketitle) @@ -2746,6 +2750,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def visit_subtitle(self, node): if isinstance(node.parent, nodes.document): self.push_output_collector(self.subtitle) + self.fallbacks['documentsubtitle'] = PreambleCmds.documentsubtitle self.subtitle_labels += self.ids_to_labels(node, set_anchor=False) # section subtitle: "starred" (no number, not in ToC) elif isinstance(node.parent, nodes.section): diff --git a/test/functional/expected/standalone_rst_latex.tex b/test/functional/expected/standalone_rst_latex.tex index 6e652c0c6..e679dc0e9 100644 --- a/test/functional/expected/standalone_rst_latex.tex +++ b/test/functional/expected/standalone_rst_latex.tex @@ -64,6 +64,9 @@ % docinfo (width of docinfo table) \DUprovidelength{\DUdocinfowidth}{0.9\textwidth} +% subtitle (in document title) +\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}} + % error admonition title \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}} @@ -194,7 +197,7 @@ \label{restructuredtext-test-document}% \label{doctitle}% \\ % subtitle% - \large{Examples of Syntax Constructs}% + \DUdocumentsubtitle{Examples of Syntax Constructs}% \label{examples-of-syntax-constructs}% \label{subtitle}} \author{} diff --git a/test/functional/expected/standalone_rst_xetex.tex b/test/functional/expected/standalone_rst_xetex.tex index 730e4c835..a54b6b0cd 100644 --- a/test/functional/expected/standalone_rst_xetex.tex +++ b/test/functional/expected/standalone_rst_xetex.tex @@ -60,6 +60,9 @@ % docinfo (width of docinfo table) \DUprovidelength{\DUdocinfowidth}{0.9\textwidth} +% subtitle (in document title) +\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}} + % error admonition title \providecommand*{\DUtitleerror}[1]{\DUtitle{\color{red}#1}} @@ -193,7 +196,7 @@ \label{restructuredtext-test-document}% \label{doctitle}% \\ % subtitle% - \large{Examples of Syntax Constructs}% + \DUdocumentsubtitle{Examples of Syntax Constructs}% \label{examples-of-syntax-constructs}% \label{subtitle}} \author{} diff --git a/test/test_writers/test_latex2e.py b/test/test_writers/test_latex2e.py index 97ac130a0..27fd17af7 100755 --- a/test/test_writers/test_latex2e.py +++ b/test/test_writers/test_latex2e.py @@ -582,6 +582,10 @@ This is the *document*. """, head_template.substitute(dict(parts, requirements=parts['requirements'] + '\\setcounter{secnumdepth}{0}\n', + fallbacks=r""" +% subtitle (in document title) +\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}} +""", pdfsetup=parts['pdfsetup'] + r"""\hypersetup{ pdftitle={This is the Title}, } @@ -590,7 +594,7 @@ head_template.substitute(dict(parts, This is the \emph{Title}% \label{this-is-the-title}% \\ % subtitle% - \large{This is the \emph{Subtitle}}% + \DUdocumentsubtitle{This is the \emph{Subtitle}}% \label{this-is-the-subtitle}} \author{} \date{} |