패키지를 사용하면 etoc
명령을 사용하여 장과 섹션 목록을 쉽게 생성할 수 있습니다.\tableofcontents
또한 명령을 사용하여 목록 테이블과 그림을 생성할 수 있습니다 \locallistoftables
.\locallistoffigures
\tableofcontents % <-- line 41 in main.tex
\listoffigures % <-- line 43 in main.tex
\listoftables % <-- line 49 in main.tex
하지만 책에 있는 모든 예제 목록을 생성하는 방법은 무엇입니까?
예를 들어, ? main.tex
명령과 같이 모든 예제 목록을 자동으로 생성하는 방법 에 두 가지 예제가 있습니다.\listoffigures
\newmdenv[ % <---- line 26 in main.tex, exambox environment with `mdframed` package
style=kaoboxstyle,
backgroundcolor=Gray!12!White,
frametitlebackgroundcolor=Gray!12!White,
]{exambox}
%% ... omit
\begin{exambox}[frametitle=Example 1] % <--- line 79 in main.tex
\blindtext[1]
\label{exampe1}
\end{exambox}
\begin{exambox}[frametitle=Example 2]
\blindtext[3]
\label{exampe2}
\end{exambox}
mwe가 여기에 옵니다:
\documentclass[10pt,a4paper]{book}
\usepackage{blindtext}
\RequirePackage{tikz}
\RequirePackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{kaoboxstyle}{
skipabove=1.5\topskip,
skipbelow=.5\topskip,
rightmargin=0pt,
leftmargin=0pt,
innerrightmargin=7pt,
innerleftmargin=7pt,
topline=false,
bottomline=false,
rightline=false,
leftline=false,
frametitlerule=true,
linecolor=black,
fontcolor=black,
frametitlealignment=\raggedright\noindent % 防止全局缩进时,标题缩进
}
\RequirePackage{etoc} % Required to insert local tables of contents
\newmdenv[
style=kaoboxstyle,
backgroundcolor=gray!12!white,
frametitlebackgroundcolor=gray!12!white,
]{exambox}
\begin{document}
\begingroup % Local scope for the following commands
% Turn on compatibility mode for the etoc package
\etocstandarddisplaystyle % "toc display" as if etoc was not loaded
\etocstandardlines % "toc lines as if etoc was not loaded
\tableofcontents % Output the table of contents
\listoffigures % Output the list of figures
% Comment both of the following lines to have the LOF and the LOT on different pages
\let\cleardoublepage\bigskip
\let\clearpage\bigskip
\listoftables % Output the list of tables
\endgroup
\chapter{First Chapter}
\blindtext
\begin{figure}
\centering
\includegraphics{example-image}
\caption{fig 1}
\label{fig:enter1}
\end{figure}
\begin{figure}
\centering
\includegraphics{example-image}
\caption{fig 2}
\label{fig:enter2}
\end{figure}
\chapter{Second Chapter}
\blindtext[2]
{\color{red} exambox ref: \ref{exampe1}}
\begin{exambox}[frametitle=Example 1]
\blindtext[1]
\label{exampe1}
\end{exambox}
\begin{exambox}[frametitle=Example 2]
\blindtext[3]
\label{exampe2}
\end{exambox}
\begin{figure}
\centering
\includegraphics{example-image}
\caption{fig 3}
\label{fig:enter3}
\end{figure}
\chapter{Third Chapter}
\blindtext
\begin{table}[ht]
\centering
\begin{tabular}{c|c}
a & b \\
c & d
\end{tabular}
\caption{table 1}
\label{tab:table1}
\end{table}
\chapter{Second Chapter}
\blindtext
\blindtext
\begin{table}[ht]
\centering
\begin{tabular}{c|c}
1 & 2 \\
3 & 4
\end{tabular}
\caption{table 2}
\label{tab:table2}
\end{table}
\end{document}