目前我的图表列表如下
List of Figures Figures 1 ........................x Figures 2.........................x
如何制作成这样?
List of Figures Figures 1 ........................x Figures 2.........................x
谢谢
我的代码是:
\documentclass[a4paper,12pt,openleft]{book}
\begin{document}
\tableofcontents
\listoffigures
\chapter{chapter 1}
\begin{figure}[h]
\centering
\includegraphics{images.png}
\caption[Figure~\ref{fig:fig1}]{caption}
\label{fig1}
\end{figure}
\chapter{chapter 2}
\begin{figure}[h]
\centering
\includegraphics{images2.png}
\caption[Figure~\ref{fig:fig2}]{caption2}
\label{fig2}
\end{figure}
\end{document}
答案1
如果您希望在图形列表的条目前没有缩进,则应使用tocloft
包,并设置\cftfigindent
为0pt
。请参阅下面的代码。
\documentclass[a4paper,12pt,openleft]{book}
\usepackage{graphicx}
\usepackage{tocloft}
\setlength{\cftfigindent}{0pt}
\begin{document}
\tableofcontents
\listoffigures
\chapter{chapter 1}
\begin{figure}[h]
\centering
\includegraphics{example-image-a}
\caption[Figure~\ref{fig1}]{caption}
\label{fig1}
\end{figure}
\chapter{chapter 2}
\begin{figure}[h]
\centering
\includegraphics{example-image-b}
\caption[Figure~\ref{fig2}]{caption2}
\label{fig2}
\end{figure}
\end{document}
答案2
LOF 的格式由 来格式化\l@figure
,进而调用\@dottedtocline
来添加缩进等。图形/标题编号由 添加\numberline
。
\documentclass[a4paper,12pt,openleft]{book}
\usepackage{showframe}% debugging tool
\makeatletter
\renewcommand*{\l@figure}[2]% #1 = \numberline[number}{text}, #2 = page
{\bgroup
\let\numberline=\@gobble
\@dottedtocline{1}{0pt}{0pt}{#1}{#2}%
\egroup}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\chapter{chapter 1}
\begin{figure}[h]
\centering
%\includegraphics{images.png}
\caption[Figure~\thefigure]{caption}
\label{fig1}
\end{figure}
\chapter{chapter 2}
\begin{figure}[h]
\centering
%\includegraphics{images2.png}
\caption[Figure~\thefigure]{caption2}
\label{fig2}
\end{figure}
\end{document}