在 LaTeX 表中垂直对齐单元格

在 LaTeX 表中垂直对齐单元格

我创建了下表,但我希望“作者姓名”、“年份”和其他相关内容在单元格内垂直居中。

我正在使用 Sage Latex 模板:点击此处下载

\begin{table}[H]
\caption{previously published works on the field of sensitivity analysis of WT}\label{tab:literature1}
\centering
\renewcommand{\arraystretch}{1.3}
\resizebox{\textwidth}{!}{
\begin{tabular}{p{1.5cm}cccp{3.2cm}p{6cm}}
\toprule%
\textbf{Author}     & \textbf{Publisher} & \textbf{Year}  &  \textbf{Method} & \multicolumn{1}{c}{\textbf{WS range}} &  \multicolumn{1}{c}{\textbf{Aim and key points}} \\ 
\midrule
Kusiak      & ASME    & 2010 & GSA & In three WS categories: 3.5-7, 7-12, and 12-15 m/s & Investigated the relationship between vibrations and various wind turbine parameters \\
\midrule
McKay  & Wiley  & 2014 & GSA & Changing & Base on Extended Fourier amplitude sensitivity, and explored parameter changes in the WTs.  \\ 
\midrule
Ziegler & Elsevier   & 2015  & L/GSA & -- & Identified mean sea level (MSL) and wave peak period (Tp) as significant factors influencing fatigue loads, using both LSA and GSA.  \\
\midrule
Alavi   & Elsevier & 2016 & GSA & changing & Explored sensitivity in four wind speed models, considering the accuracy of measured wind data and evaluating goodness-of-fit with nine metrics.   \\
\midrule
Echeverría   & Wiley & 2017 & GSA & Changing 3 to 14 m/s & Used for screening to simplify complex models and provided a list of non-affecting variables. \\
\midrule
Hübler   & Elsevier & 2017 & GSA & Two wind speeds of 11 and 35 m/s &  Proposed a new four-step sensitivity analysis technique, aiming for a balance between computational efficiency and model complexity.  \\
\midrule
Robertson, Shaler   & Copernicus & 2019-21 & GSA &  &   Utilized the elementary effect method to study parameters influencing turbine loads. \\
\midrule
Carta   & Elsevier & 2020 & GSA & changing &  Investigated uncertainties in parameters and found that wind speed, active power set-point, and turbulence intensity accounted for over 98\% of the response model variation.  \\
\midrule
Moghadam   & Elsevier & 2021 & LSA & Average of 11 m/s & Utilized local sensitivity analysis based on partial derivatives to simplify and derive a closed-form expression.   \\
\midrule
Biazar   & Wiley & 2022 & GSA & In two regions of FL with a speed of 22 m/s and PL with a speed of 11 m/s &  Examined sensor bias errors on wind turbines using the Monte Carlo method in different regions. In the PL region, errors affect all sensors similarly, especially impacting power output. However, in the FL region, the generator speed sensor error has the most significant impact on WT power output.  \\
\midrule
\multicolumn{3}{c}{Current study}  & GSA & Changing continuously 5 to 20 m/s which include both PL and FL regions &   Focus on the precision of the sensors of a wind turbine in order to \\
\bottomrule
\end{tabular}
}
\end{table}

在此处输入图片描述

请帮我解决

答案1

这很简单:只需将您的p展示位置参数更改为m。要使用此选项,您需要加载大批包裹。

因此,表格的开始部分将是这样的:

\begin{tabular}{@{}m{1.5cm}cccm{3.2cm}m{6cm}@{}}

您的 MWE 不太清楚,但我根据经验了解您的问题。

\documentclass[10pt]{report}

% packages that the user has forgotten to mention in his question
\usepackage{anysize}
\usepackage{graphicx}
\usepackage{booktabs}

% load these two packages
\usepackage{array}
\usepackage{float}

