# Tikzpicture in table

I would like to center the tikzpicture in first column. In the output, the graph alignment is different for rows.

\documentclass[12pt]{report}
\renewcommand{\baselinestretch}{1.5}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzstyle{vertex}=[circle, draw, inner sep=0pt, minimum size=6pt]
\newcommand{\vertex}{\node[vertex]}
\newcounter{Angle}
\textwidth 5.55in
\textheight 7.35in

\begin{document}
$\begin{array}{|b|lc|lc|lc|} \hline G & \multicolumn{2}{c}{cr(G+nK_{1})} \vline & \multicolumn{2}{c|}{cr(G+P_{n})} & \multicolumn{2}{c|} {cr(G+C_{n})} \\ \hline %enter first row% \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \end{tikzpicture}& Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering second row%%%% \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c) \end{tikzpicture} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering third row%%%% \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c) (b) edge (d) \end{tikzpicture} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline \end{array}$
\]
\begin{center}
\caption {Summary of crossing numbers for $G+nK_{1}$, $G+P_{n}$ and $G+C_{n}$.}
\end{center}

\end{document}
-
There are a couple things going on here that could use some fixing. (1) You're calling several packages multiple times. (2) You're trying to sue a dvips driver with TikZ which will eventually lead to problems. (3) The compilation routes for pstricks and TikZ can often be at odds with one another. (4) Math environments do not like empty lines in them. –  A.Ellett Dec 16 '13 at 5:13
I have edit the question.but the problems remain. –  user42789 Dec 16 '13 at 5:27
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  karlkoeller Dec 16 '13 at 6:30

You can insert your tikzpictures in minipages

Code:

\documentclass[12pt]{report}
\renewcommand{\baselinestretch}{1.5}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{vertex/.style={circle, draw, inner sep=0pt, minimum size=6pt}}
%\tikzstyle{vertex}=[circle, draw, inner sep=0pt, minimum size=6pt]
\newcommand{\vertex}{\node[vertex]}
\newcounter{Angle}
\textwidth 5.55in
\textheight 7.35in

\begin{document}

$\begin{array}{|c|lc|lc|lc|} % a table with three centered columns separated by vertical lines \hline G & \multicolumn{2}{c|}{cr(G+nK_{1})} & \multicolumn{2}{c|}{cr(G+P_{n})} & \multicolumn{2}{c|} {cr(G+C_{n})} \\ \hline % a horizontal line to separate the headings (graphs) from the body (vertices) %enter first row% \begin{minipage}{0.92cm} \vspace*{3pt} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \end{tikzpicture}% \vspace*{3pt} \end{minipage} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering second row%%%% \begin{minipage}{0.92cm} \vspace*{3pt} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c); \end{tikzpicture}% \vspace*{3pt} \end{minipage} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering third row%%%% \begin{minipage}{0.92cm} \vspace*{3pt} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c) (b) edge (d); \end{tikzpicture}% \vspace*{3pt} \end{minipage} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline \end{array}$

\end{document}

P.S: there were some errors in your code that I've corrected...

-
It would be great to provide some explanation about the errors; side note: it is better to exploit tikzset rather than tikzstyle. –  Claudio Fiandrino Dec 16 '13 at 7:23
@ClaudioFiandrino Yes, thanks. Added some hints. –  karlkoeller Dec 16 '13 at 8:05
Excellent, thanks! +1 –  Claudio Fiandrino Dec 16 '13 at 8:09
@karlkoeller Thank you very much..problem solved! –  user42789 Dec 16 '13 at 8:21
@user42789 Glad it helped. Remember that you can accept the answer, if you want. See How do you accept an answer? –  karlkoeller Dec 16 '13 at 8:42

You can insert the tikzpicture in a nested tabular, which will provide the vertical alignment. Some more height must be added to cells, which I do by locally changing \extrarowheight.

\documentclass[12pt]{report}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\tikzset{vertex/.style={circle, draw, inner sep=0pt, minimum size=6pt}}
\newcommand{\vertex}{\node[vertex]}

\begin{document}
\begin{table}
\centering
\setlength{\extrarowheight}{12pt}
$\begin{array}{|c|lc|lc|lc|} \hline G & \multicolumn{2}{c|}{cr(G+nK_{1})} & \multicolumn{2}{c|}{cr(G+P_{n})} & \multicolumn{2}{c|} {cr(G+C_{n})} \\ \hline %enter first row% \begin{tabular}{@{}c@{}} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \end{tikzpicture} \end{tabular} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering second row%%%% \begin{tabular}{@{}c@{}} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c); \end{tikzpicture} \end{tabular} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline %%%%Entering third row%%%% \begin{tabular}{@{}c@{}} \begin{tikzpicture}[x=0.7cm, y=0.7cm] \vertex (a) at (0,0) {}; \vertex (b) at (1,0) {}; \vertex (c) at (0,1) {}; \vertex (d) at (1,1) {}; \path (a) edge (c) (b) edge (d); \end{tikzpicture} \end{tabular} & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 1 & Z(4,n) & n\geq 3 \\ \hline \end{array}$
\caption {Summary of crossing numbers for $G+nK_{1}$, $G+P_{n}$ and $G+C_{n}$.}
\end{table}
\end{document}

The whole construction should be in a table environment, probably. No $...$, in this case, although it doesn't really make a big difference. I used \centering instead.

-