7

I have a TikZ picture that overlaps with the text. I'm sure this one is easy, but I didn't find a solution.

Here is a snapshot:

enter image description here

And this is the code:

\section{Algorithm Outline}

blabla

\begin{figure}[H]
\selectlanguage{american}%
\begin{centering}
\ttfamily  

\begin{tikzpicture}[node distance = 2cm, 
auto, x=1cm, y=1cm,  transform canvas={scale=0.62},
>=stealth]  
    [picture code]

\end{tikzpicture}
\par\end{centering}

\selectlanguage{english}%
\caption{Algorithm Outline}
\end{figure}


The focus of this paper is on finding a feasible and good ....

I hope someone has a solution.

Christian
  • 503
  • 2
    This is most likely because you're using transform canvas, which causes PGF to "[lose] track of positions of nodes and of picture sizes" (PGF manual). I would try setting scale=0.62, every node/.append style={transform shape}, but it's hard to test without some TikZ code. – Jake Feb 11 '13 at 16:15
  • 1
    What's the purpose of the two \selectlanguage commands? In the standard setup, american and english do exactly the same. Note also that \centering is not an environment; just put \centering instead of \begin{centering} and remove \par\end{centering} – egreg Feb 11 '13 at 16:36
  • @Jake: I tried your suggestion, unfortunately it does not work. Maybe there is another solution to scale the whole picture. Like in pstricks, where one can set the unit to a value like 0.5cm. – Christian Feb 11 '13 at 16:53
  • @Chris: Yes, there's that option, and you're already using it to set your unit vectors to 1cm length (which is the default value). Could you specify what you mean with "it does not work"? – Jake Feb 11 '13 at 16:56
  • 1
    @Jake: sorry for not being specific. I meant that there is no change, but in fact I made a mistake. Your solution does work! Thanks a lot! – Christian Feb 11 '13 at 17:14

1 Answers1

7

This happens because you're using transform canvas, which causes PGF to "[lose] track of positions of nodes and of picture sizes" (PGF manual).

Set scale=0.62, every node/.append style={transform shape} to use the "proper" way to scale your tikzpicture.

Jake
  • 232,450