我用过这个代码
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
删除目录中所有章节条目后的点和页码。有没有办法只针对任意章节执行此操作?
以下基本上就是我所拥有的代码。
\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
footinclude=true,cleardoublepage=empty, abstractoff,
BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
ngerman,american
]{scrreprt}
\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\begin{document}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\tableofcontents
\chapter{Test Chapter One}
\index{arte}
\section{Section One One}
\section{Section One Two}
\chapter{Test Chapter Two}
\section{Section Two One}
\section{Section Two Two}
\end{document}
结果是这样的
我想要的是,例如测试第二章标题后带有点。
特别是,当章节没有部分时,有没有办法让点出现?
答案1
只需在需要的时间和地点\addtocontents{toc}{\cftpagenumbersoff{chapter}}
按下开关即可。\addtocontents{toc}{\cftpagenumberson{chapter}}
\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
footinclude=true,cleardoublepage=empty, abstractoff,
BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
ngerman,american
]{scrreprt}
\usepackage{tocloft}
\begin{document}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\tableofcontents
\chapter{Test Chapter One}
\index{arte}
\section{Section One One}
\section{Section One Two}
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\chapter{Test Chapter Two}
\section{Section Two One}
\section{Section Two Two}
\addtocontents{toc}{\cftpagenumberson{chapter}}
\chapter{Test Chapter Three}
\section{Section Three One}
\section{Section Three Two}
\end{document}
如果由于某种原因您想要单个条目的页码而不是点,请尝试以下操作:
\documentclass[twoside,openright, titlepage,numbers=noenddot, headinclude, %openany openright oneside twoside
footinclude=true,cleardoublepage=empty, abstractoff,
BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,
ngerman,american
]{scrreprt}
\usepackage{tocloft}
\begin{document}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\tableofcontents
\chapter{Test Chapter One}
\index{arte}
\section{Section One One}
\section{Section One Two}
\addtocontents{toc}{\def\protect\cftdotsep{10000}}
\chapter{Test Chapter Two}
\addtocontents{toc}{\def\protect\cftdotsep{4.5}}
\section{Section Two One}
\section{Section Two Two}
\chapter{Test Chapter Three}
\section{Section Three One}
\section{Section Three Two}
\end{document}