我在表格中居中文本时遇到了一些困难。如果您有空,请帮我解决以下问题。
参照下图,您可以看到“Graph”一词左对齐,而不是居中。如何使其居中?您能就此问题提供建议或指导吗?
\documentclass{article}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{array}
\newcommand{\tesplot}{%
\begin{tikzpicture}
[scale=.4,auto=center]
\node (n1) at (10.6,4.9) [draw, circle,fill=green!20] {1};
\node (n2) at (4,0.8) [draw, circle,fill=blue!20] {2};
\node (n3) at (3.8,11.4) [draw, circle,fill=green!20] {3};
\node (n4) at (0.1,6.4) [draw, circle,fill=green!20] {4};
\node (n5) at (3.6,3.4) [draw, circle,fill=blue!20] {5};
\node (n6) at (7.4,2.3) [draw, circle,fill=blue!20] {6};
\node (n7) at (9,10.4) [draw, circle,fill=green!20] {7};
\node (n8) at (18,10.8) [draw, circle,fill=green!20] {8};
\foreach \from/\to in {n6/n2,n2/n5,n5/n6}
\draw[blue] (\from) -- (\to);
\foreach \from/\to in {n1/n8,n8/n7,n7/n1,n3/n7,n4/n3}
\draw[green] (\from) -- (\to);
\foreach \from/\to in {n6/n1,n5/n4,n2/n4,n1/n5}
\draw[red] (\from) -- (\to);
\end{tikzpicture}
}
\begin{document}
\begin{longtable}{ l l l l >{\centering\arraybackslash}m{7cm} }
\toprule
\multicolumn{5}{ c }{Convergence} \\
\midrule
Time & \multicolumn{2}{ c }{Information} & Graph & Description \\
\cmidrule(r){1-1}\cmidrule(lr){2-3}\cmidrule(lr){4-4}\cmidrule(l){5-5}
& Vertice & 8 & & \\[1cm]
1 & ${P(1)}$ & 0.5 &
\raisebox{-2.3cm}[50pt][50pt]{%
\tesplot} & \raisebox{-0.1cm}[0pt][0pt]{%
\begin{minipage}[c]{2.8in}
Hello World akdjfasljdfkjasj dfjsadkflkjksad flkaskjdfsadlflkj safdalkjsfd sljdfkjasj dfjsa sljdfkjasj dfjsadkflkjksad flkaskjd fsadlflkj safdalkjsfd sljdfkjasj dfjsadkflkjksad flkaskjdfsadl flkj safdalkjsfd dkflkjksad flkaskjdfsadlflkj safdalkjsfd
\end{minipage} } {%
} \\[1cm]
& Chance & 0.5 & & \\[1cm]
\bottomrule
\end{longtable}
\end{document}
答案1
\multicolumn{1}{c}{Graph}
由 Mico 解决(https://tex.stackexchange.com/users/5001/mico),谢谢大家,非常感谢!!!!