Merge, rather than overwrite, LaTeX settings
This leads to more predictable behavior. Change-Id: I3a9d96c4896a0d5ccc85b74562d35852a837f29f Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Closes-Bug: #1843527
This commit is contained in:
parent
1246a46deb
commit
2b258f0380
@ -90,8 +90,6 @@ Using the theme
|
|||||||
|
|
||||||
- ``project``
|
- ``project``
|
||||||
- ``html_last_updated_fmt``
|
- ``html_last_updated_fmt``
|
||||||
- ``latex_engine``
|
|
||||||
- ``latex_elements``
|
|
||||||
|
|
||||||
#. Configure version-related options.
|
#. Configure version-related options.
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ except ImportError:
|
|||||||
import ConfigParser as configparser
|
import ConfigParser as configparser
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import textwrap
|
||||||
|
|
||||||
import dulwich.repo
|
import dulwich.repo
|
||||||
from pbr import packaging
|
from pbr import packaging
|
||||||
@ -341,17 +342,29 @@ def _builder_inited(app):
|
|||||||
|
|
||||||
theme_logo = paths.get_theme_logo_path(app.config.html_theme)
|
theme_logo = paths.get_theme_logo_path(app.config.html_theme)
|
||||||
pdf_theme_path = paths.get_pdf_theme_path(app.config.html_theme)
|
pdf_theme_path = paths.get_pdf_theme_path(app.config.html_theme)
|
||||||
|
latex_elements = {
|
||||||
app.config.latex_engine = 'xelatex'
|
|
||||||
app.config.latex_elements = {
|
|
||||||
'papersize': 'a4paper',
|
'papersize': 'a4paper',
|
||||||
'pointsize': '11pt',
|
'pointsize': '11pt',
|
||||||
'figure_align': 'H',
|
'figure_align': 'H',
|
||||||
'classoptions': ',openany',
|
'classoptions': ',openany',
|
||||||
'preamble': r"""
|
}
|
||||||
\usepackage{""" + pdf_theme_path + r"""}
|
|
||||||
\newcommand{\openstacklogo}{""" + theme_logo + """}
|
if app.config.latex_elements:
|
||||||
"""}
|
latex_elements.update(app.config.latex_elements)
|
||||||
|
|
||||||
|
preamble = textwrap.dedent(
|
||||||
|
r"""
|
||||||
|
\usepackage{%s}
|
||||||
|
\\newcommand{\openstacklogo}{%s}
|
||||||
|
"""
|
||||||
|
) % (pdf_theme_path, theme_logo)
|
||||||
|
|
||||||
|
if 'preamble' in latex_elements:
|
||||||
|
preamble += latex_elements['preamble']
|
||||||
|
|
||||||
|
latex_elements['preamble'] = preamble
|
||||||
|
|
||||||
|
app.config.latex_elements = latex_elements
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The ``latex_engine`` and ``latex_elements`` options, which were previously
|
||||||
|
always overridden by the extension, will now be merged with user
|
||||||
|
configuration. If ``latex_engine`` is configured by the user, this will be
|
||||||
|
used in-place of the default. If ``latex_elements``, a dictionary, is
|
||||||
|
configured, the values provided by the user will be merged with the
|
||||||
|
defaults with user-provided defaults preferred.
|
Loading…
Reference in New Issue
Block a user