为什么在我的 table in latex 中添加一个额外的行会破坏它?
Why does adding an extra row in my table in latex break it?
我正在学习 Latex,但在使用 overleaf 时遇到了一个令人沮丧的问题。这很简单我有这个 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}
我长得好看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\
2017 & 15 & 11.67 & 18.25\
\hline
\end{tabular}
\label{tab:1}
\end{table}
我什么都没有编译?
我建议使用 siunitx
包,它将很好地为您对齐所有数字
为了给 latex 更多的自由来找到最好的位置,使用 [htbp]
作为浮动说明符而不是将其限制在页面底部。
\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}
我正在学习 Latex,但在使用 overleaf 时遇到了一个令人沮丧的问题。这很简单我有这个 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}
我长得好看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\
2017 & 15 & 11.67 & 18.25\
\hline
\end{tabular}
\label{tab:1}
\end{table}
我什么都没有编译?
我建议使用
siunitx
包,它将很好地为您对齐所有数字为了给 latex 更多的自由来找到最好的位置,使用
[htbp]
作为浮动说明符而不是将其限制在页面底部。
\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}