尽管 \cftsetpnumwidth 仍显示目录中的虚线

尽管 \cftsetpnumwidth 仍显示目录中的虚线

使用该软件包时,tocloft我的目录中的虚线出现了问题。因为我使用的是罗马页码,所以我的数字大约是 XXVIII 或类似的数字,这对于明显预设的 来说太宽了\pnumwidth。它超出了我的右边距,看起来非常不美观。因此,为了让编号正确无误,我将数字放入带有 的框中\cftsetpnumwidth{}

现在的问题是虚线到达该框时会停止(我知道这很明显)。但是我能以某种方式让点一直到数字开始吗?比如使用另一个命令设置页码不规则,而不使用数字框?如果有人知道该问题的解决方案,我会非常高兴听到!提前致谢!

以下是我的最小示例:

\documentclass[listof=totocnumbered,9pt,a4paper,ngerman]{scrartcl} % Verzeichnisse im IV aufgeführt mit Nr.

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{extsizes}
\usepackage[a4paper,left=3cm,right=2.5cm,top=2cm,bottom=2cm]{geometry}
\usepackage[titles]{tocloft} % Formatierung der Vezeichnisse

\cftsetpnumwidth{1.0cm}

\renewcommand{\cftsecdotsep}{\cftdotsep}
\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}

\begin{document}
\makeatletter
\renewcommand{\cftdotsep}{0.5} % Einstellung der Punktabstände im VZ
\makeatother

\tableofcontents % Inhaltsverzeichnis

\newpage
\newcommand*{\thesectionwas}{}
\let\thesectionwas\thesection
\renewcommand{\thesection}{\Roman{section}}
\setcounter{section}{0}

\section{Abkürzungsverzeichnis}

\newpage
\makeatletter
\renewcommand{\cftdotsep}{0.5}
\makeatother
\listoffigures % Abb-VZ

\newpage
\makeatletter
\renewcommand{\cftdotsep}{0.5}
\makeatother
\listoftables % Tab-VZ
\newpage

\renewcommand{\thesection}{\Roman{section}}
\setcounter{section}{3}
\pagenumbering{Roman}
\setcounter{page}{31}

\begin{appendix}
\refstepcounter{section}
\section{bla}
\section{blabla}
\end{appendix}

\end{document}   

答案1

由于tocloft,它设置全部页码位于宽度为 的框中\@pnumwidth。要消除装箱性质并符合您的要求(右对齐、“可变宽度”页码框),一种快速解决方法是删除以下功能\makebox[<width>][<alignment>]{<stuff>}

{\def\makebox[#1][#2]#3{#3}%
\tableofcontents % Inhaltsverzeichnis
}

上述操作\makebox在设置期间暂时不起作用\tableofcontents

在此处输入图片描述

\documentclass[listof=totocnumbered,9pt,a4paper,ngerman]{scrartcl} % Verzeichnisse im IV aufgeführt mit Nr.

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{extsizes}
\usepackage[a4paper,left=3cm,right=2.5cm,top=2cm,bottom=2cm]{geometry}
\usepackage[titles]{tocloft} % Formatierung der Vezeichnisse

\cftsetpnumwidth{1.0cm}

\renewcommand{\cftsecdotsep}{\cftdotsep}
\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}}

\begin{document}
\makeatletter
\renewcommand{\cftdotsep}{0.5} % Einstellung der Punktabstände im VZ
\makeatother

{\def\makebox[#1][#2]#3{#3}%
\tableofcontents % Inhaltsverzeichnis
}

\newpage
\newcommand*{\thesectionwas}{}
\let\thesectionwas\thesection
\renewcommand{\thesection}{\Roman{section}}
\setcounter{section}{0}

\section{Abkürzungsverzeichnis}

\newpage
\makeatletter
\renewcommand{\cftdotsep}{0.5}
\makeatother
\listoffigures % Abb-VZ

\newpage
\makeatletter
\renewcommand{\cftdotsep}{0.5}
\makeatother
\listoftables % Tab-VZ
\newpage

\renewcommand{\thesection}{\Roman{section}}
\setcounter{section}{3}
\pagenumbering{Roman}
\setcounter{page}{31}

\begin{appendix}
\refstepcounter{section}
\section{bla}
\section{blabla}
\end{appendix}

\end{document}

相关内容