我当前的文档有问题。部分标题相当长,目录中的换行符不起作用。不知何故,当我使用 texstudio 编译它时,它可以工作。(其他东西不起作用)但是当我使用 texcenter 和配置文件 LaTeX-PS-PDF 编译它时,它会产生一个看起来很糟糕的目录。
\documentclass[
12pt,
footheight=22pt,
openright,
a4paper,
twoside,
listof=totoc,
bibliography=totocnumbered,
final]{scrbook}
\usepackage{scrhack}
\usepackage{geometry}
\geometry{inner=2.5cm, outer=5cm, head=22pt}
\raggedbottom
\frenchspacing
\usepackage[ngerman,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb, amsfonts, pifont, float, color,setspace}
\usepackage{notoccite} %keeps cite numbers from text in toc...
\usepackage{graphicx}
\usepackage[format=plain,justification=justified,singlelinecheck=false,font={stretch=1.125,small,sf},labelfont=bf,labelsep=space]{caption}
\usepackage[section]{placeins} %keeps floats in section
\usepackage[pdfpagelayout=TwoColumnRight,colorlinks=false, pdfborder={0 0 0}, bookmarksnumbered=true]{hyperref}
\usepackage[hyphenbreaks]{breakurl}
\usepackage{footnote}
\usepackage{tabularx}
\makesavenoteenv{tabular}
\captionsetup{width=.9\textwidth} %90% textwidth for all captions
\usepackage{psfrag}
\usepackage[right]{eurosym}
\usepackage[super,square,comma,sort&compress]{natbib} %hochstellen des cite befehls
\usepackage[version=3]{mhchem}
\apptocmd{\thebibliography}{\raggedright}{}{}%url formatting in biblio
\usepackage{verbatim}
%list of figures spacing
\makeatletter
\renewcommand*\l@figure{\@dottedtocline{1}{1em}{3.2em}}
\makeatother
\usepackage[final]{listings}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[headsepline,footsepline]{scrlayer-scrpage}
\automark[section]{section}
%\renewcommand*{\partmark}[1]{}
\setkomafont{pageheadfoot}{\normalcolor\footnotesize\scshape}
\setkomafont{pagenumber}{\normalfont\normalsize}
\clearpairofpagestyles
\ihead{\scriptsize\headmark}
\ohead*{\pagemark}
\clubpenalty = 100000
\widowpenalty = 100000
\displaywidowpenalty = 100000
\interlinepenalty=5000 %dont break sentences
%Zeilenabstand
\linespread{1.5}
\begin{document}
\tableofcontents
\addtocontents{toc}{\protect\enlargethispage{0.5cm}}
\chapter{Chapter 1}
\section{Section with a really really really long title I mean really really long title}
\subsection{Even worse title for a subsection once you finished reading you feel like you read a book}
\end{document}
有人知道我该如何修复它吗?
答案1
dvips 驱动程序无法断开链接(这也许会改变,但不会直接改变)。
如果你坚持使用 latex->ps 路线,你可以使用选项breaklinks
。这对于打印来说是可以的,但是链接区域会出错:
\documentclass[]{scrbook}
\usepackage[breaklinks]{hyperref}
\usepackage{breakurl}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Section with a really really really long title I mean really really long title}
\subsection{Even worse title for a subsection once you finished reading you feel like you read a book}
\end{document}
一个更好的选择(也是 hyperref 文档中推荐的选项)是linktocpage
将链接放在页码上:
\usepackage[linktocpage]{hyperref}
答案2
LaTeX 分段命令都接受可选参数和必需参数。如果使用可选参数,则该参数将用于目录和任何页面标题条目,而必需参数用于文档中的章节标题;否则,必需参数将用于所有三个位置。
\section[Short ToC entry]{Long main document title entry}