类似 MS Office 的表格格式

类似 MS Office 的表格格式

你好,我正在尝试创建一个像这张图这样的表格:

在此处输入图片描述

但是当我尝试这个代码时:

\documentclass[3p,onecolumn]{elsarticle}
\usepackage[labelfont=bf,singlelinecheck=false]{caption}
\usepackage{subcaption}
\usepackage{adjustbox,stackengine}
\usepackage{textcomp}
\usepackage{mathtools}
\captionsetup[table]{labelsep=newline,justification=raggedright,font=footnotesize}
\begin{document}
\begin{table}[h!]
\centering
 \caption{Statistical properties of Fourier series coefficients for the polygon base prismatic tumor.}
 \label{tabcoef1}
\begin{adjustbox}{width=0.5\textwidth}
\small
\begin{tabular}{cccc}
\hline
Parameter&$\bar{x}$&$x_{minimum}$&$x_{maximum}$\\
\hline
$w_0$  & 33.6532    &66.3456  &77.4322\\
$w_1$  & 0.45342     &0.3534     &0.45635\\
$w_2$  & 0.54234     &0.24523     &0.354524\\
$w_3$  & 0.524345     &0.35345     &0.6746\\
$w_4$  & 0.3534     &0.3563     &0.63534\\
$z_1$  & 0.35345     &0.354535    &0.53344\\
$z_2$  & 0.345345 &0.353345    &0.535059\\
$z_3$  & -0.345&0.345345    &0.345345\\
$z_4$  & -0.34535&0.4534    &0.553345\\
$v$     &55.3453    &55.67226  &57.53\\
\hline
\end{tabular}
\end{adjustbox}
\end{table}
This is my line. This is my line. This is my line. This is my line. This is my line. This is my line. This is my line.
\end{document}

我明白了: 在此处输入图片描述 我怎么能够:

1.将表格标题设置为与表格左侧对齐而不是页面左侧对齐?

2.像第一张图片一样将顶部和底部边框线设置为细-粗(1pt)?

3. 列的宽度是否足够?

答案1

为了使表格看起来更专业booktabs,我建议使用包和环境,以便将标题宽度限制为表格宽度。通过此包以及包中列类型的threeparttable数字的进一步改进,您可以获得:Ssiunitx

在此处输入图片描述

梅威瑟:

\documentclass[3p,onecolumn]{elsarticle}
\usepackage[labelfont=bf,singlelinecheck=false]{caption}
\usepackage{subcaption}
%\usepackage{adjustbox,stackengine}
\usepackage{textcomp}
\usepackage{mathtools}

\usepackage{array,booktabs,threeparttable}% <-- new
\usepackage{siunitx}% <-- new
\usepackage{lipsum}% <-- new

\begin{document}
\lipsum[1]
\begin{table}[htb]
\centering
    \begin{threeparttable}% <-- new
\caption{Statistical properties of Fourier series coefficients for the polygon base prismatic tumor.}
 \label{tabcoef1}
\begin{tabular}{>{$}c<{$}*{3}{S[table-format=2.6]}}% <-- new
    \toprule
\multicolumn{1}{c}{Parameter}
    & {$\bar{x}$}  
                & {$x_{\min}$}
                            & {$x_{\max}$}\\
    \midrule
w_0 & 33.6532   & 66.3456   & 77.4322   \\
w_1 & 0.45342   & 0.3534    & 0.45635   \\
w_2 & 0.54234   & 0.24523   & 0.354524  \\
w_3 & 0.524345  & 0.35345   & 0.6746    \\
w_4 & 0.3534    & 0.3563    & 0.63534   \\
z_1 & 0.35345   & 0.354535  & 0.53344   \\
z_2 & 0.345345  & 0.353345  & 0.535059  \\
z_3 & -0.345    & 0.345345  & 0.345345  \\
z_4 & -0.34535  & 0.4534    & 0.553345  \\
v   & 55.3453   & 55.67226  & 57.53     \\
    \bottomrule
\end{tabular}
    \end{threeparttable}
\end{table}
\lipsum[2]
\end{document}

相关内容