请用长标题使我的桌子完美无缺

请用长标题使我的桌子完美无缺

问题:我想问一下这里的问题首先调整单元格的垂直和水平对齐方式,其次调整标题的位置以使表格看起来完美。

请帮助我。这是我现在所拥有的。

平均能量损失

\documentclass[12pt]{article}
\usepackage[a4paper,top=0.6 in,bottom=0.6 in,left=0.6 in,right=0.6 in]{geometry}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{mathtools}
\begin{document}
\large
\begin{table}[]
\caption{Skin-friction co-efficient $Re_{x^{1/2}}C_{F_x}$ with linear stretching $n=1$ and non-linear stretching $n=1.5$ at $A=0.2$, $N_{r}=0.4$, $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, $D_{f}=0.5$ and $S_{r}=1$}
\begin{tabular}{|c|c|c|c|c|cc|}
\hline
\multirow{2}{*}{$M$} & \multirow{2}{*}{$\gamma$} & \multirow{2}{*}{$\Tilde{N}$} & \multirow{2}{*}{$\lambda$} & \multirow{2}{*}{$k_{1}$} & \multicolumn{2}{c|}{$Re_{x^{1/2}}C_{F_x}$}                         \\ \cline{6-7} 
                     &                      &                      &                      &                      & \multicolumn{1}{c|}{$G$}          & $H$          \\ \hline
1.1                  & 1                    & 1                    & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.3664295040} & 0.6593644125 \\ \hline
1.2                  & 1                    & 1                    & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.3415189701} & 0.6363362691 \\ \hline
1.3                  & 1                    & 1                    & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.3101361584} & 0.6292554996 \\ \hline
1                    & 1.1                  & 1                    & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.3642452938} & 0.6515014440 \\ \hline
1                    & 1.2                  & 1                    & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.3619918988} & 0.6444405649 \\ \hline
1                    & 1                    & 1.1                  & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.4139365457} & 0.7091621892 \\ \hline
1                    & 1                    & 1.2                  & 1.2                  & 0.5                  & \multicolumn{1}{c|}{0.4613301362} & 0.7588005786 \\ \hline
1                    & 1                    & 1                    & 1.3                  & 0.5                  & \multicolumn{1}{c|}{0.4660386532} & 0.7627708751 \\ \hline
1                    & 1                    & 1                    & 1.4                  & 0.5                  & \multicolumn{1}{c|}{0.5649027509} & 0.8652549292 \\ \hline
1                    & 1                    & 1                    & 0.2                  & 0.6                  & \multicolumn{1}{c|}{0.3921955746} & 0.7029730388 \\ \hline
1                    & 1                    & 1                    & 0.2                  & 0.7                  & \multicolumn{1}{c|}{0.4025037653} & 0.7326143623 \\ \hline
\end{tabular}
\end{table}
\end{document}

答案1

我建议通过增加列间空间来给表格留出更多的空间,否则非常短的列标题会导致排版过于紧凑。

另一个改进是避免使用垂直规则\multirow:前六个标题与最后两列的公共标题处于同一级别。使用siunitx对数字表很有帮助。

注意article是为字幕设置的以下表。如果您想要反向,请加载caption

另一个建议是绝不使用\begin{document}\large;12pt 大小已经相当大了。如果您确实需要 14pt 大小,请加载extarticle

最后的细节:\Tilde与没有什么不同\tilde;对于雷诺数,使用\mathit{Re}而不是Re

\documentclass[12pt]{article}
\usepackage[a4paper,top=0.6 in,bottom=0.6 in,left=0.6 in,right=0.6 in]{geometry}

\usepackage{siunitx,booktabs,caption}

\begin{document}

\begin{table}[htp]
\centering

\caption{Skin-friction coefficient $\mathit{Re}_{x^{1/2}}C_{F_x}$ with linear 
  stretching $n=1$ and non-linear stretching $n=1.5$ at $A=0.2$, $N_{r}=0.4$, 
  $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, $D_{f}=0.5$ and $S_{r}=1$}

