表格中的中间垂直对齐而不是顶部对齐

表格中的中间垂直对齐而不是顶部对齐

我试图将表格中的文本对齐到中间而不是顶部。如下图所示,“纵向导数”、“横向导数”、“维度”和“无维度”这些词都触及单元格的顶部,而不是位于中间。

在此处输入图片描述

我的表格的代码如下:

\begin{table}[H]
    \centering
    \caption{\label{tab:derivative} Stability derivatives for chosen wing design}
    \vspace{5pt}
        \begin{tabular}{|ll|ll|l|ll|ll|}
            \cline{1-4} \cline{6-9}
            \multicolumn{4}{|l|}{Longitudinal Derivatives}                          &  & \multicolumn{4}{l|}{Lateral Derivatives}                               \\ \cline{1-4} \cline{6-9} 
            \multicolumn{2}{|l|}{Dimensional} & \multicolumn{2}{l|}{Nondimensional} &  & \multicolumn{2}{l|}{Dimensional} & \multicolumn{2}{l|}{Nondimensional} \\ \cline{1-4} \cline{6-9} 
            $X_u$         & -0.4859           & $C_{X_u}$            & -0.072023    &  & $Y_v$         & -1.4526          & $C_{Y_{\beta}}$     & -0.21531      \\
            $X_w$         & 3.7512            & $C_{X_{\alpha}}$     & 0.55602      &  & $Y_p$         & -0.47694         & $C_{Y_p}$           & -0.070706     \\
            $X_q$         & 0.0000                 & $C_{X_q}$            & 0.0000            &  & $Y_r$         & 0.98276          & $C_{Y_r}$           & 0.14569       \\
            $Z_u$         & -11.82            & $C_{Z_u}$            & -0.011068    &  & $L_v$         & -0.72589         & $C_{L_{\beta}}$     & -0.053806     \\
            $Z_w$         & -47.489           & $C_{Z_{\alpha}}$     & 7.0392       &  & $L_p$         & -8.6412          & $C_{L_p}$           & -0.64062      \\
            $Z_q$         & -11.547           & $C_{Z_q}$            & 22.005       &  & $L_r$         & 3.1536           & $C_{L_r}$           & 0.23379       \\
            $M_u$         & 0.0026819         & $C_{M_u}$            & 0.0025556    &  & $N_v$         & 0.76742          & $C_{N_{\beta}}$     & 0.056885      \\
            $M_w$         & -4.4338           & $C_{M_{\alpha}}$     & -4.2249      &  & $N_p$         & -1.4856          & $C_{N_p}$           & -0.11014      \\
            $M_q$         & -4.6375           & $C_{M_q}$            & -56.816      &  & $N_r$         & -0.45003         & $C_{N_r}$           & -0.033363     \\ \cline{1-4} \cline{6-9} 
        \end{tabular}
\end{table}

答案1

那里通过插入适当大小的印刷支柱来直接实现你所述的目标;例如,这个答案.(无耻的自我引用警告!)

