我想要一个包含许多表格的表格。我也想要它的标题。MTab1 和 2 是单列和单行矩阵。Mtab1 和 2 的长度应等于 T1 和 T2。这意味着 MTab1 的行 = T1 的 7 行
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\begin{landscape}
\begin{tabular}{l l l}
MTab1 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\ MTab2 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\
\caption{This table shows some data}
\end{tabular}
\end{landscape}
\end{document}
% 内容 Mat1_out.text
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.55&0.24&0.35&0.75\\\hline
\textbf{row 2}&0.14&0.93&0.83&0.38\\\hline
\textbf{row 3}&0.15&0.35&0.59&0.57\\\hline
\textbf{row 4}&0.26&0.20&0.55&0.08\\\hline
\textbf{row 5}&0.84&0.25&0.92&0.05\\\hline
\textbf{row 6}&0.25&0.62&0.29&0.53\\\hline
\textbf{row 7}&0.81&0.47&0.76&0.78\\\hline
\end{tabular}
\end{tiny}
%Mat2_out.tex
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.93&0.79&0.69&0.83\\\hline
\textbf{row 2}&0.13&0.31&0.75&0.54\\\hline
\textbf{row 3}&0.57&0.53&0.45&1.00\\\hline
\textbf{row 4}&0.47&0.17&0.08&0.08\\\hline
\textbf{row 5}&0.01&0.60&0.23&0.44\\\hline
\textbf{row 6}&0.34&0.26&0.91&0.11\\\hline
\textbf{row 7}&0.16&0.65&0.15&0.96\\\hline
\end{tabular}
\end{tiny}
% latextable2.tex
\begin{table}
\begin{tabular}{|l|}
\hline
MTab1\\ \hline
Matb2 \\
\hline
\end{tabular}
\end{table}
答案1
这是评论中讨论的一个版本,添加了框架和标题。我不确定我是否真的喜欢它,但我认为这是要求的:
为了消除第 2 列和第 3 列之间的间隙,@{}
添加了列规范以删除列之间添加的。这也需要在子表中\tabcolsep
添加尾随以消除否则会引入的虚假空间。%
代码:
\documentclass[pdftex,12pt,a4paper]{report}
\usepackage{lscape}
\usepackage{filecontents}
\begin{filecontents*}{latextable2.tex}
\begin{table}
\begin{tabular}{|l|}
\hline
MTab1\\ \hline
Matb2 \\
\hline
\end{tabular}
\end{table}
\end{filecontents*}
\begin{filecontents*}{Mat1_out.tex}
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.55&0.24&0.35&0.75\\\hline
\textbf{row 2}&0.14&0.93&0.83&0.38\\\hline
\textbf{row 3}&0.15&0.35&0.59&0.57\\\hline
\textbf{row 4}&0.26&0.20&0.55&0.08\\\hline
\textbf{row 5}&0.84&0.25&0.92&0.05\\\hline
\textbf{row 6}&0.25&0.62&0.29&0.53\\\hline
\textbf{row 7}&0.81&0.47&0.76&0.78\\\hline
\end{tabular}%
\end{tiny}%
\end{filecontents*}
\begin{filecontents*}{Mat2_out.tex}
\begin{tiny}\begin{tabular}{|l|c|c|c|c|}
\hline
&\textbf{col 1}&\textbf{col 2}&\textbf{col 3}&\textbf{col 4}\\\hline
\textbf{row 1}&0.93&0.79&0.69&0.83\\\hline
\textbf{row 2}&0.13&0.31&0.75&0.54\\\hline
\textbf{row 3}&0.57&0.53&0.45&1.00\\\hline
\textbf{row 4}&0.47&0.17&0.08&0.08\\\hline
\textbf{row 5}&0.01&0.60&0.23&0.44\\\hline
\textbf{row 6}&0.34&0.26&0.91&0.11\\\hline
\textbf{row 7}&0.16&0.65&0.15&0.96\\\hline
\end{tabular}%
\end{tiny}%
\end{filecontents*}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\begin{landscape}
\begin{table}
\centering\renewcommand{\arraystretch}{1.2}%
\begin{tabular}{| l@{} l@{} l@{}|}\hline
MTab1 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\
MTab2 & \input{./Mat1_out.tex} & \input{./Mat2_out.tex}\\\hline
\end{tabular}
\caption{Caption for main table}
\end{table}
\end{landscape}
\end{document}