TransWikia.com

Increase spacing between page number and caption in list of figures

TeX - LaTeX Asked by riyansh.legend on September 1, 2021

In a latex document initialized as follows

documentclass[captions=nooneline,pagesize,bibliography=totoc,paper=a4,fontsize=12pt,DIV=calc,headings=small,headinclude,captions=tableheading,open=any,fleqn]{scrbook}

how can I change the distance between the page numbering and the caption in a list of figures? I’ve found a lot of questions about the distance between chapter number and captions but none for the page number and the caption.

At the moment my list looks as shown in this picture:

And I think the distance in the line with page number 103 should be increased, so that it’s easier to visually separate the "…-5" from the page number 103.
This is how I define my list of figures.

listoffigures
addcontentsline{toc}{chapter}{List of Figures}
newpage

2 Answers

Use the tocloft package (or use the class controls instead).

% lofpageprob.tex  SE 554963
documentclass{scrbook}
usepackage{tocloft}
usepackage{lipsum}

begin{document}
tableofcontents

newpage
addcontentsline{toc}{chapter}{List of Figures} % if the LoF is longer than a page, this needs to be called here
bgroup
cftsetpnumwidth{2.55em} cftsetrmarg{3.55em} % increase space for page number
listoffigures
egroup

listoftables

chapter{First}
lipsum{1}
begin{figure}
centering
A FIGURE
caption{Figure (Table) with a long caption long caption long caption 
ending in C-5}
end{figure}
begin{table}
centering
A TABLE
caption{Table (Figure) with a long caption long caption long caption 
ending in C-5}
end{table}

end{document}

As you haven't provided an MWE I have no idea why there is no space between C-5 and the page number 103. However, the solution is to increase the width of the box wherein the page number is set.

I did this just for the LoF to show the effect compared with the LoT but it should be the same for all lists, so make the change in the preamble.

Where you placed the addcontentsline... will return the page number of the last page of the LoF; unfortunate if the LoF has two or more pages.

I have never used the scrbook class so cannot advise you on that. However there was a meesage that it was not a good idea to use tocloft with scrbook but it would go ahead anyway.

Answered by Peter Wilson on September 1, 2021

With the input from Peter Wilsons answer I got on track and found an easy solution for the scrbook class. One can use the following lines within the document:

makeatletter
renewcommand{@pnumwidth}{2em}% default is 1.55em
renewcommand{@tocrmarg}{3em}% default is 2.55em
makeatother

where pnumwidth is the distance between the page number and the caption's text. It's also described in the documentation. There's also a German solution described here. The page number distance in my list of figures looks now like the following image shows:

Answered by riyansh.legend on September 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP