如何更改表格列表中表格标题和页码之间的间距?

如何更改表格列表中表格标题和页码之间的间距?

在表格列表中,我必须更改表格标题和页码之间的间距。借助我在此处找到的代码,我能够更改表格编号和表格标题之间的间距,但上述问题仍然存在。实际上,我找到了如下代码:

\makeatletter

\renewcommand{\@pnumwidth}{4em}

\makeatother

但是,此代码仅保持点与页码之间的间隙不变。如果表格标题很长,则单词可能会超出限制。例如,

在此处输入图片描述

我希望单词“ratios”与点对齐。或者让单词“ratios”位于下一行,但让单词“SPN”与点对齐。此外,同样的问题也适用于目录和图表列表。

提前谢谢了!

此致

答案1

这是一个解决方案(通过添加命令\renewcommand{\@tocrmarg}{4.2em}:):

\documentclass[a4paper,12pt]{article}
\usepackage{array,caption}
\usepackage{tocloft}
\usepackage[left=3cm, top=3cm, right=2.5cm, bottom=2.5cm]{geometry}
\renewcommand{\listtablename}{\hfill\bfseries\normalsize List of Tables\hfill\vspace{24pt}}
\renewcommand{\cfttabdotsep}{0.25}
\newlength\mylength
\cftsetindents{table}{0cm}{0.9cm}
\renewcommand\cfttabpresnum{\tablename~}
\settowidth\mylength{\cfttabpresnum}
\addtolength\cfttabnumwidth{\mylength}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{etoolbox}
\makeatletter
\renewcommand{\@tocrmarg}{4.2em}% -> Here!!!
\renewcommand{\@pnumwidth}{4.2em}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{sloppypar}
\listoftables
\end{sloppypar}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{-2cm}
{\noindent
$
\begin{array}{llr}
\hspace{-0.2cm}\textbf{Table No}& \hspace{-0.2cm}\textbf{Table Title} &  \hspace{9cm}\textbf{Page No}
\end{array}
$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\begin{table}[h]
\caption{Mean SSIM results for 20 traditional images with different SPN ratios ranging from bla bla bla}
xxx
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

在此处输入图片描述

答案2

我猜想以下 MWE 就足够了。

\documentclass[a4paper,12pt]{article}
\usepackage{array,caption}
\usepackage{tocloft}
\usepackage[left=3cm, top=3cm, right=2.5cm, bottom=2.5cm]{geometry}
\renewcommand{\listtablename}{\hfill\bfseries\normalsize List of Tables\hfill\vspace{24pt}}
\renewcommand{\cfttabdotsep}{0.25}
\newlength\mylength
\cftsetindents{table}{0cm}{0.9cm}
\renewcommand\cfttabpresnum{\tablename~}
\settowidth\mylength{\cfttabpresnum}
\addtolength\cfttabnumwidth{\mylength}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\renewcommand{\@pnumwidth}{4.2em}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\listoftables
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{-2cm}
{\noindent
$
\begin{array}{llr}
\hspace{-0.2cm}\textbf{Table No}& \hspace{-0.2cm}\textbf{Table Title} &  \hspace{9cm}\textbf{Page No}
\end{array}
$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\begin{table}[h]
\caption{Mean SSIM results for 20 traditional images with different SPN ratios ranging from bla bla bla}
xxx
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

对于上面的例子,YAP 如下:

第 1 页 在此处输入图片描述

第2页 在此处输入图片描述

相关内容