\setlength{\tabcolsep}{2\tabcolsep}

\begin{tabular}{
  @{}
  S[table-format=1.1]
  S[table-format=1.1]
  S[table-format=1.1]
  S[table-format=1.1]
  S[table-format=1.1]
  S[table-format=1.10]
  S[table-format=1.10]
  @{}
}
\toprule
{$M$} & {$\gamma$} & {$\tilde{N}$} & {$\lambda$} & {$k_{1}$} &
\multicolumn{2}{c}{$\mathit{Re}_{x^{1/2}}C_{F_x}$} \\
\cmidrule(l{\tabcolsep}){6-7}
&&&&& {$G$} & {$H$} \\
\midrule
1.1 & 1   & 1   & 1.2 & 0.5 & 0.3664295040 & 0.6593644125 \\
1.2 & 1   & 1   & 1.2 & 0.5 & 0.3415189701 & 0.6363362691 \\
1.3 & 1   & 1   & 1.2 & 0.5 & 0.3101361584 & 0.6292554996 \\
1   & 1.1 & 1   & 1.2 & 0.5 & 0.3642452938 & 0.6515014440 \\
1   & 1.2 & 1   & 1.2 & 0.5 & 0.3619918988 & 0.6444405649 \\
1   & 1   & 1.1 & 1.2 & 0.5 & 0.4139365457 & 0.7091621892 \\
1   & 1   & 1.2 & 1.2 & 0.5 & 0.4613301362 & 0.7588005786 \\
1   & 1   & 1   & 1.3 & 0.5 & 0.4660386532 & 0.7627708751 \\
1   & 1   & 1   & 1.4 & 0.5 & 0.5649027509 & 0.8652549292 \\
1   & 1   & 1   & 0.2 & 0.6 & 0.3921955746 & 0.7029730388 \\
1   & 1   & 1   & 0.2 & 0.7 & 0.4025037653 & 0.7326143623 \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

在此处输入图片描述

答案2

以下建议不分先后顺序:(a) 使用环境threeparttable来包围语句\captiontabular环境。这样,标题的宽度将限制为正文的宽度table。(b) 使用S列类型(由包提供siunitx)将 7 个数据列中的数字对齐到其显式或隐式小数标记上。(c) 通过摆脱所有垂直规则(是的,真的!)并使用更少但间距适当的水平规则,使表格看起来更加开放和吸引人。(d) 加载包caption并使用skip参数来控制标题下方的垂直分隔。

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage[a4paper,margin=0.6in]{geometry}
\usepackage{mathtools}
\usepackage{threeparttable} % for threeparttable environment
\usepackage{siunitx}        % for S column type
\usepackage{booktabs}       % for well-spaced horizontal rules
\usepackage[skip=0.5\baselineskip]{caption}

\begin{document}
\large %% are you sure you need this?

\begin{table}
\centering
\begin{threeparttable}

\caption{Skin-friction co-efficient $Re_{x^{1/2}}C_{F_x}$, with linear stretching 
$n=1$ and non-linear stretching $n=1.5$. Other parameter settings: 
$A=0.2$, $N_{r}=0.4$, $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, 
$D_{f}=0.5$, and $S_{r}=1$.}

\begin{tabular}{@{} *{5}{S[table-format=1.1]} 
                    *{2}{S[table-format=1.10,group-digits=false]} 
                @{}}
