Latex 中的表命名

Latex 中的表命名

我试图将表格名称添加到从 latex wiki 网站借来的表格示例中。我尝试过在这个网站上找到的一些其他示例,但似乎都不适合我。我是 latex 新手,所以我不知道我哪里做错了。

\documentclass{article} 
\usepackage[english]{babel}

\begin{document}
\begin{center}
\begin{tabular}{| l | l | l | l |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells 
across most of Scotland and Northern Ireland, 
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning. 
Conditions will improve by early afternoon and continue 
throughout the evening. \\
\hline
\end{tabular}
\end{center}'

我只是想给这个表添加标题。

答案1

您发布的表格材料几乎肯定不适合页面的可用空间。除了将表格材料嵌入环境中table并使用\caption指令创建标题之外,您还应该将第四列的列类型从 更改为lp— — 更好的是 — — XX这是包提供的列类型tabularx

如果您真的想“邀请”读者真正阅读并吸收表格材料,您还应该让表格看起来更加开放。下面显示的第二个表格提供了一些关于如何实现开放外观的建议。

在此处输入图片描述

\documentclass{article} 
\usepackage[english]{babel}

\usepackage{tabularx,booktabs,caption,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\captionsetup{skip=0.333\baselineskip}

\begin{document}

\begin{table}
\caption{Minimally-adapted table}
\begin{tabularx}{\textwidth}{| l | l | l | X |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells 
across most of Scotland and Northern Ireland, 
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning. 
Conditions will improve by early afternoon and continue 
throughout the evening. \\
\hline
\end{tabularx}

\vspace{1cm}

\caption{Cleaned-up look}
\begin{tabularx}{\textwidth}{@{}lccL@{}}
\toprule
Day & Min Temp & Max Temp & Summary \\
\midrule
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ 
\addlinespace
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells 
across most of Scotland and Northern Ireland, 
but rain reaching the far northwest. \\
\addlinespace
Wednesday & 10C & 21C & Rain will still linger for the morning. 
Conditions will improve by early afternoon and continue 
throughout the evening. \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

答案2

我不确定我是否正确理解了您的问题,但是您是否在\caption为您的表寻找 ?如果是,那么您应该使用table环境 而不是center

\documentclass{article} 
\usepackage[english]{babel}

\begin{document}
\begin{table}
\caption{text}
\begin{tabular}{| l | l | l | l |}
\hline
Day & Min Temp & Max Temp & Summary \\ \hline
Monday & 11C & 22C & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures. \\ \hline
Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells 
across most of Scotland and Northern Ireland, 
but rain reaching the far northwest. \\ \hline
Wednesday & 10C & 21C & Rain will still linger for the morning. 
Conditions will improve by early afternoon and continue 
throughout the evening. \\
\hline
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述


不过我建议表格的布局略有不同(请参阅@Mico 的回答解释为什么应该优先考虑这种布局)

\documentclass{article} 
\usepackage[english]{babel}

\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{caption}
\captionsetup{skip=0.333\baselineskip}

\begin{document}
\begin{table}
\caption{text}
\begin{tabularx}{\linewidth}{@{}lllX@{}}
\toprule
Day & \multicolumn{2}{c}{Temperature} & Summary\\
\cmidrule(r){1-1} \cmidrule(rl){2-3}  \cmidrule(l){4-4}
& min. & max. & \\
\cmidrule(rl){2-2}  \cmidrule(rl){3-3} 
Monday & \SI{11}{\degreeCelsius} & \SI{22}{\degreeCelsius} & A clear day with lots of sunshine.
However, the strong breeze will bring down the temperatures.\\ \addlinespace
Tuesday & \SI{9}{\degreeCelsius} & \SI{19}{\degreeCelsius} & Cloudy with rain, across many northern regions. Clear spells 
across most of Scotland and Northern Ireland, 
but rain reaching the far northwest.\\ \addlinespace
Wednesday & \SI{10}{\degreeCelsius} & \SI{21}{\degreeCelsius} & Rain will still linger for the morning. 
Conditions will improve by early afternoon and continue 
throughout the evening.\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}

在此处输入图片描述

相关内容