\begin{document}
\begin{table}[H]
\caption{previously published works on the field of sensitivity analysis of WT}\label{tab:literature1}
\centering
\renewcommand{\arraystretch}{1.3}
\resizebox{\textwidth}{!}{
\begin{tabular}{@{}m{1.5cm}cccm{3.2cm}m{6cm}@{}}
\toprule%
\textbf{Author}     & \textbf{Publisher} & \textbf{Year}  &  \textbf{Method} & \multicolumn{1}{c}{\textbf{WS range}} &  \multicolumn{1}{c}{\textbf{Aim and key points}} \\ 
\midrule
Kusiak      & ASME    & 2010 & GSA & In three WS categories: 3.5-7, 7-12, and 12-15 m/s & Investigated the relationship between vibrations and various wind turbine parameters \\
\midrule
McKay  & Wiley  & 2014 & GSA & Changing & Base on Extended Fourier amplitude sensitivity, and explored parameter changes in the WTs.  \\ 
\midrule
Ziegler & Elsevier   & 2015  & L/GSA & -- & Identified mean sea level (MSL) and wave peak period (Tp) as significant factors influencing fatigue loads, using both LSA and GSA.  \\
\midrule
Alavi   & Elsevier & 2016 & GSA & changing & Explored sensitivity in four wind speed models, considering the accuracy of measured wind data and evaluating goodness-of-fit with nine metrics.   \\
\midrule
Echeverría   & Wiley & 2017 & GSA & Changing 3 to 14 m/s & Used for screening to simplify complex models and provided a list of non-affecting variables. \\
\midrule
Hübler   & Elsevier & 2017 & GSA & Two wind speeds of 11 and 35 m/s &  Proposed a new four-step sensitivity analysis technique, aiming for a balance between computational efficiency and model complexity.  \\
\midrule
Robertson, Shaler   & Copernicus & 2019-21 & GSA &  &   Utilized the elementary effect method to study parameters influencing turbine loads. \\
\midrule
Carta   & Elsevier & 2020 & GSA & changing &  Investigated uncertainties in parameters and found that wind speed, active power set-point, and turbulence intensity accounted for over 98\% of the response model variation.  \\
\midrule
Moghadam   & Elsevier & 2021 & LSA & Average of 11 m/s & Utilized local sensitivity analysis based on partial derivatives to simplify and derive a closed-form expression.   \\
\midrule
Biazar   & Wiley & 2022 & GSA & In two regions of FL with a speed of 22 m/s and PL with a speed of 11 m/s &  Examined sensor bias errors on wind turbines using the Monte Carlo method in different regions. In the PL region, errors affect all sensors similarly, especially impacting power output. However, in the FL region, the generator speed sensor error has the most significant impact on WT power output.  \\
\midrule
\multicolumn{3}{c}{Current study}  & GSA & Changing continuously 5 to 20 m/s which include both PL and FL regions &   Focus on the precision of the sensors of a wind turbine in order to \\
\bottomrule
\end{tabular}
}
\end{table}
\end{document}

输出:

垂直居中行

为您SAGE 模板只需在命令中使用\columnwidth而不是 即可。或者,您可以使用不带选项的表环境的启动版本 ( ) 。\textwidth\resizebox\begin{table*}...\end{table*}[H]

答案2

  • 缩放表格大小并不是一个好主意。使用它会导致表格字体大小不一致,从而导致文档排版不佳。更好的方法是定义表格主体中使用的较小字体大小(例如,\small如下面的示例所示)。
  • 提供的 MWE(最小工作示例)中的表格设计比期望的要好得多。我只会删除\midrule表格主体中的 s。
  • 对于表,我宁愿使用tabularray包。使用它的表代码更短更简单:
\documentclass{article}
\usepackage{geometry}   % for determining page layout, which is unknown
\usepackage[skip=1ex]{caption}
\usepackage{microtype}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\sisetup{range-units = single,
         per-mode = symbol,
         range-phrase = - }