\toprule
{$M$} & {$\gamma$} & {$\widetilde{N}$} & {$\lambda$} & {$k_{1}$} & 
\multicolumn{2}{c}{$Re_{x^{1/2}} C_{F_x}$} \\ 
\cmidrule(l){6-7} 
& & & & & {$G$} & {$H$}  \\ 
\midrule
1.1 & 1   & 1   & 1.2 & 0.5 & 0.3664295040 & 0.6593644125 \\ 
1.2 & 1   & 1   & 1.2 & 0.5 & 0.3415189701 & 0.6363362691 \\ 
1.3 & 1   & 1   & 1.2 & 0.5 & 0.3101361584 & 0.6292554996 \\ \addlinespace
1   & 1.1 & 1   & 1.2 & 0.5 & 0.3642452938 & 0.6515014440 \\ 
1   & 1.2 & 1   & 1.2 & 0.5 & 0.3619918988 & 0.6444405649 \\ 
1   & 1   & 1.1 & 1.2 & 0.5 & 0.4139365457 & 0.7091621892 \\ 
1   & 1   & 1.2 & 1.2 & 0.5 & 0.4613301362 & 0.7588005786 \\ \addlinespace
1   & 1   & 1   & 1.3 & 0.5 & 0.4660386532 & 0.7627708751 \\ 
1   & 1   & 1   & 1.4 & 0.5 & 0.5649027509 & 0.8652549292 \\ 
1   & 1   & 1   & 0.2 & 0.6 & 0.3921955746 & 0.7029730388 \\ 
1   & 1   & 1   & 0.2 & 0.7 & 0.4025037653 & 0.7326143623 \\ 
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}

答案3

嗯,我仍然不清楚什么是“完美的餐桌”:-(。这非常依赖于意见......

一种可能性是,至少代码比你的简单得多,就是使用带有tabularray库的包(下面的 MWE 经过 2022C 版本测试)siunitx

\documentclass[12pt]{article}
\usepackage[a4paper,
            margin=0.6 in]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, siunitx}
% \usepackage{mathtools} % not needed in this example
\usepackage[skip=0.33\baselineskip]{caption}

\begin{document}
    \begin{table}[ht]
\caption{Skin-friction co-efficient $Re_{x^{1/2}}C_{F_x}$ with linear stretching $n=1$ and non-linear stretching $n=1.5$ at $A=0.2$, $N_{r}=0.4$, $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, $D_{f}=0.5$ and $S_{r}=1$}
\label{tab:???}
    \centering
\begin{tblr}{hlines, vlines,
             colspec = {*{5}{Q[c, si={table-format=1.1}]} 
                        *{2}{Q[c, si={table-format=1.10}]}},
             colsep  = 12pt,
             row{1,2}= {guard, mode=math}
             }
\SetCell[r=2]{c}    M
    & \SetCell[r=2]{c}  \gamma
            & \SetCell[r=2]{c}  \Tilde{N}
                    & \SetCell[r=2]{c}  \lambda
                            & \SetCell[r=2]{c}  k_{1}
                                    & \SetCell[c=2]{c}  Re_{x^{1/2}}C_{F_x}
                                                    &               \\
    &       &       &       &       & G             & H             \\  
1.1 & 1     & 1     & 1.2   & 0.5   & 0.3664295040  & 0.6593644125  \\ 
1.2 & 1     & 1     & 1.2   & 0.5   & 0.3415189701  & 0.6363362691  \\
1.3 & 1     & 1     & 1.2   & 0.5   & 0.3101361584  & 0.6292554996  \\
1   & 1.1   & 1     & 1.2   & 0.5   & 0.3642452938  & 0.6515014440  \\   
1   & 1.2   & 1     & 1.2   & 0.5   & 0.3619918988  & 0.6444405649  \\
1   & 1     & 1.1   & 1.2   & 0.5   & 0.4139365457  & 0.7091621892  \\ 
1   & 1     & 1.2   & 1.2   & 0.5   & 0.4613301362  & 0.7588005786  \\
1   & 1     & 1     & 1.3   & 0.5   & 0.4660386532  & 0.7627708751  \\
1   & 1     & 1     & 1.4   & 0.5   & 0.5649027509  & 0.8652549292  \\
1   & 1     & 1     & 0.2   & 0.6   & 0.3921955746  & 0.7029730388  \\
1   & 1     & 1     & 0.2   & 0.7   & 0.4025037653  & 0.7326143623  \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

但是,您可能喜欢表格的标题不比表格宽。在这种情况下,您应该使用talltblr环境,它tabularray相当于“经典” threeparttable

\documentclass[12pt]{article}
\usepackage[a4paper,
            margin=0.6 in]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, siunitx}
\usepackage[skip=0.33\baselineskip]{caption}

