summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnesto Revilla <erevilla@tangrambpm.es>2014-02-20 18:03:34 +0100
committerErnesto Revilla <erevilla@tangrambpm.es>2014-02-20 18:03:34 +0100
commit0725274b5e1bbe33c2e4273b249822e57c99f57d (patch)
treed11aabfc2b9267ef645ac0738a7ebf4b2d8ceb8a
parent5e94cf8968b559320bd152609a62b59a113342ed (diff)
downloadsphinx-0725274b5e1bbe33c2e4273b249822e57c99f57d.tar.gz
Allow alternative float options for figure. See #1. no-pep8
-rw-r--r--doc/config.rst6
-rw-r--r--sphinx/quickstart.py3
-rw-r--r--sphinx/writers/latex.py4
3 files changed, 12 insertions, 1 deletions
diff --git a/doc/config.rst b/doc/config.rst
index 1b196abb..f6826995 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -1099,6 +1099,12 @@ These options influence LaTeX output.
"Rejne". You can also set this to ``''`` to disable fncychap.
``'preamble'``
Additional preamble content, default empty.
+ ``'figure_align'``
+ Latex figure float alignment, default 'htbp' (here, top, bottom, page).
+ Whenever an image doesn't fit into the current page, it wil be
+ 'floated' into the next page but may be preceeded by any other text.
+ If you don't like this behavior, use 'H' which will disable floating
+ and position figures strictly in the order they appear in the source.
``'footer'``
Additional footer content (before the indices), default empty.
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index a57006fd..8a9fe479 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -236,6 +236,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 1c915431..a1c4afe1 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
@@ -1005,7 +1006,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')