有没有办法减少部分标题和章节标题之间的垂直间距,以及减少章节和下一节之间的间距?我寻找解决方案,但大多数人似乎使用一些特殊的toc
- 软件包,这些软件包是必需的吗?还是只需使用 就可以做到这一点koma-script
?
\documentclass[
final,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\end{document}
更新
我的目标是模仿-toc 样式,因此我在 esdd 解决方案的头文件中的、图形列表和参考书目classicthesis
之间添加了更多空间(通过添加)。有没有更优雅的方法来实现相同的结果?listoftable
\addtocontents{toc}{\protect\vspace{.25\baselineskip}}
\documentclass[
final,
fontsize=12pt,
open=right,
twoside = true,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
DIV=calc,
BCOR=8.72mm,
chapterprefix=false
]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}% <- load this package before tocstyle
\usepackage{biblatex}
\usepackage{ebgaramond}
\usepackage{microtype}
%\usepackage[fullfamily,opticals,minionint,footnotefigures]{MinionPro}
\recalctypearea
\definecolor{red}{RGB}{192,0,0}
\definecolor{halfgray}{gray}{0.55}
\setkomafont{disposition}{\rmfamily}
\addtokomafont{chapter}{\normalsize\scshape}
\addtokomafont{section}{\normalsize\scshape}
\addtokomafont{subsection}{\normalsize\itshape}
\setkomafont{chapterentrypagenumber}{\normalfont}
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
\setkomafont{chapterentrypagenumber}{\normalfont}
\setkomafont{part}{\large\color{red}\scshape\MakeUppercase}
\renewcommand*{\partpagestyle}{empty}
\setkomafont{part}{\large\color{red}\scshape\MakeUppercase}
\setkomafont{partnumber}{\large}
\setkomafont{partentry}{\color{red}}
\renewcommand\addparttocentry[2]{%
\addtocentrydefault{part}{\protect\large\textsc{\lowercase{#1}}}{%
\protect\texorpdfstring{\large\scshape\lowercase{#2}}{#2}}}
\setkomafont{partentrypagenumber}{\normalfont\color{red}}
\RedeclareSectionCommand[tocnumwidth=1.3em,innerskip=2mm]{part}
%%%%%%%%%%%%%%%%%%%%
\usepackage{xpatch}
\xapptocmd\appendix{%
\addtocontents{toc}{\value{tocdepth}=0}%
}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{textcase}
\usepackage{fontaxes}
\usepackage{pdfpages}
\usepackage{etoolbox}
\usepackage{bm}
\DeclareMathAlphabet\EuRoman{U}{eur}{m}{n}
\SetMathAlphabet\EuRoman{bold}{U}{eur}{b}{n}
\newcommand{\eurom}{\EuRoman}
\makeatletter
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
\sbox\feline@chapter{%
\resizebox{!}{#1}{\setlength{\fboxsep}{0pt}%
\colorbox{white}{\color{halfgray}$\bm{\eurom\thechapter}$}}}%!!!!!Error?
\raisebox{\depth}{\usebox{\feline@chapter}}%
}
\renewcommand\chapterformat{\sbox\feline@chapter{\feline@chapter@marker[1.61cm]}%
\makebox[0pt][l]{\hspace*{\marginparsep}\usebox\feline@chapter}}
\renewcommand\chapterlinesformat[3]{%
\parbox[t]{\textwidth}{\raggedchapter\MakeUppercase{#3}}%
#2%
\\\rule{\textwidth}{.4pt}
}
\renewcommand*{\sectionlinesformat}[4]{%
\@hangfrom{\hskip #2#3}{\ifstr{#1}{section}{\MakeTextLowercase{#4}}{#4}}%
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tocstyle}
\newtocstyle
[KOMAlike]% parent style
[entryvskip]% exclude the initial vertical skip
{myown}% name of the new style
{\settocstylefeature[-1]{entryvskip}{12pt}}% set the vertical skip before a part entry
\usetocstyle{myown}
\usepackage[hidelinks]{hyperref}
\areaset[current]{336pt}{747pt}% 609 + 33 + 42 head \the\footskip
\setlength{\marginparwidth}{7.5em}%
\setlength{\marginparsep}{2em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\renewcommand*{\chapterheadendvskip}{%
\vspace{-.5\baselineskip}%
}
\begin{document}
\microtypesetup{protrusion=false}
\tableofcontents
\listoffigures
\addtocontents{toc}{\protect\vspace{.25\baselineskip}}%%%%%%%%%%%%%%%%%%!!!
\listoftables
% \addtocontents{toc}{\protect\vspace{.25\baselineskip}}
%\lstlistoflistings
\cleardoubleoddpage
\microtypesetup{protrusion=true}
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\blinddocument
\microtypesetup{protrusion=false}
\addtocontents{toc}{\protect\vspace{12pt}}%%%%%%%%%%%%%%%%%%%!!!
\printbibliography
\addcontentsline{toc}{chapter}{Bibliography}
\microtypesetup{protrusion=true}
\part{Additional Stuff}
\appendix
\chapter{Even More Stuff}
\end{document}
答案1
更新
随着当前KOMA-Script 版本 3.20可以轻松声明目录条目的新样式。因此,您可以为未编号的章节定义自己的样式,并在此之前提供更多垂直空间。
\documentclass[
final,
paper=a4,
listof=totoc,
bibliography=totoc,
captions=tableheading,
numbers=noenddot,
headings=big,
chapterprefix=false
]
{scrreprt}[2016/05/10]% needs version 3.20 or newer
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage[backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}% example bibdatei
\RedeclareSectionCommand[
tocbeforeskip=1.25em plus 1pt
]{part}
\addtokomafont{partentry}{\color{red!70!black}}
\RedeclareSectionCommand[
tocbeforeskip=0pt plus .2pt,
]{chapter}
\DeclareTOCStyleEntry[
beforeskip=.75em plus 1pt,
level=0,
indent=0pt,
numwidth=0pt,
]{chapter}{unnumberedchapter}
\renewcommand\addchaptertocentry[2]{%
\ifstr{#1}{}
{\addtocentrydefault{unnumberedchapter}{#1}{#2}}
{\addtocentrydefault{chapter}{#1}{#2}}
}
%\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\blinddocument
\nocite{westfahl:space}% nur für Beispielbibliography
\printbibliography
\addpart{Additional Stuff}
\end{document}
原始答案
这里建议使用tocstyle
alpha 版本但属于 KOMA-Script 包一部分的包。它也可以与 一起使用\addpart
。
\documentclass[
final,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false
]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}% <- load this package before tocstyle
\usepackage{tocstyle}
\newtocstyle
[KOMAlike]% parent style
[entryvskip]% exclude the initial vertical skip
{myown}% name of the new style
{%
\settocstylefeature[-1]{entryvskip}{12pt}% set the vertical skip before a part entry
%\settocstylefeature[0]{entryvskip}{2pt}% set the vertical skip before a chapter entry
}
\usetocstyle{myown}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\blinddocument
\addpart{Additional Stuff}
\end{document}
运行多次即可获得
另一种可能性是重新定义\addparttocentry
,\addchaptertocentry
但在不利的地方可能会出现分页符。
\documentclass[
final,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false
]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{hyperref}
\renewcommand\addparttocentry[2]{%
\addtocontents{toc}{\protect\vspace{-4ex}}%
\addtocentrydefault{part}{#1}{#2}%
}
\renewcommand\addchaptertocentry[2]{%
\addtocontents{toc}{\protect\vspace{-2ex}}%
\addtocentrydefault{chapter}{#1}{#2}%
}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\blinddocument
\addpart{Additional Stuff}
\end{document}
结果:
答案2
以下是一种方法(版本 2 也会减少部分间空间):
\documentclass[
final,
paper=a4,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{hyperref}
\let\origpart\part
\renewcommand{\part}[1]{\origpart{#1}\addtocontents{toc}{\protect\vspace{-2ex}}}% comment this line in version 2
%\renewcommand{\part}[1]{\addtocontents{toc}{\protect\vspace{-\baselineskip}}\origpart{#1}\addtocontents{toc}{\protect\vspace{-2ex}}}% uncomment this line in version 2
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\addtocontents{toc}{\protect\vspace{-\baselineskip}}% comment this line in version 2
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\end{document}