如何让表格的高度变小?

如何让表格的高度变小?

我有一份包含 3 个表格的文档。这些表格看起来非常漂亮,但我有一个问题:它们太高了,所以它们会与脚注重叠!

我尝试过减小表格内字母的大小,但没有效果,而且我不能更改文档的字体大小(必须为 12pt)。

我怎样才能解决这个问题?

以下是 MWE:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[margin=2.54cm]{geometry}
\usepackage{graphicx,booktabs,tabularx}
\usepackage[table]{xcolor}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{document}


\begin{table}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  60    &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  120   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  240   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   69  &   9   &       \\ \cline{ 2- 3}
  480   &   69  &   9   &   16.67   \\ \cline{ 2- 3}
    &   92  &   32  &       \\ \hline
    &   159     &   99  &       \\ \cline{ 2- 3}
  1000  &   173     &   113     &   109.67  \\ \cline{ 2- 3}
    &   177     &   117     &       \\ \hline
    &   391     &   331     &       \\ \cline{ 2- 3}
  2000  &   383     &   323     &   311.00  \\ \cline{ 2- 3}
    &   339     &   279     &       \\ \hline
    &   561     &   501     &       \\ \cline{ 2- 3}
  4000  &   631     &   501     &   512.33  \\ \cline{ 2- 3}
    &   595     &   535     &       \\ \hline
\end{tabularx}
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp6}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   88  &   28  &       \\ \cline{ 2- 3}
  60    &   88  &   28  &   28.00   \\ \cline{ 2- 3}
    &   88  &   28  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  120   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  240   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   108     &   48  &       \\ \cline{ 2- 3}
  480   &   109     &   49  &   49.00   \\ \cline{ 2- 3}
    &   110     &   50  &       \\ \hline
    &   188     &   128     &       \\ \cline{ 2- 3}
  1000  &   188     &   128     &   131.00  \\ \cline{ 2- 3}
    &   197     &   137     &       \\ \hline
    &   316     &   256     &       \\ \cline{ 2- 3}
  2000  &   361     &   301     &   284.00  \\ \cline{ 2- 3}
    &   355     &   295     &       \\ \hline
    &   599     &   539     &       \\ \cline{ 2- 3}
  4000  &   617     &   557     &   542.33  \\ \cline{ 2- 3}
    &   591     &   531     &       \\ \hline
\end{tabularx}
\centering\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp7}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   118 &   58  &       \\ \cline{ 2- 3}
  60    &   117 &   57  &   57.67   \\ \cline{ 2- 3}
    &   118     &   58  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  120   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  240   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   142     &   82  &       \\ \cline{ 2- 3}
  480   &   147     &   87  &   85.67   \\ \cline{ 2- 3}
    &   148     &   88  &       \\ \hline
    &   245     &   185     &       \\ \cline{ 2- 3}
  1000  &   243     &   183     &   183.63  \\ \cline{ 2- 3}
    &   242     &   182     &       \\ \hline
    &   386     &   326     &       \\ \cline{ 2- 3}
  2000  &   363     &   303     &   313.67  \\ \cline{ 2- 3}
    &   372     &   312     &       \\ \hline
    &   647     &   587     &       \\ \cline{ 2- 3}
  4000  &   677     &   617     &   608.33  \\ \cline{ 2- 3}
    &   681     &   621     &       \\ \hline
\end{tabularx}
\label{1source_1session_1client_tables}
\caption{1 source, 1 session, 1 client middleware execution times}
\end{table}
\end{document}

答案1

您可以选择较小的字体大小:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[margin=2.54cm]{geometry}
\usepackage{graphicx,booktabs,tabularx}
\usepackage[table]{xcolor}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{document}


