table in Latex
table in Latex
Table of Contents
1 Table
1.1 rescale table to textwidth
\begin{table} \resizebox{\textwidth}{!}{% \begin{tabular}{ | m{1cm} | m{1cm} m{1.5cm} m{1cm} m{0.5cm} m{1cm} m{1cm} m{1cm} m{1cm} m{1cm} m{1cm}| } \hline Authors, year & methods & flow regime & Re & m* & $\zeta$ & m*$\zeta$ & waves (kc) & Current & G/D & DOF\\ \hline Chern, 2018 & Num. & laminar & 100 & 10 & 0 & 0 & - & steady & 0.35,0.6,0.8,1.5 & 2\\ Munir, 2018& Num. & subcritical & 5000 & 2 & 0 & 2*0 & cosine wave:5,10, & - & 0.01, 0.4, 1.0 $\infty$ & 2\\ Barbosa, 2017& Exp. & subcritical & 6500-20,000 & 5.5 & - & - & - & steady & & 2\\ Hsieh, 2016& Exp. & subcritical & 3036-3924 & 5.67 & 0.01 & .601 & - & steady & 0.8 & 1\\ Chung, 2016 & Num. & laminar & 100 & 2 & 0 & 0 & - & steady & & 1\\ Yang,2009 & Exp. & subcritical & 2600-15,574 & 1.36 & 0.015 & & - & steady & 0.06-1.69 & 1\\ sumer 1994 & Exp. & subcritical & 60,000 & & & & & & & 1\\ \hline \end{tabular}} \end{table}
1.2 fit width of table to text width
use tabu
environment, but not works https://www.overleaf.com/learn/latex/Tables#Creating_a_simple_table_in_LaTeX https://tex.stackexchange.com/questions/10535/how-to-force-a-table-into-page-width
\begin{tabu} to \textwidth {|X[l]|X[c]|X[c]|X[c]|X[c]|X[c]|X[r]|} Location & TI\(_{\infty}^s\) (\%) & TI\(_{\infty}\) (\%) & U\(_{\infty}\) (m/s) & h(m) & Techniques & Ref
\hline
Island of Eday, UK & 10-11 & 7.9-8.7 & 1.5 & 5.0 & ADCP & \cite{osalusi2009reynolds}
Sound of Islay, UK & 12-13 & 9.5-10.3 & 2.0 & 5.0 & ADV & \cite{milne2013characteristics}
Puget Sound, USA & 8.4/11.4 & 6.6/9.0 & 1.3 (\(\pm\) 0.5) & 4.7 & ADV/ADCP & \cite{thomson2012measurements}
Strangford Lough, UK & 4-9 & 3.2-7.1 & 1.5-3.5 & 14 & – &\cite{macenri2013influence}
East River, NY,USA & 20-30 & 16-24 & 1.5-2.3 & 5.22 & ADCP & \cite{li2010inflow}
Goto Islands, Japan & 10-25.5 & 8-23 & 0.25-2 & 18& ADCP & \cite{novo2017field}
\hline
\end{tabu}
If you don't need to control the width of each cell, but of the entire table and then distribute the space within evenly, use the package tabu. See the example below:
\begin{tabu} to 0.8\textwidth { | X[l] | X[c] | X[r] | } \hline item 11 & item 12 & item 13 \\ \hline item 21 & item 22 & item 23 \\ \hline\begin{tabular*}{\textwidth}{c @{\extracolsep{\fill}} ccccc} ... \end{tabular*}
https://tex.stackexchange.com/questions/10535/how-to-force-a-table-into-page-width
1.3 fixed width of cell
p{3cm} | fixed cell width, 3cm |
\usepackage{array} \begin{center} \begin{tabular}{| m{5cm} | m{1cm}| m{1cm} | } \hline cell1 dummy text dummy text dummy text& cell2 & cell3 \\ \hline cell1 dummy text dummy text dummy text & cell5 & cell6 \\ \hline cell7 & cell8 & cell9 \\ \hline \end{tabular} \end{center}
1.4 Rotating table
\usepackage{rotating}
\begin{sidewaystable} \centering \caption{Your caption here} \begin{tabular}{ll} First First & First Second\\ Second First & Second Second \end{tabular} \end{sidewaystable}https://tex.stackexchange.com/questions/25369/how-to-rotate-a-table
1.5 example
\begin{table}[h!] \begin{center} \caption{Wake decay coefficient and RMS Error} \label{tab:WakeDecayCoefficient} \begin{tabular}{|c|c|c|} \hline TI (\%) & k & RMS Error\\ \hline 15 & 0.0190 & 0.0190\\ 1 & 0.0075 & 0.0371\\ \hline \end{tabular} \end{center} \end{table}
in the above exapple, the table caption is below the table.
To make sure caption on top of table contents:
The \caption
and \label
commands are optional. However, if you have both of them, \label must come between \caption and \end{table}.