I don't know if it's me, but when I include graphviz images in a latex
figure, with \centering, the image wont get centered.

I hit the "problem", it seems to be that LaTeX has some problem if the
\includegraphics don't have any options. Again, I don't know much about
LaTeX but the trivial patch I've attached fixed this problem for me.

If this is a real bug, I hope you can apply it, and if it's not, I will be
glad to hear what I'm doing wrong.

Here is the code I'm using:

.. raw:: latex

   \begin{figure}[htp] \centering

.. digraph:: g1

   a -> b;
   // etc.

.. raw:: latex

   \caption{Some text.}
   \end{figure}

Which translates to::

   \begin{figure}[htp] 
\centering\includegraphics{graphviz-152dd7a8642215dea3e09531c3bb69e2f55bc6ed.pdf}\caption{Some
 text.}
   \end{figure}

This doesn't center the image for me. With the patch this is the outpu::

   \begin{figure}[htp] 
\centering\includegraphics[]{graphviz-152dd7a8642215dea3e09531c3bb69e2f55bc6ed.pdf}\caption{Some
 text.}
   \end{figure}

And works fine for me (note the "[]" after "includegraphics").

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Pack and get dressed
before your father hears us,
before all hell breaks loose.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

diff --git a/ext/graphviz.py b/ext/graphviz.py index 2dabd5e..6f365e3
100644 --- a/ext/graphviz.py +++ b/ext/graphviz.py @@ -169,7 +169,7 @@ def
render_dot_latex(self, node, code, options, prefix='graphviz'): raise
nodes.SkipNode
 
     if fname is not None:
-        self.body.append('\\includegraphics{%s}' % fname)
+        self.body.append('\\includegraphics[]{%s}' % fname)
     raise nodes.SkipNode
 
 

Reply via email to