
내 논문의 스타일을 지정하려면 출판사가 ToC에 최소 두 개의 점을 요구합니다. 그렇지 않으면 줄을 끊어야 합니다(수동으로 수행하면 다른 문제가 발생함). tocloft
\renewcommand\cftdotsep{..}
-thing(다른 라인에서 새로운 문제를 일으키는) 보다 더 우아한 솔루션을 만드는 아이디어가 있습니까 ?
MWE:
\documentclass[
paper=233mm:155mm,
fontsize=10.5,
cleardoubleempty,
headings=optiontohead,
bibliography=totoc,
idxtotoc,
pointlessnumbers]
{scrbook}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage{polyglossia} % Sprachumschaltung
\setdefaultlanguage{german}% Voreingestellte Dokumentsprache: Deutsch
%%% Seitenränder etc.
\usepackage[footnotesep=1.5\baselineskip]{geometry}
\geometry{includehead=true, textwidth=117mm, textheight=186mm, headsep=6mm, left=18mm, bottom=24mm}
%% Design der Überschriften %%%%%%%%%%
\setkomafont{sectioning}{\normalfont\large\scshape\centering}
\setkomafont{part}{\normalfont\Huge\scshape\centering}
\setkomafont{chapter}{\normalfont\LARGE\scshape\centering}
\setkomafont{section}{\normalfont\Large\centering}
\setkomafont{subsection}{\normalfont\large\centering}
\setkomafont{subsubsection}{\normalfont\normalsize\centering}
\setkomafont{minisec}{\normalfont\normalsize\itshape\centering}
\setkomafont{paragraph}{\normalfont\normalsize\itshape}
\setkomafont{subparagraph}{\normalfont\normalsize\itshape}
%% Inhaltsverzeichnis formatieren %%%%%%%%%%%%%%%%%%%
\usepackage{tocloft}
\tocloftpagestyle{empty} %keine Seitenzahl auf erster Seite des Inhaltsverzeichnisses
\renewcommand{\cftchappagefont}{} % Seitenzahlen auch bei Chapter nicht fett
\renewcommand{\cftpartpagefont}{} % Seitenzahlen auch bei Chapter nicht fett
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}} % Punkte nicht fett
\renewcommand{\cftchapdotsep}{\cftdotsep}
\renewcommand{\cfttoctitlefont}{\hfill\normalfont\LARGE\scshape} % Größe der Überschrift wie \chapter
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftchapfont}{\normalfont} %% Im Inhaltsverzeichnis Titel normal. alternativ fett. \bfseries
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\renewcommand\thesection{\thechapter.\arabic{section}} %% Nummerierung Section Römisch
\renewcommand\thesubsection{\thesection.\arabic{subsection}} %% Nummerierung Subsection arabisch usw.
\renewcommand\thesubsubsection{\thesubsection.\arabic{subsubsection}}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\chapter{A chapter with a title much too long as there aren't any dots any more}
\blindtext
\section{A section that is ok as there are at least two dots left}
\blindtext
\subsection{A subsection again not fitting as it is only ONE dot left}
\blindtext
\end{document}
답변1
한 가지 방법은 내부 명령을 직접 패치하여 \@dottedtocline
적어도 2em 길이의 리더를 생성하는 것입니다.
\documentclass{scrbook}
\makeatletter
\renewcommand*\@dottedtocline[5]{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
{\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
\advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
{#4}\nobreak
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hskip 2em \@plus 1fill % <<< PATCH
\nobreak
\hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
\par}%
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{One}
Lorem ipsum.
\section{Some words to fill the line, words to fill the line,
words to fill the line}
Dolor sit amet.
\section{Some words to fill the line, words to fill the line,
words to fill the line, w}
Consectetur adipisci elit.
\section{Some words to fill the line, words to fill the line,
words to fill the line, wo}
Numquam faucibus,.
\end{document}
둘 다책그리고필기장클래스는 궁극적으로 리더와 함께 toc 항목을 생성하기 위해 호출되므로 \@dottedtocline
패치가 작동해야 합니다.
산출:
덧셈
늘 그렇듯 \patchcmd
,etoolbox다음 대신 패키지를 사용할 수 있습니다 \renewcommand
(전체 정의를 반복해야 함).
\documentclass{scrbook}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@dottedtocline}{\hfill}{\hskip 2em \@plus 1fill }{}{}
\makeatother
\begin{document}
\tableofcontents
\chapter{One}
Lorem ipsum.
\section{Some words to fill the line, words to fill the line,
words to fill the line}
Dolor sit amet.
\section{Some words to fill the line, words to fill the line,
words to fill the line, w}
Consectetur adipisci elit.
\section{Some words to fill the line, words to fill the line,
words to fill the line, wo}
Numquam faucibus,.
\end{document}
두 번째 추가
댓글에는 다음에 맞게 조정된 유사한 패치가 필요합니다.토클로프트패키지. 빠르게 살펴보면 이 패키지가 리더를 생성하는 데 의존하지 않고 목적에 맞게 \@dottedtocline
자체 명령, 즉 을 정의한다는 것을 알 수 있습니다. \cftdotfill
따라서 이 경우 패치해야 할 명령은 다음과 같습니다.
\documentclass{scrbook}
\usepackage{tocloft}
\makeatletter
\renewcommand{\cftdotfill}[1]{%
\def\@tempa{#1}%
\def\@tempb{\cftnodots}%
\ifx\@tempa\@tempb
\hfill % <<< this has not been changed
\else
\leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}%
\hskip 2em \@plus 1fill \relax % <<< PATCH
\fi
}
\makeatother
\begin{document}
\tableofcontents
\chapter{One}
Lorem ipsum.
\section{Some words to fill the line, words to fill the line,
words to fill the line}
Dolor sit amet.
\section{Some words to fill the line, words to fill the line,
words to fill the line, w}
Consectetur adipisci elit.
\section{Some words to fill the line, words to fill the line,
words to fill the line, wo}
Numquam faucibus,.
\end{document}
답변2
크누스 앤 플라스(Knuth & Plass)의 1981년종이"문단을 줄로 나누기"에서는 TeX의 줄바꿈 알고리즘의 기본이 되는 상자 및 접착 모델을 설명하고 이를 통해 활성화되는 몇 가지 불꽃을 보여줍니다.
이러한 트릭 중 하나를 사용하여 더 야심 찬 목표를 설정할 수 있습니다. 공간이 부족하여 리더와 페이지 번호가 자신의 라인에 배치되면 이전 라인을 오른쪽에서 고정된 여백 내에 리더로 채웁니다.
추가 선을 강제로 적용할 때 리더의 오른쪽 가장자리가 일치하는 방식에 유의하세요.
을 조정하여 추가 리더가 다음 줄에 표시되는 페이지 번호 위의 오른쪽 여백으로 돌출되는 정도를 제어할 수 있습니다 \rmargin
.
\documentclass[a5paper]{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\parindent=0pt % optional, mimick TOC environment
\newdimen\pagenumwidth \pagenumwidth=0.5cm % reserved right margin space for page numbers
% leaders will reach flush with it
\newdimen\rmargin \rmargin=0.5cm % reserved right margin for leaders followed by linbreal
\newdimen\minspc \minspc=1.6em % if this much hspace isn't available for leaders, break
\def\fillwith{\hbox to 1ex {\hss.\hss}}
\def\DotsAndPage#1{%
\leaders\fillwith\hfil
\hskip \rmargin
\penalty50
\hskip - \rmargin plus -1fil % Thanks Gustavo
\hbox{}
\unskip\leaders\fillwith\hskip \minspc plus 1fill
\nobreak
{\bfseries\normalsize \hbox to \pagenumwidth{\hfil#1}}%
\break}
\begin{document}
{
\hsize=2.4in
A chapter with a title any \DotsAndPage{1}%\par
A chapter with a title A chapter with a title A chapter with a title\DotsAndPage{13}%\par
A chapter with a title A chapter with a title A chapter with a title with a title so t\DotsAndPage{132}
A chapter with a title A chapter with a title A chapter with a title with a title so th\DotsAndPage{132}
\rmargin=0.25cm % leaders tail bite into right margin
A chapter with a title with a title so th\DotsAndPage{132}
\rmargin=-0.1cm
A chapter with a title with a title so th\DotsAndPage{132}\par
}
\end{document}