summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-03-01 08:56:53 +0100
committerGeorg Brandl <georg@python.org>2014-03-01 08:56:53 +0100
commit77635b8e09830edc1bebf50acae3a24e41172964 (patch)
treee4e8c73ce4b868d8ae289965de69594bfd697e1b /sphinx
parentcae75719ecf12d09bc9835d0ac8d9da8bc65d5d3 (diff)
parent0725274b5e1bbe33c2e4273b249822e57c99f57d (diff)
downloadsphinx-77635b8e09830edc1bebf50acae3a24e41172964.tar.gz
Merged in erny1803/sphinx (pull request #227)
Latex: Allow alternative float options for figures
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/quickstart.py3
-rw-r--r--[-rwxr-xr-x]sphinx/writers/latex.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index 26b420d0..1241e098 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -246,6 +246,9 @@ latex_elements = {
# Additional stuff for the LaTeX preamble.
#'preamble': '',
+
+# Latex figure (float) alignment
+#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index dd9a5421..9d3c0179 100755..100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -164,6 +164,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
'footer': '',
'printindex': '\\printindex',
'transition': '\n\n\\bigskip\\hrule{}\\bigskip\n\n',
+ 'figure_align': 'htbp',
}
# sphinx specific document classes
@@ -1006,7 +1007,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
# TODO non vertical space for other alignments.
align = '\\begin{flush%s}' % node.attributes['align']
align_end = '\\end{flush%s}' % node.attributes['align']
- self.body.append('\\begin{figure}[htbp]%s\n' % align)
+ self.body.append('\\begin{figure}[%s]%s\n' % (
+ self.elements['figure_align'], align))
if any(isinstance(child, nodes.caption) for child in node):
self.body.append('\\capstart\n')
self.context.append(ids + align_end + '\\end{figure}\n')