我目前正在写一篇论文,需要您帮助我设计目录布局。目录中的文本设置为双倍行距,如下所示:
\documentclass[11pt,oneside,a4paper,ngerman]{article}
\usepackage[left=2.5cm,top=3cm,right=2.5cm,bottom=3cm,bindingoffset=0.5cm]
{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xr}
\usepackage{tocloft}
\usepackage{babel}
\usepackage{times}
\usepackage{filecontents}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amssymb}
\usepackage{caption}
\usepackage[nottoc]{tocbibind}
\usepackage[toc,page]{appendix}
\usepackage{blindtext}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]
{hyperref}
\usepackage[noabbrev]{cleveref}
\makeatletter
\begin{document}
\lstset{style=mystyle}
\renewcommand{\lstlistingname}{Quellcode}
\renewcommand{\lstlistlistingname}{\lstlistingname verzeichnis}
\renewcommand{\refname}{Literaturverzeichnis}
\newcommand{\algrule}[1][.2pt]{\par\vskip.5\baselineskip\hrule height
#1\par\vskip.5\baselineskip}
\pagenumbering{roman}
\doublespacing
\tableofcontents
\pagebreak
\listoftables
\pagebreak
\listoffigures
\pagebreak
\pagenumbering{arabic}
\singlespacing
\begin{figure}
\centering
foo
\caption{foo}
\end{figure}
\begin{table}
\centering
bar
\caption{bar}
\end{table}
\blinddocument
\end{document}
我想更改并减少 LoT、LoF 和源代码列表的条目之间的间距,同时 ToC(章节、小节)中其余条目的间距保持双倍间距。
答案1
一个比较棘手的方法就是手动将 negative 插入\vskip
到 ToC 中。适应您新提供的 MWE 相当容易。将 改为\vskip-1em
。\vspace{-1em}
这样可行:
\documentclass[11pt,oneside,a4paper,ngerman]{article}
\usepackage[left=2.5cm,top=3cm,right=2.5cm,bottom=3cm,bindingoffset=0.5cm]
{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xr}
\usepackage{tocloft}
\usepackage{babel}
\usepackage{times}
\usepackage{filecontents}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amssymb}
\usepackage{caption}
\usepackage[nottoc]{tocbibind}
\usepackage[toc,page]{appendix}
\usepackage{blindtext}
\usepackage{listings}
\usepackage[
unicode=true,
pdfusetitle,
bookmarks=true,
bookmarksnumbered=false,
bookmarksopen=false,
breaklinks=false,
pdfborder={0 0 0},
backref=false,
colorlinks=false]
{hyperref}
\usepackage[noabbrev]{cleveref}
\renewcommand{\lstlistingname}{Quellcode}
\renewcommand{\lstlistlistingname}{\lstlistingname verzeichnis}
\renewcommand{\refname}{Literaturverzeichnis}
\newcommand{\algrule}[1][.2pt]{\par\vskip.5\baselineskip\hrule height
#1\par\vskip.5\baselineskip}
\begin{document}
\pagenumbering{roman}
\pagebreak
\doublespacing
\tableofcontents
\pagebreak
\listoftables
\addtocontents{toc}{\vspace{-1em}}
\pagebreak
\listoffigures
\addtocontents{toc}{\vspace{-1em}}
\pagebreak
\lstlistoflistings
\addcontentsline{toc}{section}{Quellcodeverzeichnis}
\pagebreak
\pagenumbering{arabic}
\singlespacing
\begin{figure}
\centering
foo
\caption{foo}
\end{figure}
\begin{table}
\centering
bar
\caption{bar}
\end{table}
\blinddocument
\end{document}