这是我必须应用于 LOF 的特定格式:它基本上应该是 3 个对齐的列,包含:页码 - 图号 - 图名(按照这个顺序,像表格一样)。我需要显示列的名称。
图片列表
页码 图号 图名 1 1 图名1 8 2 thename_of_figure2 不适合 单行 15 3 图名3 16 4 图名4目前,我有以下\titlecontents
配置(我一直在努力实现这 3 列的对齐:希望这是正确的方法!=)
\titlecontents{figure}
[0em]
{}
{\thecontentspage{\ifthenelse{\thecontentspage<10}{\hspace*{6ex}}{\hspace*{5ex}}}%
\thecontentslabel{\ifthenelse{\thecontentslabel<10}{\hspace*{6ex}}{\hspace*{5ex}}}}%
{}
{}
显示以下内容:
图片列表
1 1 图名1 8 2 thename_of_figure2 不适合 单行 15 3 图名3 16 4 图名4现在,我需要帮助......
- 添加页码 图号 图名标题,以及
- 对齐行上未容纳的其余标题部分,以便将其放置在标题第一个字母的正下方。
答案1
我尝试重现上图的内容。希望这就是你想要的。
代码:
\documentclass{article}
\usepackage{ifthen}
\usepackage{titletoc}
\newlength{\digitlen}
\settowidth{\digitlen}{1}
\titlecontents{figure}
[0em]
{}
{\contentspush{%
\ifthenelse{\thecontentspage<10}{\hspace*{\digitlen}}{}%
\thecontentspage\hspace*{4.5em}%
\ifthenelse{\thecontentslabel<10}{\hspace*{\digitlen}}{}%
\thecontentslabel\hspace*{5em}}}
{}
{}
\addtocontents{lof}{\vspace*{1em}}
\addcontentsline{lof}{figure}{\textbf{Page}\hspace*{2em}\textbf{Figure \#}\hspace*{2em}\textbf{Figure name}}
\addtocontents{lof}{\vspace*{1em}}
\begin{document}
\listoffigures
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure\ which is very very very very very long}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\clearpage
\begin{figure}
\caption{the name of figure\thefigure}
\end{figure}
\end{document}
答案2
我不知道我的解决方案有多合理,但它有效:
\documentclass{article}
% Your packages ...
\usepackage{ifthen}
\usepackage{titletoc}
\titlecontents{figure}
[0em]
{}
{\contentspush{\thecontentspage{\ifthenelse{\thecontentspage<10}{\hspace*{6ex}}{\hspace*{5ex}}}%
\thecontentslabel{\ifthenelse{\thecontentslabel<10}{\hspace*{6ex}}{\hspace*{5ex}}}}}%
{}
{}
\addtocontents{lof}{\protect\contentsline{section}{\footnotesize\normalfont\bfseries Page \hspace*{1ex} Figure \# \hspace*{1ex} Figure Name}{}{}}
\begin{document}
\listoffigures
% Your document--
\end{document}
以下是示例:
一些注意事项:
答案3
以下 MWE 更新\l@figure
用于设置 LoF 条目。\AtBeginDocument
写入.aux
(立即)也会插入相应的标题(页~ 30pt 和数字~ 40pt):
\documentclass{article}
\newcommand{\fig}[1][A figure]{% Just for this example
\begin{figure}\centering\rule{.6\linewidth}{.15\textheight}\caption{#1}\end{figure}}
\makeatletter
\AtBeginDocument{%
% LoF heading
\immediate\write\@auxout{\string\@writefile{lof}{{\string\bfseries%
\string\makebox[30pt]{Page}%
\string\makebox[40pt]{Figure}%
Figure name}\string\par\string\bigskip\string\ignorespaces\string\noindent}}%
}
\renewcommand{\l@figure}[2]{{%
\renewcommand{\numberline}[2]{%
\makebox[40pt]{##1}% Figure number
\begin{tabular}[t]{@{}p{\dimexpr\linewidth-70pt}@{}}##2\end{tabular}\par}%
\makebox[\linewidth]{%
\makebox[30pt]{#2}% Page number
\makebox[\dimexpr\linewidth-30pt]{#1}%
}}}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\section{A section}
\fig\fig\fig[A very long figure caption that should span multiple lines and break properly]
\fig\fig\fig[A very long figure caption that should span multiple lines and break properly]
\fig\fig\fig[A very long figure caption that should span multiple lines and break properly]
\fig\fig\fig[A very long figure caption that should span multiple lines and break properly]
\end{document}
答案4
我觉得可以使用部分*并在其后插入表格作为图表列表来实现。这应该看起来像您想要的那样。
\section*{List of Figures}
\begin{table}[htbp]
\begin{tabular}{rrr}
\textbf{Page } & \textbf{Figure\#} & \textbf{Figure name} \\
1 & 1 & thename_of_figure1 \\
& & \\
8 & 2 & thename_of_figure2 that does not fit on \\
& & a single line \\
& & \\
15 & 3 & thename_of_figure3 \\
& & \\
16 & 4 & thename_of_figure4 \\
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
这是我在这里的第一个回答...如果这不是你问的,很抱歉