\begin{document}
    \begin{table}[ht]
    \centering
\begin{talltblr}[
caption = {Skin-friction co-efficient $Re_{x^{1/2}}C_{F_x}$ with linear stretching $n=1$ and non-linear stretching $n=1.5$ at $A=0.2$, $N_{r}=0.4$, $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, $D_{f}=0.5$ and $S_{r}=1$},
  label = {tab:???}
                ]{hlines, vlines,
             colspec = {*{5}{Q[c, si={table-format=1.1}]} 
                        *{2}{Q[c, si={table-format=1.10}]}},
             colsep  = 12pt,
             row{1,2}= {guard, mode=math}
             }
%% table body is the same as above

\end{talltblr}
    \end{table}
\end{document}

在此处输入图片描述

附录: 在和您的桌子的花哨版本。为了练习使用包tabularray

\documentclass[12pt]{article}
\usepackage[a4paper,
            margin=0.6 in]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs, counter, siunitx}
  \ExplSyntaxOn
\NewChildSelector{eachthree}
  {
    \int_step_inline:nnnn {6}{3}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

\usepackage[skip=0pt, 
            font = {small, sf},
            labelfont = bf,
            singlelinecheck = off
            ]{caption}

\NewTblrTheme{captionof}%
{\DefTblrTemplate{caption}{default}%
    {\addtocounter{table}{-1}%
     \captionof{table}{\InsertTblrText{caption}}%
    }
}

\begin{document}
    \begin{table}[ht]
    \centering
\begin{talltblr}[
  theme = captionof,
caption = {Skin friction coefficient $Re_{x^{1/2}}C_{F_x}$ with linear stretching $n=1$ and non-linear stretching $n=1.5$ at $A=0.2$, $N_{r}=0.4$, $H=2$, $P_{r}=0.71$, $S_{c}=0.22$, $D_{f}=0.5$ and $S_{r}=1$},
  label = {tab:???}
                ]{colspec = {*{5}{Q[c, si={table-format=1.1}]}
                             *{2}{Q[c, si={table-format=1.10}]}},
                  colsep  = 12pt,
                  row{1,2}= {guard, mode=math},
                  row{3-Z}= {rowsep=0pt},
                  row{eachthree} = {abovesep=1ex},
                 }
    \toprule
\SetCell[r=2]{c}    M
    & \SetCell[r=2]{c}  \gamma
            & \SetCell[r=2]{c}  \Tilde{N}
                    & \SetCell[r=2]{c}  \lambda
                            & \SetCell[r=2]{c}  k_{1}
                                    & \SetCell[c=2]{c}  Re_{x^{1/2}}C_{F_x}
                                                    &               \\
    \midrule
    &       &       &       &       & G             & H             \\
    \midrule
1.1 & 1     & 1     & 1.2   & 0.5   & 0.3664295040  & 0.6593644125  \\
1.2 & 1     & 1     & 1.2   & 0.5   & 0.3415189701  & 0.6363362691  \\
1.3 & 1     & 1     & 1.2   & 0.5   & 0.3101361584  & 0.6292554996  \\
1   & 1.1   & 1     & 1.2   & 0.5   & 0.3642452938  & 0.6515014440  \\
1   & 1.2   & 1     & 1.2   & 0.5   & 0.3619918988  & 0.6444405649  \\
1   & 1     & 1.1   & 1.2   & 0.5   & 0.4139365457  & 0.7091621892  \\
1   & 1     & 1.2   & 1.2   & 0.5   & 0.4613301362  & 0.7588005786  \\
1   & 1     & 1     & 1.3   & 0.5   & 0.4660386532  & 0.7627708751  \\
1   & 1     & 1     & 1.4   & 0.5   & 0.5649027509  & 0.8652549292  \\
1   & 1     & 1     & 0.2   & 0.6   & 0.3921955746  & 0.7029730388  \\
1   & 1     & 1     & 0.2   & 0.7   & 0.4025037653  & 0.7326143623  \\
    \bottomrule
\end{talltblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容