Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Should I use center or centering for figures and tables?

What is the correct way to cause a \tikzpicture to be centered? By default it appears to be aligned with the left margin.

share|improve this question
    
I preffer to put \makeatletter \g@addto@macro\@floatboxreset\centering \makeatother in the preamble, so that every tikzpicture is centered =) –  N3buchadnezzar Jul 7 '12 at 10:52
1  
@N3buchadnezzar Also covered in my answer to the linked question. –  lockstep Jul 7 '12 at 10:53
    
I know =) Exelent answer, that is why I posted it as a comment not as an answer. I guess this question can be closed as Jake said, it is a duplicate. –  N3buchadnezzar Jul 7 '12 at 10:55
add comment

migrated from stackoverflow.com Jul 7 '12 at 10:41

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Jake, lockstep, ienissei, Claudio Fiandrino, percusse Jul 7 '12 at 12:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers

up vote 32 down vote accepted
\begin{figure}[!h]
\centering
\tikz
\end{figure}
share|improve this answer
    
This seems to work well, thanks! –  Jacob Gabrielson Dec 4 '09 at 23:37
add comment

When the picture doesn't need to be put in a figure (i.e. when it doesn't need a caption), I use

\begin{center}
 \begin{tikzpicture}
  ....
 \end{tikzpicture}
\end{center}
share|improve this answer
    
awesome. exactly my case! –  Farticle Pilter Sep 29 '13 at 14:28
    
In my case the picture is too wide, so it breaks the right margin. Is there a way to make it break the left and right margins equally? –  Thomas Ahle Oct 24 '13 at 14:14
add comment

\hbox to \hsize{\hfil{Anything}\hfil}

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.