使 LaTeX 表格标题与表格宽度相同?
如果标题比下面的表格宽,那么在我的论文中看起来会很糟糕。我怎样才能让它们都对齐?
现在我的代码如下所示:
\begin{table}[th!]
\caption{Reference temperature blah blah}
\centering
\begin{tabular}{llll}
...
\end{tabular}
\end{table}
It looks bad in my paper if a caption is wider than the table underneath it. How can I make them both align?
Right now my code looks like:
\begin{table}[th!]
\caption{Reference temperature blah blah}
\centering
\begin{tabular}{llll}
...
\end{tabular}
\end{table}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
实际上,有一种更合法的方法可以使用标题包选项
width
来做到这一点。用于全局效果
仅在当前环境中用于局部效果:
标题包文档中的更多信息:
https://www.ctan.org/pkg/caption?lang=en
http://mirrors.ctan.org/macros/latex/contrib/caption/caption-eng.pdf(PDF 的直接链接可能会发生变化)
Actually there is a more legal way to do this using captions package option
width
.For global effect
For local effect only in current environment:
More info in caption package doc:
https://www.ctan.org/pkg/caption?lang=en
http://mirrors.ctan.org/macros/latex/contrib/caption/caption-eng.pdf (direct link to PDF subject to change)
如果您知道或找出桌子的宽度,假设为 5 厘米 -
如果您使用 KOMA-Script 类:
\setcapwidth[c]{5cm}
如果您使用字幕包:
\captionsetup{width=5cm}
两者都可以在表格环境中应用。
自动计算解决方案更复杂,但可以使用 \ settowidth 命令。
if you know or find out the width of the table, let's say 5cm -
if you're using a KOMA-Script class:
\setcapwidth[c]{5cm}
if you're using the caption package:
\captionsetup{width=5cm}
Both may be applied inside the table environment.
An automatically calculating solution is more complicated, but could be done using the \settowidth command.
我通过将标题放入 parbox 中获得了成功:
I've had success by putting my caption in a parbox:
在标题包指南中:
in caption package guide:
将表格和标题放入迷你页中。标题将换行。这也是为表格添加适当脚注的好方法。
Put your table plus caption inside a minipage. The caption will wrap. This is also a great way to have proper footnotes for tables.