diff --git a/doc/config.rst b/doc/config.rst index 355cd19d05..5224658dd4 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1117,6 +1117,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 26b420d075..1241e09873 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 old mode 100755 new mode 100644 index dd9a542122..9d3c017958 --- 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')