我想制作此表格(通过 Excel):
但我遇到了一些问题,尤其是合并单元格
结果如下:
我试图在原始表格中创建一个表格,但是没有用...(表格是横向的,这是正常的)
这是代码:
\documentclass[3p,11pt,authoryear]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{epstopdf,cmap,amssymb,amsfonts,amsmath,stmaryrd,mathtext,enumerate,float,natbib,indentfirst,hyperref,graphicx,multirow,color,setspace}
% lmodern used for good quality english font rendering.
\usepackage{afterpage,lscape}
\usepackage{lmodern}
\graphicspath{{figures/en/}}
\journal{Journal Title}
\begin{document}
\section{Results}
\label{sec:Results}
\afterpage{\clearpage % begin landscape tables
\begin{landscape}
\begin{table*}[!h]
\caption{Contribution of object (variables) in the individual or merged components.}
\label{tab:}
\setlength{\arrayrulewidth}{1.05 pt}
\renewcommand{\arraystretch}{1.1}
\begin{tabular*}{1.4\textwidth}{@{\extracolsep{\fill}}l *{14}{r}}
\hline \multicolumn{6}{|c|}{PCA 1} & \multirow{2}{*}{Object} & \multicolumn{6}{|c|}{PCA 2} \\
\cline{1-6} & C 1 & \textit{C 2} & \textit{C 3} & \textit{C 4} & \textit{C 1-2} & \textit{C 1-2-3}
\cline{8-14} & C 1 & \textit{C 2} & \textit{C 3} & \textit{C 4} & \textit{C 1-2} & \textit{C 1-2-3} & \textit{C 1-2-3} \\
\hline
15.6\textsuperscript{*} & 0.3 & 0.5 & 1.4 & 11.4\textsuperscript{*} & 11.9\textsuperscript{*} & 8.4\textsuperscript{*} & VESSEL & 22.1\textsuperscript{*} & 0.1 & 1.5 & 1.5 & 14.6 & 15.6 & 10.2\\
\hline
0.7 & 11.1\textsuperscript{*} & 32.5\textsuperscript{*} & 0.7 & 3.6 & 8.6\textsuperscript{*} & 8.2\textsuperscript{*} & PORT & 0.5 & 20.5\textsuperscript{*} & 23.8\textsuperscript{*} & 0.6 & 7.3 & 7.9 & 9.8\textsuperscript{*}\\
\hline
4.1 & 0.5 & 0.5 & 5.4 & 3.1 & 3.2 & 2.9 & CREW & 6.2 & 2.4 & 0.0 & 5.8 & 4.9 & 4.3 & 4.0\\
\hline{
\begin{tabular*}
17.1\textsuperscript{*} & 1.4 & 0.5 & 0.3 & 13.2\textsuperscript{*} & 13.4\textsuperscript{*} & 9.6\\
16.0\textsuperscript{*} & 1.6 & 0.6 & 0.9 & 12.0\textsuperscript{*} & 12.1\textsuperscript{*} & 8.8\textsuperscript{*}\\
17.3\textsuperscript{*} & 2.5 & 0.0 & 0.0 & 13.2\textsuperscript{*} & 13.1\textsuperscript{*} & 9.5\textsuperscript{*}\\
\end{tabular*}
} & EFFORT & 6.2 & 2.4 & 0.0 & 5.8 & 4.9 & 4.3 & 4.0
\hline
\end{tabular*}
\end{table*}
\end{landscape}
} % end landscape tables
\end{document}
答案1
这就是你想要的东西吗?
\documentclass[3p,11pt,authoryear]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{epstopdf, cmap, amssymb, , amsmath, stmaryrd, mathtext, enumerate, float, natbib, indentfirst, graphicx, multirow, color, setspace}
% lmodern used for good quality english font rendering.
\usepackage{afterpage, lscape}
\usepackage{lmodern}
\usepackage{tabularx}
\usepackage{hyperref}
\graphicspath{{figures/en/}}
\journal{Journal Title}
\begin{document}
\section{Results}
\label{sec:Results}
\afterpage{\clearpage
% begin landscape tables
\begin{landscape}
\begin{table*}[!h]
\centering
\setlength{\belowcaptionskip}{6pt}
\caption{Contribution of object (variables) in the individual or merged components.}
\label{tab:}
\setlength{\arrayrulewidth}{1.05 pt}
\renewcommand{\arraystretch}{1.25}
\setlength{\tabcolsep}{5.5pt}
\itshape
\begin{tabularx}{\linewidth}{| *{7}{c}|>{\centering}X|*{7}{c}|}
\hline \multicolumn{7}{|c|}{PCA 1} & \multirow{2}{*}{Object} & \multicolumn{7}{c|}{PCA 2} \\
\cline{1-7} \cline{9-15}
C 1 & C 2 & C 3 & C 4 & C 1-2 & C 1-2-3 & C 1-2-3-4 & & C 1 & C 2 & C 3 & C 4 & C 1-2 & C 1-2-3 & C 1-2-3-4 \\
\hline
15.6\textsuperscript{*} & 0.3 & 0.5 & 1.4 & 11.4\textsuperscript{*} & 11.9\textsuperscript{*} & 8.4\textsuperscript{*} & VESSEL & 22.1\textsuperscript{*} & 0.1 & 1.5 & 1.5 & 14.6 & 15.6 & 10.2\\
\hline
0.7 & 11.1\textsuperscript{*} & 32.5\textsuperscript{*} & 0.7 & 3.6 & 8.6\textsuperscript{*} & 8.2\textsuperscript{*} & PORT & 0.5 & 20.5\textsuperscript{*} & 23.8\textsuperscript{*} & 0.6 & 7.3 & 7.9 & 9.8\textsuperscript{*}\\
\hline
4.1 & 0.5 & 0.5 & 5.4 & 3.1 & 3.2 & 2.9 & CREW & 6.2 & 2.4 & 0.0 & 5.8 & 4.9 & 4.3 & 4.0\\
\hline
17.1\textsuperscript{*} & 1.4 & 0.5 & 0.3 & 13.2\textsuperscript{*} & 13.4\textsuperscript{*} & 9.6 & & & & & & & & \\
16.0\textsuperscript{*} & 1.6 & 0.6 & 0.9 & 12.0\textsuperscript{*} & 12.1\textsuperscript{*} & 8.8\textsuperscript{*}& EFFORT & 6.2 & 2.4 & 0.0 & 5.8 & 4.9 & 4.3 & 4.0\\
17.3\textsuperscript{*} & 2.5 & 0.0 & 0.0 & 13.2\textsuperscript{*} & 13.1\textsuperscript{*} & 9.5\textsuperscript{*} & & & & & & & & \\
\hline
\end{tabularx}
\end{table*}
\end{landscape}
}% end landscape tables
\end{document}