利用自定义列表方式实现书目录类似效果
时间: 2023-09-23 10:05:03 浏览: 45
以下是一个用自定义列表实现书目录类似效果的示例代码:
```
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\section*{目录}
\begin{enumerate}[label=\textbf{\arabic*.}, align=left, leftmargin=*]
\item 第一章
\begin{enumerate}[label=\textbf{\arabic{enumi}.\arabic*.}, align=left, leftmargin=*]
\item 小节1
\item 小节2
\item 小节3
\end{enumerate}
\item 第二章
\begin{enumerate}[label=\textbf{\arabic{enumi}.\arabic*.}, align=left, leftmargin=*]
\item 小节1
\item 小节2
\item 小节3
\end{enumerate}
\item 第三章
\begin{enumerate}[label=\textbf{\arabic{enumi}.\arabic*.}, align=left, leftmargin=*]
\item 小节1
\item 小节2
\item 小节3
\end{enumerate}
\end{enumerate}
\end{document}
```
这个代码会生成一个类似于书目录的效果,包括章节和小节的编号和标题。可以使用`enumitem`宏包来控制列表的样式和排版。在这个示例中,我们使用了两个嵌套的自定义列表来实现章节和小节的编号和标题。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)