\begin{table}
\centering
\footnotesize
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  60    &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  120   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  240   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   69  &   9   &       \\ \cline{ 2- 3}
  480   &   69  &   9   &   16.67   \\ \cline{ 2- 3}
    &   92  &   32  &       \\ \hline
    &   159     &   99  &       \\ \cline{ 2- 3}
  1000  &   173     &   113     &   109.67  \\ \cline{ 2- 3}
    &   177     &   117     &       \\ \hline
    &   391     &   331     &       \\ \cline{ 2- 3}
  2000  &   383     &   323     &   311.00  \\ \cline{ 2- 3}
    &   339     &   279     &       \\ \hline
    &   561     &   501     &       \\ \cline{ 2- 3}
  4000  &   631     &   501     &   512.33  \\ \cline{ 2- 3}
    &   595     &   535     &       \\ \hline
\end{tabularx}\hfill
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp6}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   88  &   28  &       \\ \cline{ 2- 3}
  60    &   88  &   28  &   28.00   \\ \cline{ 2- 3}
    &   88  &   28  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  120   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  240   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   108     &   48  &       \\ \cline{ 2- 3}
  480   &   109     &   49  &   49.00   \\ \cline{ 2- 3}
    &   110     &   50  &       \\ \hline
    &   188     &   128     &       \\ \cline{ 2- 3}
  1000  &   188     &   128     &   131.00  \\ \cline{ 2- 3}
    &   197     &   137     &       \\ \hline
    &   316     &   256     &       \\ \cline{ 2- 3}
  2000  &   361     &   301     &   284.00  \\ \cline{ 2- 3}
    &   355     &   295     &       \\ \hline
    &   599     &   539     &       \\ \cline{ 2- 3}
  4000  &   617     &   557     &   542.33  \\ \cline{ 2- 3}
    &   591     &   531     &       \\ \hline
\end{tabularx}\par

\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp7}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   118 &   58  &       \\ \cline{ 2- 3}
  60    &   117 &   57  &   57.67   \\ \cline{ 2- 3}
    &   118     &   58  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  120   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  240   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   142     &   82  &       \\ \cline{ 2- 3}
  480   &   147     &   87  &   85.67   \\ \cline{ 2- 3}
    &   148     &   88  &       \\ \hline
    &   245     &   185     &       \\ \cline{ 2- 3}
  1000  &   243     &   183     &   183.63  \\ \cline{ 2- 3}
    &   242     &   182     &       \\ \hline
    &   386     &   326     &       \\ \cline{ 2- 3}
  2000  &   363     &   303     &   313.67  \\ \cline{ 2- 3}
    &   372     &   312     &       \\ \hline
    &   647     &   587     &       \\ \cline{ 2- 3}
  4000  &   677     &   617     &   608.33  \\ \cline{ 2- 3}
    &   681     &   621     &       \\ \hline
\end{tabularx}%
\caption{1 source, 1 session, 1 client middleware execution times}
\label{1source_1session_1client_tables}
\end{table}
\end{document}

在此处输入图片描述

另一个选择是将它们垂直缩小一点,\scalebox使用graphicx

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[margin=2.54cm]{geometry}
\usepackage{graphicx,booktabs,tabularx}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{graphicx}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{document}


\begin{table}
\centering
\scalebox{1}[.9]{%
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  60    &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  120   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  240   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   69  &   9   &       \\ \cline{ 2- 3}
  480   &   69  &   9   &   16.67   \\ \cline{ 2- 3}
    &   92  &   32  &       \\ \hline
    &   159     &   99  &       \\ \cline{ 2- 3}
  1000  &   173     &   113     &   109.67  \\ \cline{ 2- 3}
    &   177     &   117     &       \\ \hline
    &   391     &   331     &       \\ \cline{ 2- 3}
  2000  &   383     &   323     &   311.00  \\ \cline{ 2- 3}
    &   339     &   279     &       \\ \hline
    &   561     &   501     &       \\ \cline{ 2- 3}
  4000  &   631     &   501     &   512.33  \\ \cline{ 2- 3}
    &   595     &   535     &       \\ \hline
\end{tabularx}\hfill
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp6}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   88  &   28  &       \\ \cline{ 2- 3}
  60    &   88  &   28  &   28.00   \\ \cline{ 2- 3}
    &   88  &   28  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  120   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  240   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   108     &   48  &       \\ \cline{ 2- 3}
  480   &   109     &   49  &   49.00   \\ \cline{ 2- 3}
    &   110     &   50  &       \\ \hline
    &   188     &   128     &       \\ \cline{ 2- 3}
  1000  &   188     &   128     &   131.00  \\ \cline{ 2- 3}
    &   197     &   137     &       \\ \hline
    &   316     &   256     &       \\ \cline{ 2- 3}
  2000  &   361     &   301     &   284.00  \\ \cline{ 2- 3}
    &   355     &   295     &       \\ \hline
    &   599     &   539     &       \\ \cline{ 2- 3}
  4000  &   617     &   557     &   542.33  \\ \cline{ 2- 3}
    &   591     &   531     &       \\ \hline
