2

Hi I'm trying to create a table like this picture:

enter image description here

But when I try this code:

\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}

I get this: enter image description here How can I:

1.Set table caption aligned with left of table not page?

2.Set top and bottom border line thin-thick (1pt) like first picture?

3.Make columns wide enough?

1
  • Your original has a double top and bottom border. This is trivial to achieve with \hline \hline but just not to be recommended. Check out the booktabs package and its \toprule and \bottomrule. The columns are already wide enough, what you're looking for, really I would say is more space between columns. \setlength{\tabcolsep}{36pt} (or to taste) is the poor man's way of doing this.
    – Au101
    Jul 22 '16 at 7:01
6

For professional look of tables is intended package booktabs, for limit caption width to table width I suggest to use threeparttable packages and environment. With this, and further improvement in numbers align with S column type from package siunitx you can obtain:

enter image description here

MWE:

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.