LaTeX的表格处理一直是件让人头疼的事情,很多人推荐Excel2LaTeX,能够很快捷的将表格转换为代码,然而在使用过程中会发现竖线截断问题,非常不美观
经过一番痛苦的摸索,发现首先在Excel中,需要将所有的灰色虚线去除(划重点!!)
其次,对LaTeX代码做一定改动
原始代码:
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\begin{tabular}{|p{6.135em}p{4.59em}|r|r|r|r|r|r|r|r|}
\multicolumn{10}{p{45.545em}}{配对样本检验} \\
\midrule
\multicolumn{2}{|l|}{\multirow{3}[6]{*}{}} & \multicolumn{5}{p{22.275em}|}{配对差值} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{t}} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{自由度}} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{显著性 (双尾)}} \\
\cmidrule{3-7} \multicolumn{2}{|l|}{} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{平均值(E)}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{标准偏差}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{标准误差平均值}} & \multicolumn{2}{p{8.91em}|}{差值的 95\% 置信区间} & & & \\
\cmidrule{6-7} \multicolumn{2}{|l|}{} & & & & \multicolumn{1}{p{4.455em}|}{下限} & \multicolumn{1}{p{4.455em}|}{上限} & & & \\
\midrule
配对 1 & 预测值 - 实际值 & -0.2427333 & 1.5138139 & 0.8740009 & -4.0032556 & 3.517789 & -0.278 & 2 & 0.807 \\
\bottomrule
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
将 \toprule 、\midrule 、\bottomrule修改为 \hline
将 \cmidrule修改为 \cline
截断现象得到了解决
表格过长,通过\resizebox{\textwidth}{!}解决
% Table generated by Excel2LaTeX from sheet 'Sheet1'
\begin{table}[htbp]
\centering
\caption{Add caption}
\resizebox{\textwidth}{!}
{
\begin{tabular}{|p{6.135em}p{4.59em}|r|r|r|r|r|r|r|r|}
\multicolumn{10}{p{45.545em}}{配对样本检验} \\
\hline
\multicolumn{2}{|l|}{\multirow{3}[6]{*}{}} & \multicolumn{5}{p{22.275em}|}{配对差值} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{t}} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{自由度}} & \multicolumn{1}{c|}{\multirow{3}[6]{*}{显著性 (双尾)}} \\
\cline{3-7} \multicolumn{2}{|l|}{} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{平均值(E)}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{标准偏差}} & \multicolumn{1}{c|}{\multirow{2}[4]{*}{标准误差平均值}} & \multicolumn{2}{p{8.91em}|}{差值的 95\% 置信区间} & & & \\
\cline{6-7} \multicolumn{2}{|l|}{} & & & & \multicolumn{1}{p{4.455em}|}{下限} & \multicolumn{1}{p{4.455em}|}{上限} & & & \\
\hline
配对 1 & 预测值 - 实际值 & -0.2427333 & 1.5138139 & 0.8740009 & -4.0032556 & 3.517789 & -0.278 & 2 & 0.807 \\
\hline
\end{tabular}%
}
\label{tab:addlabel}%
\end{table}%