\end{tabularx}%
}\par

\scalebox{1}[.9]{%
\begin{tabularx}{0.45\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp7}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   118 &   58  &       \\ \cline{ 2- 3}
  60    &   117 &   57  &   57.67   \\ \cline{ 2- 3}
    &   118     &   58  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  120   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  240   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   142     &   82  &       \\ \cline{ 2- 3}
  480   &   147     &   87  &   85.67   \\ \cline{ 2- 3}
    &   148     &   88  &       \\ \hline
    &   245     &   185     &       \\ \cline{ 2- 3}
  1000  &   243     &   183     &   183.63  \\ \cline{ 2- 3}
    &   242     &   182     &       \\ \hline
    &   386     &   326     &       \\ \cline{ 2- 3}
  2000  &   363     &   303     &   313.67  \\ \cline{ 2- 3}
    &   372     &   312     &       \\ \hline
    &   647     &   587     &       \\ \cline{ 2- 3}
  4000  &   677     &   617     &   608.33  \\ \cline{ 2- 3}
    &   681     &   621     &       \\ \hline
\end{tabularx}%
}
\caption{1 source, 1 session, 1 client middleware execution times}
\label{1source_1session_1client_tables}
\end{table}
\end{document}

在此处输入图片描述

编辑:

(在 David 的回答之后)\label浮点数必须出现在之后\caption

答案2

使用较小的字体,并且不要将标签放在标题之前:-)

对于您的标题来说也.45\textwidth太窄了,更改为 .46,添加尽可能多的内容\extrarowheight以适合页面,并\bigskip在最后一张表格之前添加。

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[margin=2.54cm]{geometry}
\usepackage{graphicx,booktabs,tabularx}
\usepackage[table]{xcolor}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{document}


\begin{table}\footnotesize\centering\setlength\extrarowheight{.7pt}
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{tabularx}{0.46\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp0}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  60    &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  120   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   60  &   0   &       \\ \cline{ 2- 3}
  240   &   60  &   0   &   0.00    \\ \cline{ 2- 3}
    &   60  &   0   &       \\ \hline
    &   69  &   9   &       \\ \cline{ 2- 3}
  480   &   69  &   9   &   16.67   \\ \cline{ 2- 3}
    &   92  &   32  &       \\ \hline
    &   159     &   99  &       \\ \cline{ 2- 3}
  1000  &   173     &   113     &   109.67  \\ \cline{ 2- 3}
    &   177     &   117     &       \\ \hline
    &   391     &   331     &       \\ \cline{ 2- 3}
  2000  &   383     &   323     &   311.00  \\ \cline{ 2- 3}
    &   339     &   279     &       \\ \hline
    &   561     &   501     &       \\ \cline{ 2- 3}
  4000  &   631     &   501     &   512.33  \\ \cline{ 2- 3}
    &   595     &   535     &       \\ \hline
