我有几张表格想要对齐,但结果却乱七八糟。我将其用作revtex4
一般布局(两列),如下所示:
\begin{tabular}{|c||@{\hspace{12pt}} c @{\hspace{12pt}}|@{\hspace{13.95pt}} c @{\hspace{13.95pt}}|@{\hspace{13.95pt}} c @{\hspace{13.95pt}}|} \hline
&$V(x)=x^2$&$V(x)=x^4$&$V(x)=x^8$\\ \hline
\textbf{\em $E_0$} & 0.707103 & 0.667981 & 0.704039 \\ \hline
\textbf{\em $E_1$} & 2.121301 & 2.393603 & 2.731454 \\ \hline
\textbf{\em $E_2$} & 3.535485 & 4.696656 & 5.883874 \\ \hline
\textbf{\em $E_3$} & 4.949665 & 7.335404 & 9.960179 \\ \hline
\textbf{\em $E_4$} & 6.363920 & 10.243682 & 14.821645 \\ \hline
\textbf{\em $E_5$} & 7.778728 & 13.378278 & 20.384956 \\ \hline
\end{tabular}
\begin{tabular}{|c||@{\hspace{10pt}} c @{\hspace{10pt}}|@{\hspace{10pt}} c @{\hspace{10pt}}|@{\hspace{10pt}} c @{\hspace{10pt}}|} \hline
&$V(x)=x^{20}$&$V(x)=x^{126}$&$V(x)=x^{150}$\\ \hline
\textbf{\em $E_0$} & 0.830976 & 1.090953 & 1.107245 \\ \hline
\textbf{\em $E_1$} & 3.311759 & 4.363576 & 4.428776 \\ \hline
\textbf{\em $E_2$} & 7.408376 & 9.817155 & 9.963977 \\ \hline
\textbf{\em $E_3$} & 13.071500 & 17.450506 & 17.711824 \\ \hline
\textbf{\em $E_4$} & 20.244628 & 27.261978 & 27.670885 \\ \hline
\textbf{\em $E_5$} & 28.871374 & 39.249456 & 39.839327 \\ \hline
\end{tabular}
\begin{tabular}{|c||@{\hspace{10pt}} c @{\hspace{10pt}}|} \hline
&$V(x)=x^{2p},p\to\infty$\\ \hline
\textbf{\em $E_0$} & 1.233700 \\ \hline
\textbf{\em $E_1$} & 4.934787 \\ \hline
\textbf{\em $E_2$} & 11.103227 \\ \hline
\textbf{\em $E_3$} & 19.738961 \\ \hline
\textbf{\em $E_4$} & 30.841909 \\ \hline
\textbf{\em $E_5$} & 44.411966 \\ \hline
\end{tabular}\
结果是:
我有这个:
\begin{tabular}{|@{\hspace{22pt}} c @{\hspace{22pt}}||@{\hspace{12pt}} c @{\hspace{12pt}}|@{\hspace{12pt}} c @{\hspace{12pt}}|} \hline
$V(x)=x^2$ & Numerički& Analitički\\ \hline
\textbf{\em $E_0$} & 0.707103 & 0.5 \\ \hline
\textbf{\em $E_1$} & 2.121301 & 1.5 \\ \hline
\textbf{\em $E_2$} & 3.535485 & 2.5 \\ \hline
\textbf{\em $E_3$} & 4.949665 & 3.5 \\ \hline
\textbf{\em $E_4$} & 6.363920 & 4.5\\ \hline
\textbf{\em $E_5$} & 7.778728 & 5.5\\ \hline
\end{tabular}
\begin{tabular}{|c||@{\hspace{12pt}} c @{\hspace{12pt}}|@{\hspace{12pt}} c @{\hspace{12pt}}|} \hline
$V(x)=x^{2p},p\to\infty$& Numerički& Analitički\\ \hline
\textbf{\em $E_0$} & 1.233700 & 1.233700 \\ \hline
\textbf{\em $E_1$} & 4.934787 & 4.934802 \\ \hline
\textbf{\em $E_2$} & 11.103227 & 11.103304 \\ \hline
\textbf{\em $E_3$} & 19.738961 & 19.739208 \\ \hline
\textbf{\em $E_4$} & 30.841909 & 30.842513 \\ \hline
\textbf{\em $E_5$} & 44.411966 & 44.413219 \\ \hline
\end{tabular}\
这给了我这个:
我想要对齐垂直线。我尝试在后面输入相同的值,{tabular}{...}
但文本会覆盖并拉伸它:有什么建议可以实现这一点吗?我希望它整齐并适合一列...
答案1
对于具有匹配对齐方式的多个表,我宁愿使用固定宽度的列。标准 p 列是合理的;请参阅这有关居中 p 列(y
在我的示例中调用)的详细信息的问题。
\documentclass{revtex4}
\usepackage[utf8]{inputenc}
\usepackage{array}
\newcolumntype{y}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\renewcommand*{\arraystretch}{1.2}
\begin{document}
\begin{tabular}{|y{85pt}||y{65pt}|y{65pt}|} \hline
$V(x)=x^2$ & Numerički& Analitički\\ \hline
\textbf{\em $E_0$} & 0.707103 & 0.5 \\ \hline
\textbf{\em $E_1$} & 2.121301 & 1.5 \\ \hline
\textbf{\em $E_2$} & 3.535485 & 2.5 \\ \hline
\textbf{\em $E_3$} & 4.949665 & 3.5 \\ \hline
\textbf{\em $E_4$} & 6.363920 & 4.5\\ \hline
\textbf{\em $E_5$} & 7.778728 & 5.5\\ \hline
\end{tabular}
\begin{tabular}{|y{85pt}||y{65pt}|y{65pt}|} \hline
$V(x)=x^{2p},p\to\infty$& Numerički& Analitički\\ \hline
\textbf{\em $E_0$} & 1.233700 & 1.233700 \\ \hline
\textbf{\em $E_1$} & 4.934787 & 4.934802 \\ \hline
\textbf{\em $E_2$} & 11.103227 & 11.103304 \\ \hline
\textbf{\em $E_3$} & 19.738961 & 19.739208 \\ \hline
\textbf{\em $E_4$} & 30.841909 & 30.842513 \\ \hline
\textbf{\em $E_5$} & 44.411966 & 44.413219 \\ \hline
\end{tabular}
\end{document}