\begin{document}
    \begin{table}[ht]
\caption{previously published works on the field of sensitivity analysis of WT}
\label{tab:literature1}
    \small
\begin{tblr}{hline{1,Z} = 1pt, hline{2}=0.5pt, 
             colsep  = 3pt,
             colspec = {@{} Q[l, wd=16mm] ccc  
                            Q[l, wd=32mm, cmd={\linespread{0.84}\relax}] 
                            X[j, cmd={\linespread{0.84}\relax}]  @{}},
             row{1}  = {font=\bfseries}
             }
Author      & Publisher     & Year  & Method    & WS range  & Aim and key points        \\
Kusiak      & ASME          & 2010  & GSA       & In three WS categories: 3.5-7, 7-12, and \qtyrange{12}{15}{\metre\per\second} 
                                                            & Investigated the relationship between vibrations
                                                              and various wind turbine parameters \\
McKay       & Wiley         & 2014  & GSA       & Changing  & Base on Extended Fourier amplitude sensitivity, 
                                                              and explored parameter changes in the WTs.  \\
Ziegler     & Elsevier      & 2015  & L/GSA     & --        & Identified mean sea level (MSL)
                                                              and wave peak period (Tp) as significant factors influencing fatigue loads, using both LSA and GSA.  \\
Alavi       & Elsevier      & 2016  & GSA       & changing  & Explored sensitivity in four wind speed models, considering
                                                              the accuracy of measured wind data and evaluating goodness-of-fit with nine metrics.   \\
Echeverría  & Wiley         & 2017  & GSA       & Changing \qtyrange{3}{14}{\metre\per\second}
                                                            & Used for screening to simplify complex models and provided a list
                                                              of non-affecting variables. \\
Hübler      & Elsevier      & 2017  & GSA       & Two wind speeds of \qtyrange{11}{35}{\metre\per\second}
                                                            & Proposed a new four-step sensitivity analysis technique, aiming for
                                                              a balance between computational efficiency and model complexity.  \\
Robertson, Shaler
            & Copernicus    & 2019-21 & GSA     &           & Utilized the elementary effect method to study parameters
                                                              influencing turbine loads. \\
Carta       & Elsevier      & 2020      & GSA   & changing  & Investigated uncertainties in parameters and found that wind speed,
                                                              active power set-point, and turbulence intensity accounted for over \qty{98}{\percent} of the response model variation.  \\
Moghadam   & Elsevier       & 2021      & LSA   & Average of 11 m/s
                                                            & Utilized local sensitivity analysis based on partial derivatives to
                                                              simplify and derive a closed-form expression.   \\
Biazar      & Wiley         & 2022      & GSA   & In two regions of FL with a speed of \qty{22}{\metre\per\second} 
                                                  and PL with a speed of \qty{11}{\metre\per\second}
                                                            & Examined sensor bias errors on wind turbines using the Monte Carlo method in different regions. In the PL region, errors affect all sensors similarly, especially impacting power output. However, in the FL region, the generator speed sensor error has the most significant impact on WT power output.  \\
\SetCell[c=3]{l}   Current study
            &               &           & GSA   & Changing continuously \qtyrange{5}{20}{\metre\per\second} which include both PL
                                                  and FL regions
                                                            & Focus on the precision of the sensors of a wind turbine in order to \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

但是,如果您坚持要垂直居中单元格的内容,那么您在上面的 MWE 中只需要将表格序言更改为:

\begin{tblr}{hline{1,Z} = 1pt, hline{2}=0.5pt, hline{3-Y} = {solid},
             colsep  = 3pt,
             colspec = {@{} Q[l, m, wd=16mm] ccc  
                            Q[l, m, wd=32mm, cmd={\linespread{0.84}\relax}] 
                            X[j, m, cmd={\linespread{0.84}\relax}]  @{}},
             row{1}  = {font=\bfseries}
             }

结果是(我认为不太好):

在此处输入图片描述

相关内容