\end{tabularx}%
\quad
\begin{tabularx}{0.46\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp6}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   88  &   28  &       \\ \cline{ 2- 3}
  60    &   88  &   28  &   28.00   \\ \cline{ 2- 3}
    &   88  &   28  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  120   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   89  &   29  &       \\ \cline{ 2- 3}
  240   &   89  &   29  &   29.00   \\ \cline{ 2- 3}
    &   89  &   29  &       \\ \hline
    &   108     &   48  &       \\ \cline{ 2- 3}
  480   &   109     &   49  &   49.00   \\ \cline{ 2- 3}
    &   110     &   50  &       \\ \hline
    &   188     &   128     &       \\ \cline{ 2- 3}
  1000  &   188     &   128     &   131.00  \\ \cline{ 2- 3}
    &   197     &   137     &       \\ \hline
    &   316     &   256     &       \\ \cline{ 2- 3}
  2000  &   361     &   301     &   284.00  \\ \cline{ 2- 3}
    &   355     &   295     &       \\ \hline
    &   599     &   539     &       \\ \cline{ 2- 3}
  4000  &   617     &   557     &   542.33  \\ \cline{ 2- 3}
    &   591     &   531     &       \\ \hline
\end{tabularx}

\bigskip

\begin{tabularx}{0.46\textwidth}{|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 4}{|c|}{\small\textcolor{white}{\textbf{1 Source, 1 Session, 1 Client, Exp7}}} \\ \hline
\rowcolor{middleware_dark_gray}
\multicolumn{1}{|C}{\scriptsize\textcolor{white}{\textbf{Mes\-sa\-ges per mi\-nu\-te per sour\-ce}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{Mid\-dle\-ware Exec. Ti\-me (s)}}} & 
\multicolumn{1}{|C}{\scriptsize\centering\textcolor{white}{\textbf{De\-lay (s)}}} & 
\multicolumn{1}{|C|}{\scriptsize\textcolor{white}{\textbf{Ave\-ra\-ge De\-lay (s)}}} \\ \hline
    &   118 &   58  &       \\ \cline{ 2- 3}
  60    &   117 &   57  &   57.67   \\ \cline{ 2- 3}
    &   118     &   58  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  120   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   119     &   59  &       \\ \cline{ 2- 3}
  240   &   119     &   59  &   59.00   \\ \cline{ 2- 3}
    &   119     &   59  &       \\ \hline
    &   142     &   82  &       \\ \cline{ 2- 3}
  480   &   147     &   87  &   85.67   \\ \cline{ 2- 3}
    &   148     &   88  &       \\ \hline
    &   245     &   185     &       \\ \cline{ 2- 3}
  1000  &   243     &   183     &   183.63  \\ \cline{ 2- 3}
    &   242     &   182     &       \\ \hline
    &   386     &   326     &       \\ \cline{ 2- 3}
  2000  &   363     &   303     &   313.67  \\ \cline{ 2- 3}
    &   372     &   312     &       \\ \hline
    &   647     &   587     &       \\ \cline{ 2- 3}
  4000  &   677     &   617     &   608.33  \\ \cline{ 2- 3}
    &   681     &   621     &       \\ \hline
\end{tabularx}

\caption{1 source, 1 session, 1 client middleware execution times\label{1source_1session_1client_tables}}
\end{table}
\end{document}


\documentclass{article}

\setlength\textwidth{.5\textwidth}
\usepackage[english]{babel}
\begin{document}



\newcommand\zz[2]{\begin{tabular}[t]{@{}c@{}}#1\\\itshape#2\\\end{tabular}}

\noindent\parbox[t]{\linewidth}{%
\setlength\baselineskip{2\baselineskip}%
This some  text that I want to flow.
This should  be a  whole  separate  sentence 
This some more  text that I want to flow.
This should  be a  whole  newseparate  sentence}%
\hspace{-\linewidth}%
\raisebox{-\baselineskip}{\parbox[t]{\linewidth}{%
\setlength\baselineskip{2\baselineskip}%
\itshape
Different text that gets stuck in the intervening lines.
Different text that gets stuck in the intervening lines.
Different text that gets stuck in the intervening lines.}}

\end{document} 

相关内容