但是,我认为您最好采用不同的方法:通过删除所有垂直线并用包的规则绘制宏替换\hline和来使表格看起来更开放。我认为 (a) 将四个数据列中的数字与小数点对齐以及 (b) 在第 3 行和第 6 行之后引入一些额外的(垂直)空白也是一个好主意。\clinebooktabs

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage{siunitx}  % for 'S' column type
\newcolumntype{L}{>{$}l<{$}} % left-aligned, automatic math mode
\newcolumntype{T}[1]{S[table-format=#1]}
\sisetup{group-digits=false}

\begin{document}
\begin{table}
\caption{Stability derivatives for chosen wing design}
\label{tab:derivative}

\setlength\extrarowheight{1pt} % optional
\setlength\tabcolsep{0pt} % let LaTeX figure out intercolumn whitespace amounts
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
   LT{-2.7} LT{-2.7} LT{-1.5} LT{-1.6} }
%\toprule
\cmidrule[\heavyrulewidth]{1-4} \cmidrule[\heavyrulewidth]{5-8}
\multicolumn{4}{c}{Longitudinal Derivatives} & \multicolumn{4}{c}{Lateral Derivatives} \\ 
\cmidrule{1-4} \cmidrule{5-8} 
\multicolumn{2}{c}{Dimensional} & \multicolumn{2}{c}{Nondimensional} & 
\multicolumn{2}{c}{Dimensional} & \multicolumn{2}{c}{Nondimensional} \\ 
\cmidrule{1-2} \cmidrule{3-4} \cmidrule{5-6} \cmidrule{7-8} 
X_u & -0.4859   & C_{X_u}        & -0.072023 & Y_v & -1.4526  & C_{Y_{\beta}} & -0.21531  \\
X_w & 3.7512    & C_{X_{\alpha}} & 0.55602   & Y_p & -0.47694 & C_{Y_p}       & -0.070706 \\
X_q & 0.0000    & C_{X_q}        & 0.0000    & Y_r &  0.98276 & C_{Y_r}       & 0.14569   \\
\addlinespace
Z_u & -11.82    & C_{Z_u}        & -0.011068 & L_v & -0.72589 & C_{L_{\beta}} & -0.053806 \\
Z_w & -47.489   & C_{Z_{\alpha}} & 7.0392    & L_p & -8.6412  & C_{L_p}       & -0.64062  \\
Z_q & -11.547   & C_{Z_q}        & 22.005    & L_r &  3.1536  & C_{L_r}       & 0.23379   \\
\addlinespace
M_u & 0.0026819 & C_{M_u}        & 0.0025556 & N_v &  0.76742 & C_{N_{\beta}} & 0.056885  \\
M_w & -4.4338   & C_{M_{\alpha}} & -4.2249   & N_p & -1.4856  & C_{N_p}       & -0.11014  \\
M_q & -4.6375   & C_{M_q}        & -56.816   & N_r & -0.45003 & C_{N_r}       & -0.033363 \\
%\bottomrule
\cmidrule[\heavyrulewidth]{1-4} \cmidrule[\heavyrulewidth]{5-8}
\end{tabular*}
\end{table}
\end{document}

答案2

还有一种基于cellspace包的解决方案,它在以字母为前缀的说明符的单元格中定义最小垂直填充,或者当像这里一样加载时,S您可以选择另一个作为包选项 。siunitx

我对布局添加了各种小改进,删除了第一行并加载 caption以轻松定制标题的布局。

\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage[column=O]{cellspace}
\setlength{\cellspacetoplimit}{4pt}
\setlength{\cellspacebottomlimit}{4pt}
\usepackage{caption}
\captionsetup{labelfont=sc, textfont=it, skip=6pt}
\usepackage{siunitx}

\begin{document}

\begin{table} [!htb]
\sisetup{table-format=-2.7, table-number-alignment=center}
    \centering
    \caption{\label{tab:derivative} Stability derivatives for chosen wing design}
        \begin{tabular}{|OlS|lS|l|lS[table-format=-1.5]|lS[table-format=-1.6]|}
            \multicolumn{4}{c}{Longitudinal Derivatives} &\multicolumn{1}{c}{} & \multicolumn{4}{c}{Lateral Derivatives} \\ \cline{1-4} \cline{6-9}
            \multicolumn{2}{|Oc|}{Dimensional} & \multicolumn{2}{Oc|}{Nondimensional} & & \multicolumn{2}{Oc|}{Dimensional} & \multicolumn{2}{Oc|}{Nondimensional} \\ \cline{1-4} \cline{6-9}
            $X_u$ & -0.4859 & $C_{X_u}$ & -0.072023 & & $Y_v$ & -1.4526 & $C_{Y_{\beta}}$ & -0.21531 \\
            $X_w$ & 3.7512 & $C_{X_{\alpha}}$ & 0.55602 & & $Y_p$ & -0.47694 & $C_{Y_p}$ & -0.070706 \\
            $X_q$ & 0.0000 & $C_{X_q}$ & 0.0000 & & $Y_r$ & 0.98276 & $C_{Y_r}$ & 0.14569 \\[1ex]
            $Z_u$ & -11.82 & $C_{Z_u}$ & -0.011068 & & $L_v$ & -0.72589 & $C_{L_{\beta}}$ & -0.053806 \\
            $Z_w$ & -47.489 & $C_{Z_{\alpha}}$ & 7.0392 & & $L_p$ & -8.6412 & $C_{L_p}$ & -0.64062 \\
            $Z_q$ & -11.547 & $C_{Z_q}$ & 22.005 & & $L_r$ & 3.1536 & $C_{L_r}$ & 0.23379 \\[1ex]
            $M_u$ & 0.0026819 & $C_{M_u}$ & 0.0025556 & & $N_v$ & 0.76742 & $C_{N_{\beta}}$ & 0.056885 \\
            $M_w$ & -4.4338 & $C_{M_{\alpha}}$ & -4.2249 & & $N_p$ & -1.4856 & $C_{N_p}$ & -0.11014 \\
            $M_q$ & -4.6375 & $C_{M_q}$ & -56.816 & & $N_r$ & -0.45003 & $C_{N_r}$ & -0.033363 \\ \cline{1-4} \cline{6-9}
        \end{tabular}
\end{table}

\end{document} 

在此处输入图片描述

答案3

您可以将其\renewcommand*{\arraystretch}{1.1}放入您的表中。

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{table}[h]
\renewcommand*{\arraystretch}{1.1} %%% <------------------
    \centering
    \caption{\label{tab:derivative} Stability derivatives for chosen wing design}
    \vspace{5pt}
        \begin{tabular}{|ll|ll|l|ll|ll|}
            \cline{1-4} \cline{6-9}
            \multicolumn{4}{|l|}{Longitudinal Derivatives}                          &  & \multicolumn{4}{l|}{Lateral Derivatives}                               \\ \cline{1-4} \cline{6-9} 
            \multicolumn{2}{|l|}{Dimensional} & \multicolumn{2}{l|}{Nondimensional} &  & \multicolumn{2}{l|}{Dimensional} & \multicolumn{2}{l|}{Nondimensional} \\ \cline{1-4} \cline{6-9} 
            $X_u$         & -0.4859           & $C_{X_u}$            & -0.072023    &  & $Y_v$         & -1.4526          & $C_{Y_{\beta}}$     & -0.21531      \\
            $X_w$         & 3.7512            & $C_{X_{\alpha}}$     & 0.55602      &  & $Y_p$         & -0.47694         & $C_{Y_p}$           & -0.070706     \\
            $X_q$         & 0.0000                 & $C_{X_q}$            & 0.0000            &  & $Y_r$         & 0.98276          & $C_{Y_r}$           & 0.14569       \\
            $Z_u$         & -11.82            & $C_{Z_u}$            & -0.011068    &  & $L_v$         & -0.72589         & $C_{L_{\beta}}$     & -0.053806     \\
            $Z_w$         & -47.489           & $C_{Z_{\alpha}}$     & 7.0392       &  & $L_p$         & -8.6412          & $C_{L_p}$           & -0.64062      \\
            $Z_q$         & -11.547           & $C_{Z_q}$            & 22.005       &  & $L_r$         & 3.1536           & $C_{L_r}$           & 0.23379       \\
            $M_u$         & 0.0026819         & $C_{M_u}$            & 0.0025556    &  & $N_v$         & 0.76742          & $C_{N_{\beta}}$     & 0.056885      \\
            $M_w$         & -4.4338           & $C_{M_{\alpha}}$     & -4.2249      &  & $N_p$         & -1.4856          & $C_{N_p}$           & -0.11014      \\
            $M_q$         & -4.6375           & $C_{M_q}$            & -56.816      &  & $N_r$         & -0.45003         & $C_{N_r}$           & -0.033363     \\ \cline{1-4} \cline{6-9} 
        \end{tabular}
\end{table}

\end{document}

在此处输入图片描述

答案4

还有一种可能性:使用tabularraysiunitx包:-):

