Skip to content

Commit

Permalink
Added support for figure placement.
Browse files Browse the repository at this point in the history
This was done by hijacking the :figclass: attribute.
  • Loading branch information
jaberg authored and stefanv committed Feb 28, 2011
1 parent 9cf0847 commit ff02af0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion papers/00_vanderwalt/00_vanderwalt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ pulvinar id metus.

This is the caption. :label:`egfig`

As you can see in Figure :ref:`egfig`, this is how you reference auto-numbered
.. figure:: figure1.png
:scale: 20%
:figclass: bht

This is the caption on a smaller figure that will be placed by default at the
bottom of the page, and failing that it will be placed inline or at the top. :label:`egfig2`.
Note that for now, scale is relative to a completely arbitrary original
reference size which might be the original size of your image - you probably
have to play with it.

As you can see in Figures :ref:`egfig` and :ref:`egfig2`, this is how you reference auto-numbered
figures.

.. table:: This is the caption for the materials table. :label:`mtable`
Expand Down
10 changes: 10 additions & 0 deletions publisher/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ def depart_paragraph(self, node):
if 'keywords' in node['classes']:
self.out.append('\\end{IEEEkeywords}')

def visit_figure(self, node):
self.requirements['float_settings'] = PreambleCmds.float_settings
if 'classes' in node.attributes:
placements = ''.join(node.attributes['classes'])
self.out.append('\\begin{figure}[%s]'%placements)
else:
self.out.append('\\begin{figure}')
if node.get('ids'):
self.out += ['\n'] + self.ids_to_labels(node)

def visit_image(self, node):
attrs = node.attributes

Expand Down

0 comments on commit ff02af0

Please sign in to comment.