Latex技巧:在图表序号中加入章节号(实现诸如“图1.1.2”这样的图表序号)
时间: 2023-08-10 14:05:40 浏览: 284
要在图表序号中加入章节号,可以使用`\numberwithin{figure}{section}`命令来实现。具体操作如下:
1. 在导言区添加`\usepackage{amsmath}`。
2. 在章节标题前加上`\setcounter{figure}{0}\setcounter{table}{0}`命令,以重置图表计数器。
3. 在导言区添加`\numberwithin{figure}{section}\numberwithin{table}{section}`命令,以实现图表序号中包含章节号。
示例代码如下:
```
\documentclass{article}
\usepackage{amsmath}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\begin{document}
\section{第一章}
\setcounter{figure}{0}\setcounter{table}{0}
\subsection{子节标题}
\begin{figure}[htbp]
\centering
\caption{这是一张图片}
\end{figure}
\begin{table}[htbp]
\centering
\caption{这是一张表格}
\end{table}
\end{document}
```
编译后,图表序号将包含章节号,例如“图1.1.1”、“表1.1.1”等。
阅读全文
相关推荐
