\documentclass{article}
\usepackage{amsmath}
\usepackage[skip=1ex]{caption}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\NewColumnType{C}{>{$}c<{$}}

\begin{document}
    \begin{table}
    \centering
    \caption{Stability derivatives for chosen wing design}
    \label{tab:derivative} 
\begin{tblr}{vlines,
             colspec={C S[table-format=-2.7] C S[table-format=-2.7] c
                      C S[table-format=-2.7] C S[table-format=-2.7]}
             }
    \cline[1pt]{1-4} \cline[1pt]{6-9}
\SetCell[c=4]{c} \text{Longitudinal Derivatives} 
  &&&&  & \SetCell[c=4]{c} \text{Lateral Derivatives}
            &&&                                         \\
    \cline{1-4} \cline{6-9}
\SetCell[c=2]{c} \text{Dimensional} &&
    \SetCell[c=2]{c} \text{Nondimensional}  &&  &
        \SetCell[c=2]{c} \text{Dimensional} &&
            \SetCell[c=2]{c} \text{Nondimensional}  &  \\
    \cline[0.6pt]{1-4} \cline[0.6pt]{6-9}
X_u  & - 0.4859     & C_{X_u}        & -0.072023 && Y_v  & -1.4526  & C_{Y_{\beta}} & -0.21531  \\
X_w  &   3.7512     & C_{X_{\alpha}} & 0.55602   && Y_p  & -0.47694 & C_{Y_p}       & -0.070706 \\
X_q  &   0.0000     & C_{X_q}        & 0.0000    && Y_r  &  0.98276 & C_{Y_r}       &  0.14569  \\
Z_u  & -11.82       & C_{Z_u}        & -0.011068 && L_v  & -0.72589 & C_{L_{\beta}} & -0.053806 \\
Z_w  & -47.489      & C_{Z_{\alpha}} & 7.0392    && L_p  & -8.6412  & C_{L_p}       & -0.64062  \\
Z_q  & -11.547      & C_{Z_q}        & 22.005    && L_r  &  3.1536  & C_{L_r}       &  0.23379  \\
M_u  &   0.0026819  & C_{M_u}        & 0.0025556 && N_v  &  0.76742 & C_{N_{\beta}} &  0.056885 \\
M_w  & - 4.4338     & C_{M_{\alpha}} & -4.2249   && N_p  & -1.4856  & C_{N_p}       & -0.11014  \\
M_q  & - 4.6375     & C_{M_q}        & -56.816   && N_r  & -0.45003 & C_{N_r}       & -0.033363 \\
    \cline[1pt]{1-4} \cline[1pt]{6-9}
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

相关内容