[XeTeX] Pardon me for asking a PGF/TIKZ question here

Herbert Schulz herbs at wideopenwest.com
Fri Dec 4 16:07:18 CET 2009


On Dec 4, 2009, at 8:24 AM, Alan Jones wrote:

> Hi:
> 
> I am trying to center a picture that I created using XFig. I converted
> this fig to trikz file using fig2tikz tool. I am unable to center this
> Fig in the document. I also exported the image from Xfig as a PDF
> file. I am unable to center the PDF file also. The source code for the
> Tikz script is as follows.
> 
> \begin{center}
> \begin{tikzpicture}[y=-1cm]
> % objects at depth 50:
> \definecolor{fillColor}{rgb}{0,0.43137,1}
> \path[rounded corners=6.3bp,draw=black,ultra thick,fill=fillColor]
> (18,7.9) rectangle (0,-0.1);
> \path (8.2,1.8) node[text=white,anchor=base]
> {\fontsize{32.0}{38.4}\selectfont{}\bfseries The LaTeX Book Skeleton};
> \path (8.5,3.5) node[text=white,anchor=base]
> {\fontsize{28.0}{33.6}\selectfont{}\sffamily By};
> \path (8.4,5.3) node[text=white,anchor=base]
> {\fontsize{28.0}{33.6}\selectfont{}\sffamily D.J.D. Dodotoson};
> \end{tikzpicture}%
> \end{center}
> 
> Why isn't the tikz or the pdf image not getting centered.
> 
> Thanks for your help.
> 
> Regards,
> Alan

Howdy,

Since the width of the figure is greater than the \texwidth centering won't do anything. Put the figure inside a 0pt width hbox:

\begin{center}
\makebox[0pt][c]{\begin{tikzpicture}[y=-1cm]
% objects at depth 50:
\definecolor{fillColor}{rgb}{0,0.43137,1}
\path[rounded corners=6.3bp,draw=black,ultra thick,fill=fillColor]
(18,7.9) rectangle (0,-0.1);
\path (8.2,1.8) node[text=white,anchor=base]
{\fontsize{32.0}{38.4}\selectfont{}\bfseries The LaTeX Book Skeleton};
\path (8.5,3.5) node[text=white,anchor=base]
{\fontsize{28.0}{33.6}\selectfont{}\sffamily By};
\path (8.4,5.3) node[text=white,anchor=base]
{\fontsize{28.0}{33.6}\selectfont{}\sffamily D.J.D. Dodotoson};
\end{tikzpicture}%
}
\end{center}

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)





More information about the XeTeX mailing list