如何在一个表中复制内容并使其看起来像这样:
我不要两张桌子,我只想要一张桌子
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}[]{V{4}p{25mm}|c|c|cV{4}}
\hlineB{4}
\multicolumn{4}{V{4}cV{4}}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hlineB{3}
\end{tabular}
\endgroup
\end{document}
我的目的是:我怎样才能把最厚的侧边放好?
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}{|p{25mm}|c|c|c|p{25mm}|c|c|c|}
\hlineB{3}
\hline
\multicolumn{4}{|c|}{aaaaa} & \multicolumn{4}{c|}{aaaaa} \\ \hline
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hline
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hline
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hlineB{4}
\end{tabular}
\endgroup
\end{document}
答案1
原始答案
没有解决原帖者的问题
照常进行:
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}[]{V{4}p{25mm}|c|c|cV{4}}
\hlineB{4}
\multicolumn{4}{V{4}cV{4}}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hlineB{3}
\end{tabular}
\endgroup
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}[]{V{4}p{25mm}|c|c|cV{4}}
\hlineB{4}
\multicolumn{4}{V{4}cV{4}}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\hlineB{3}
\end{tabular}
\endgroup
\end{document}
编辑1
由于上述方法不行,我决定尝试一种全新的方法:
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes}
\renewcommand{\arraystretch}{2.2}
\begin{document}
\begin{tikzpicture}
\node[draw,line width=2pt,inner sep=.4pt]{
\begin{tabular}{|p{25mm}|c|c|c|c|p{25mm}|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{aaaaa} & \multicolumn{5}{c|}{aaaaa} \\ \hline
\rowcolor{cyan}
1 & a1 & a2 & a3 & a4 & 1 & a1 & a2 & a3 & a4 \\ \hline
2 & a1 & a2 & a3 & a4 & 2 & a1 & a2 & a3 & a4 \\ \hline
3 & a1 & a2 & a3 & a4 & 3 & a1 & a2 & a3 & a4 \\ \hline
4 & a1 & a2 & a3 & a4 & 4 & a1 & a2 & a3 & a4 \\ \hline
5 & a1 & a2 & a3 & a4 & 5 & a1 & a2 & a3 & a4 \\ \hline
\end{tabular}
};
\end{tikzpicture}
\end{document}
编辑2
格式有细微变化。
\documentclass{article}
\usepackage[table]{xcolor}
%% NECESSARY LINE
%% Add this line to your preamble
\usepackage{tikz}
%% End of Necessary line
% Note that the table is wider than the default margin in article class. You should change
% the margin or make the table smaller.
\begin{document}
\begingroup
\begin{tikzpicture}
\renewcommand{\arraystretch}{2.2}
\node[draw,line width=2pt,inner sep=.4pt]{
\begin{tabular}{|p{25mm}|c|c|c|c|p{25mm}|c|c|c|c|}
\hline
\multicolumn{5}{|c|}{aaaaa} & \multicolumn{5}{c|}{aaaaa} \\ \hline
\rowcolor{cyan}
1 & a1 & a2 & a3 & a4 & 1 & a1 & a2 & a3 & a4 \\ \hline
2 & a1 & a2 & a3 & a4 & 2 & a1 & a2 & a3 & a4 \\ \hline
3 & a1 & a2 & a3 & a4 & 3 & a1 & a2 & a3 & a4 \\ \hline
4 & a1 & a2 & a3 & a4 & 4 & a1 & a2 & a3 & a4 \\ \hline
5 & a1 & a2 & a3 & a4 & 5 & a1 & a2 & a3 & a4 \\ \hline
\end{tabular}
};
\end{tikzpicture}
\endgroup
\end{document}
答案2
此解决方案将表格放在表格内。消除边缘的间隙很棘手。
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\sbox0{\begin{tabular}[]{@{\hspace{\tabcolsep}}p{25mm}|c|c|c@{\hspace{\tabcolsep}}}
\multicolumn{4}{c}{aaaaa} \\ % <===============================
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 \\
\hline
2 & 1e-1 & 1e-2 & 1e-2 \\
\hline
3 & 1e-1 & 1e-2 & 1e-2 \\
\hline
4 & 1e-1 & 1e-2 & 1e-2 \\
\hline
5 & 1e-1 & 1e-2 & 1e-2 \\
\end{tabular}}%
\begin{tabular}{V{4}@{}l@{}|@{}l@{}V{4}}
\hlineB{4}
\usebox0 & \usebox0 \\
\hlineB{3}
\end{tabular}
\endgroup
\end{document}
答案3
\documentclass[]{article}
\usepackage[table]{xcolor}
\usepackage{boldline}
\begin{document}
\begingroup
\def\arraystretch{2.2}%
\begin{tabular}{V{4}p{25mm}|c|c|c|p{25mm}|c|c|cV{4}}
\hlineB{3}
\hline
\multicolumn{4}{V{4}cV{1}}{aaaaa} & \multicolumn{4}{cV{4}}{aaaaa} \\ \hline
\hline
\rowcolor{cyan}
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hline
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hline
1 & 1e-1 & 1e-2 & 1e-2 & 1e-1 & 1e-2 & 1e-2 & 1e-2 \\
\hlineB{4}
\end{tabular}
\endgroup
\end{document}