我尝试了解决方案\caption[\protect\vspace{-0.5ex}{ long caption text}]{long caption text}
,但没有任何效果。我需要在 LOF 中使用固定的双倍行距,而当长标题超过一行时,则必须是单倍行距。你能帮忙吗?谢谢。
\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}
\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
\usepackage[doublespacing]{setspace}% <- changed
\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions
%----------------%-------------------------%-----------
\begin{document}
\begingroup
\def\addvspace#1{}
\clearpage % to force a new page
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures
%\doublespacing
\endgroup
\mainmatter
\begin{figure}
\includegraphics{test}
\caption[\protect\vspace{-0.25ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\begin{figure}
\includegraphics{test2}
\caption[\protect\vspace{-0.5ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\end{document}
答案1
因此,将图片列表(和其他目录)设置为单倍行距,您可以在标题之后立即添加或\singlespacing
,或者在阅读相应目录的辅助文件之前立即添加,例如\setstretch{1}
\AfterTOCHead
\BeforeStartingTOC
\BeforeStartingTOC[lof]{\singlespacing}% for the list of figures only
或者
\BeforeStartingTOC{\singlespacing}% for every TOC (i.e. table of contents, list of figures, list of tables)
要在图形列表的条目之间添加白线,您可以更改选项beforeskip
,例如使用
\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{figure}
所有应该有它的条目类型都必须这样做。对于表格,复制命令并替换figure
为table
。
有关更多信息,请参阅tocbasic
KOMA-Script 手册中的章节。
对于目录中的条目,您还可以使用
\RedeclareSectionCommands[tocbeforeskip=\baselineskip]{section,subsection}
有关 的更多信息,请参阅 KOMA-Script 手册第 II 部分\RedeclareSectionCommand
。
要将图表列表和表格列表放入目录中,您还应该使用特殊的 KOMA-Script 功能:选项listof=totoc
。要从这些列表中删除章节间隙,您也不需要本地重新定义\addvspace
,而可以使用选项listof=nochaptergap
。
有了这些变化,您不再需要使用可选参数\caption
。
\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot,
listof=totoc,listof=nochaptergap% <--- ADDED
]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}
\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
\usepackage[doublespacing]{setspace}
\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions
\BeforeStartingTOC{\singlespacing}% <--- ADDED
\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{figure}
\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{table}
%----------------%-------------------------%-----------
\begin{document}
\frontmatter% <--- ADDED (without \mainmatter wouldn't make sense)
% CHANGED:
\listoffigures
\mainmatter
\begin{figure}
\includegraphics{test}
\caption{llong caption text 2long caption text 3long caption text 4long caption text 5long caption text}
\end{figure}
\begin{figure}
\includegraphics{test2}
\caption{llong caption text 2long caption text 3long caption text 4long caption text 5long caption text}
\end{figure}
\end{document}
答案2
图表列表用于\l@figure
进行格式化,因此我添加了一个额外的\vspace{\baselineskip}
。这应该适用于任何文档类。
双倍行距由打字机完成。排字员会在行间添加额外的空格。
\documentclass[12pt,oneside,letterpaper,chapterprefix=on,numbers=noenddot]{scrbook}
\setuptoc{toc}{leveldown}% if ToC should be on section level
\usepackage[english]{babel}
%%% document setup
\usepackage[demo]{graphicx}
\usepackage[list-entry=heading]{caption}
\usepackage{booktabs}% table
%\usepackage[doublespacing]{setspace}% <- changed
\setkomafont{captionlabel}{\bfseries}%make caption label bold
\setkomafont{caption}{\bfseries}%make caption bold
\setcapindent{0pt}%removes hanging indent from captions
\makeatletter
\let\oldl@figure=\l@figure
\renewcommand{\l@figure}{\vspace{\baselineskip}\oldl@figure}
\makeatother
\begin{document}
\begingroup
\def\addvspace#1{}
\clearpage % to force a new page
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\listoffigures}%\doublespacing
\endgroup
\mainmatter
\begin{figure}
\includegraphics{test}
\caption{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\begin{figure}
\includegraphics{test2}
\caption[\protect\vspace{-0.5ex}{ llong caption text 2long caption text 3long caption text 4long caption text 5long caption text }]{1long caption text 2long caption text 3long caption text 4long caption text 5long caption text 6long caption text}
\end{figure}
\end{document}