0

I tried the solution \caption[\protect\vspace{-0.5ex}{ long caption text}]{long caption text}, but it does nothing. I need a constant double spacing in LOF and when it comes to the long captions more than one line, it must be single spaced. Could you please help? thank you.

\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

So set the list of figures (and other TOCs) single-spaced you can add a \singlespacing or \setstretch{1} at the very beginning either immediately after the heading using \AfterTOCHead or immediately before reading the auxiliary file of the corresponding TOC using \BeforeStartingTOC, e.g.

\BeforeStartingTOC[lof]{\singlespacing}% for the list of figures only

or

\BeforeStartingTOC{\singlespacing}% for every TOC (i.e. table of contents, list of figures, list of tables)

To have the white line between entries to the list of figures, you can change option beforeskip, e.g., using

\DeclareTOCStyleEntry[beforeskip=\baselineskip]{tocline}{figure}

This have to be done for all entry types that should have it. For tables copy the command and replace figure by table.

See the tocbasic chapter in the KOMA-Script manual for more information.

For entries to the table of contents you could also use

\RedeclareSectionCommands[tocbeforeskip=\baselineskip]{section,subsection}

See part II of the KOMA-Script manual for more information about \RedeclareSectionCommand.

To put the list of figures and the list of tables into the table of contents you should also use a special KOMA-Script feature: option listof=totoc. To remove the chapter gap from these list you also don't need to locally redefine \addvspace but can use option listof=nochaptergap.

With these changes you do not longer need to use the optional argument of \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}

enter image description here

| improve this answer | |
1

The list of figures uses \l@figure to do the formatting, so I added an extra \vspace{\baselineskip}. This should work with any document class.

Double spacing is done by typewriters. Typesetters add extra space between lines.

\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}
| improve this answer | |
  • Thank you. However, it increases the vertical distance between the lines 2 times more than what I expect. Any suggestion how to fix that? again, thank you @John Kormylo – Bahar Jul 2 '17 at 3:51
  • Did you lose the doublespacing? Anyway, you can replace the \baselineskip with something smaller, like 0.5\baselineskip. – John Kormylo Jul 2 '17 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.