Reputation: 115
I am learning Latex and have a frustrating issue using overleaf. It's fairly simple I have this table:
\begin{table}[b]
\caption{This is an example table.}
\centering
\begin{tabular}{cccc}
\hline
Year & Maximum Temperature (°C) & Semibalanus balanoides & Mytilus edulis \\
\hline
2003 & 14.8 & 67.1 & 172.83\\
2004 & 14.5 & 68.73 & 62.83\\
2005 & 15.1 & 21.67 & 22.25\\
2006 & 15.9 & 189.92 & 16.2\\
2007 & 14.7 & 9.83 & 32.25\\
2008 & 15.7 & 23.92 & 35.33\\
2011 & 15.8 & 66.5 & 20.17\\
2012 & 16.8 & 76.92 & 12.42\\
2013 & 15.8 & 6.18 & 32.58\\
2014 & 16.2 & 18.75 & 15.42\\
2015 & 15.9 & 69.82 & 20.92\\
2016 & 16.6 & 7.58 & 3.92\\
\hline
\end{tabular}
\label{tab:1}
\end{table}
I get a nice-looking table. However adding one more row like this:
\begin{table}[b]
\caption{This is an example table.}
\centering
\begin{tabular}{cccc}
\hline
Year & Maximum Temperature (°C) & Semibalanus balanoides & Mytilus edulis \\
\hline
2003 & 14.8 & 67.1 & 172.83\\
2004 & 14.5 & 68.73 & 62.83\\
2005 & 15.1 & 21.67 & 22.25\\
2006 & 15.9 & 189.92 & 16.2\\
2007 & 14.7 & 9.83 & 32.25\\
2008 & 15.7 & 23.92 & 35.33\\
2011 & 15.8 & 66.5 & 20.17\\
2012 & 16.8 & 76.92 & 12.42\\
2013 & 15.8 & 6.18 & 32.58\\
2014 & 16.2 & 18.75 & 15.42\\
2015 & 15.9 & 69.82 & 20.92\\
2016 & 16.6 & 7.58 & 3.92\\
2017 & 15 & 11.67 & 18.25\\
\hline
\end{tabular}
\label{tab:1}
\end{table}
I get nothing compiled at all?
Upvotes: 0
Views: 851
Reputation: 39063
I suggest to use the siunitx
package, which will nicely align all the numbers for you
to give latex more freedom to find the best possible place, use [htbp]
as floating specifier instead of restricting it to only the bottom of the page.
\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}
\begin{table}[htbp]
\caption{This is an example table.}
\centering
\begin{tabular}{
@{}
S[table-format=4.0]
S[table-format=2.1]
S[table-format=3.2]
S[table-format=3.2]
@{}
}
\toprule
{Year} & {Maximum Temperature (°C)} & {Semibalanus balanoides} & {Mytilus edulis} \\
\midrule
2003 & 14.8 & 67.1 & 172.83\\
2004 & 14.5 & 68.73 & 62.83\\
2005 & 15.1 & 21.67 & 22.25\\
2006 & 15.9 & 189.92 & 16.2\\
2007 & 14.7 & 9.83 & 32.25\\
2008 & 15.7 & 23.92 & 35.33\\
2011 & 15.8 & 66.5 & 20.17\\
2012 & 16.8 & 76.92 & 12.42\\
2013 & 15.8 & 6.18 & 32.58\\
2014 & 16.2 & 18.75 & 15.42\\
2015 & 15.9 & 69.82 & 20.92\\
2016 & 16.6 & 7.58 & 3.92\\
2017 & 15 & 11.67 & 18.25\\
\bottomrule
\end{tabular}
\label{tab:1}
\end{table}
\end{document}
Upvotes: 1