[Tex/LaTex] \centerline{} command alternative


I am adding figures to a work and most of the figures are too wide and are thus not centered but are shifted to the right. I searched here and found a solution, that would consist in adding the \centerline{} command into the figure environment. This work fine for figures added with the command \includegraphics{}, like in this example:

\end{center} % is this really useful?

But when I try to add a tikzpicture instead, this solution does not work (see example)

some code 

My question is : are there alternatives to this \centerline{} command?


Best Answer

The \centerline command should never be used in a LaTeX document (unless you know precisely what you're doing, and probably only in the preamble for some definition). Use




and <whatever> (a graphic, a TikZ picture or anything) will be centered.

Related Question