# How to build the table as image attached? I want exactly this table and format. [duplicate]

Hello I have tired to build this table attached

following code is my try..I do not know how to bring the same setting

 \documentclass[preprint,12pt,authoryear]{elsarticle}

\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{siunitx}

\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{booktabs} % <-- To get prettier rules in tables
\usepackage{caption} % <-- To set caption width etc.
\begin{document}
\begin{table}
\centering
\captionsetup{width=10cm}
\caption{Silicon Nitride Height Measurements}
\label{tab:2}
\begin{tabular}{l *{4}{S[table-format=4.0]}}
\toprule
{Transformation temperatures} & {Transformation constants}&{Maximum residual strain} &{Effect modulus}\\
& \si{nm} &  &\si{nm}\\
\midrule
$M_f$  &       145 &        55 &        140& 55 \\
$M_s$     &      130 &        50&        135& 60\\
$A_f$    &       145 &        60&        125& 60\\
$A_s$  &       190 &        90 &        230& 100\\
&  185 &        85&        180&  75\\
&195 &        85&        200& 65\\
\bottomrule
\end{tabular}
\end{table}
\FloatBarrier
\end{document}

• Please can you complete your code so that it can be compiled?
– cfr
Mar 20, 2016 at 3:13
• @cfr You should be able to compile that without any problem. Mar 20, 2016 at 3:14
• If I copy-paste your code into an empty file and compile I guarantee you it will not work. I would stake my hat on it.
– cfr
Mar 20, 2016 at 3:17
• @cfr try now! let me know what would be happen to your hair Mar 20, 2016 at 3:20
• You have four answers now and every one states that the question is unclear. Please try to be as precise as possible for your future questions. Mar 20, 2016 at 8:13

Your question is not clear at all. Presented image is completely different from your MWE ... How to make nice table from your MWE, you already have two nice answers, in case, that you like to retype images, the following MWE might be of help:

\documentclass[border=3mm]{standalone}
\usepackage{siunitx}
\usepackage{mathtools}
\usepackage{booktabs,makecell} % <-- To get prettier rules in tables

\begin{document}
\begin{tabular}{*{4}{c}}
\toprule
\midrule
\begin{aligned} D_s & = \SI{67e-3}{MPa} \\ D_m & = \dots \\ \Theta & = \dots \\ \vphantom{A_f} \end{aligned}
&
\begin{aligned} M_f & = \SI{9}{\degreeCelsius} \\ M_s & = \dots \\ A_f & = \dots \\ A_s & = \dots \end{aligned}
&
\begin{aligned} C_M & = \SI{8}{MPA/\degreeCelsius} \\ \dots & = \dots \\ \dots & = \dots \\ \dots & = \dots \end{aligned}
&
\begin{aligned} \dots & = \dots \\ \dots & = \dots \\ \vphantom{A_f} \\ \vphantom{A_f} \end{aligned}     \\
\bottomrule
\end{tabular}
\end{document}


In my MWE I didn't bother with table content details (that is easy to write in appropriate place) nor with table caption.

• Thanks Zarko. it is exactly I wanted ti see and learn it. Mar 20, 2016 at 19:50

I reduced your MWE to the really absolute necessary and hope that I have guessed right what belongs to what.

The trick used here for the heading lines is to use a new line when you want to "break" the heading.

\documentclass[border=2mm]{standalone}
\usepackage{siunitx}
\usepackage{booktabs} % <-- To get prettier rules in tables
\begin{document}
\begin{tabular}{
l
S[table-format=3]
S[table-format=2]
S[table-format=3]
S[table-format=3]
}
\toprule
& {Transformation}
& {Transformation}
& {Maximum}
& {Effect} \\
& {temperatures}
& {constants}
& {residual strain}
& {modulus} \\
& {\si{\nm}}
&       & {\si{\nm}}
&     \\
\midrule
$M_f$   & 145   & 55    & 140   & 55  \\
$M_s$   & 130   & 50    & 135   & 60  \\
$A_f$   & 145   & 60    & 125   & 60  \\
$A_s$   & 190   & 90    & 230   & 100 \\
& 185   & 85    & 180   & 75  \\
& 195   & 85    & 200   & 65  \\
\bottomrule
\end{tabular}
\end{document}


• thanks but look at the image of table that I am looking for, this version is a simplified of what I am looking for based on my initial try. Can you adjust that to the image of table that posted in my question? Mar 20, 2016 at 6:26
• Do you like that some one retype table on the image (instead of you)? Mar 20, 2016 at 6:56
\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{siunitx}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{booktabs} % <-- To get prettier rules in tables
\usepackage{caption} % <-- To set caption width etc.
\begin{document}
\begin{table}
\centering
\captionsetup{width=10cm}
\caption{Silicon Nitride Height Measurements}
\label{tab:2}
\begin{tabular}{*{2}{p{3cm}}p{2cm}p{2cm}r}
\toprule
{Transformation Temperatures} & {Transformation Constants}&{Maximum Residual} &{Effect Modulus}& ?\\
& $\si{nm}$ & strain&$\si{nm}$&\\
\midrule
$M_f$  &       145 &        55 &        140& 55 \\
$M_s$     &      130 &        50&        135& 60\\
$A_f$    &       145 &        60&        125& 60\\
$A_s$  &       190 &        90 &        230& 100\\
&  185 &        85&        180&  75\\
&195 &        85&        200& 65\\
\bottomrule
\end{tabular}
\end{table}
\end{document}


look at the image of table that I have in my original question. I want to have that.

Unfortunately, the table shown in the screenshot and the code for the sample table do not correspond closely. Hence, it is not clear which formatting-related aspects of the table in the screenshot you wish to replicate. Is it the sans-serif font (and, if so, which one?), is it the bold lettering of the table caption and cell headers, or is something else still?

The following code focuses on bold-facing the caption and cell headers. It also uses a tabularx environment instead of a tabular environment, with the width of the tabularx environment set to \textwidth -- it doesn't get any wider. Even so, observe that it's necessary to truncate some of the words in the header row.

\documentclass[preprint,12pt,authoryear]{elsarticle}

\usepackage[font=bf,skip=0.5\baselineskip]{caption}
\usepackage{siunitx,booktabs}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand\mc[1]{\multicolumn{1}{C}{#1}} % handy shortcut macro

\begin{document}
\begin{table}
\caption{Silicon Nitride Height Measurements}
\label{tab:2}
\setlength\tabcolsep{4pt} % default: 6pt
\sisetup{table-format=3.0}
\begin{tabularx}{\textwidth}{@{} l *{4}{S} @{}}
\toprule
\mc{\bfseries Transform.\ temperature} &
\mc{\bfseries Transform.\ constant} &
\mc{\bfseries Max.\ resid.\ strain} &
\mc{\bfseries Effect modulus}\\
& [\si{nm}] & & [\si{nm}] \\
\midrule
$M_f$  &  145 & 55 & 140&  55 \\
$M_s$  &  130 & 50 & 135&  60 \\
$A_f$  &  145 & 60 & 125&  60 \\
$A_s$  &  190 & 90 & 230& 100 \\
&  185 & 85 & 180&  75 \\
&  195 & 85 & 200&  65 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}