LaTeX 之浮动体标题样式
简介
Caption 宏包中的一些参数说明及案例分析,用于自定义设置浮动体中标题的样式 o (^▽^) o
- 修改全篇浮动体标题格式(包括图片,表格等)
1 | % 导言区 |
- 单独对浮动体的图片或表格环境中标题的设置
1 | % 导言区 |
案例 1:加粗标题的图标签
1 | \documentclass{ctexart} |

实际上,使用 caption 命令不一定真的需要加入图片或者表格,只需要将其应用在浮动体环境当中即可
1 | \documentclass{ctexart} |

案例 2:设置标题与图片、表格之间的间距
1 | %语法 |
对于 Latex 标准的 article、book、report 等文档,默认的 skip 值为 10pt
1 | \documentclass{ctexart} |

案例 3:更多的标题样式设置
1 | \documentclass[11pt]{ctexart} |

参数说明
labelsep
语法
1 | labelsep=〈label separator name〉 |
对应值有
| 格式 | 说明 |
|---|---|
| default | 同 colon |
| none | 无间隔 |
| colon | 英文分号 |
| period | 英文句点 |
| space | 空格 |
| quad | 一个 em 的间隔 |
| newline | 标题另起一行 |
| endash | 英文 dash 连接符 |
Justification
语法
1 | justification=〈justification name〉 |
对应的值有
| 值 | 说明 |
|---|---|
| justified | 两端对齐,也就是正文默认对齐方式 |
| centering | 居中对齐 |
| raggedright | 左对齐 |
| raggedleft | 右对齐 |
| Raggedright | …… |
Font
语法
1 | font={font options} |
对应的 font options
| 值 | 说明 |
|---|---|
| small | Small size |
| normalsize | normalsize size |
| large | Large size |
| it | Italic shape |
| up | Upright shape |
| bf | Bold series |
| rm | Roman family |
| sf | Sans Serif family |
| tt | Typewriter family |
| stretch=amount | \setstretch{amount} |
| color=colour | color{colour} |
| … | … |
标题宽度
语法
1 | margin=amount %同时设置左右外边距 |

skip
语法
1 | skip=amount |
position
1 | position=top or position=above |
请注意:Caption 官方文档中对于该参数的说明
Please note that position=top does NOT mean that the caption is actually placed at the top of the figure or table.
the caption package tries its best to determine the actual position of the caption on its own. Please note that while this is successfully in most cases, it could give wrong results under rare circumstances.
参考资料
- 简书:LaTeX 标题控制
- Latex 入门(刘海洋)
- Latex 工作室:如何用 caption 宏包格式化图表标题和子标题