在 LOF 条目之间添加垂直和水平间距

在 LOF 条目之间添加垂直和水平间距

有人知道我该怎么做吗在我的 LOF 条目之间添加垂直和水平间距

\documentclass[12pt,a4paper,twoside]{report} %openright

%Schriftart Arial - ACHTUNG: Compile with XeLaTeX (not PDFLaTeX)!
\usepackage{fontspec}
\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{Arial}[Scale = 1.0]

%Seitenlayout
\usepackage[top=2.5cm, bottom=2cm, left=2.5cm, right=2.5cm,paper=a4paper]{geometry}

%Deutsche Umlaute
\usepackage{ngerman}

%Zitierungen in der richtigen Reihenfolge
\usepackage{cite} 

%Längenangaben für den Abstand zwischen zwei Absätzen. 
\usepackage{parskip} 

%Zeilenabstand ändern
\usepackage[onehalfspacing]{setspace} 

%Farbige Texte etc
\usepackage{color} 

%Graphiken und Bilder
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{psfrag}
\usepackage{wrapfig}

%Tabellenumgebung
\usepackage{tabularx}
\usepackage{booktabs} %\toprule, \midrule, \bottomrule

%Mathematische Symbole und Zeichen
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}

%Algorithm Package
\usepackage[ruled,vlined]{algorithm2e}

%Kopfzeile
\usepackage{fancyhdr}

%Kapitelanzeige und -platzierung im Text
\usepackage[clearempty]{titlesec}
\titleformat{\chapter}{\normalfont\fontsize{16pt}{0}\bfseries}{\thechapter.}{9pt}{}
\titleformat{\section}{\normalfont\fontsize{14pt}{0}\bfseries}{\thesection}{9pt}{}
\titleformat{\subsection}{\normalfont\fontsize{12pt}{0}\bfseries}{\thesubsection}{9pt}{}
\titlespacing*{\chapter}{0pt}{-22pt}{4pt}



%Verzeichnisse
\usepackage[notindex, nottoc, numbib]{tocbibind} %TOC

\usepackage{tocbasic}

\DeclareTOCStyleEntry[
  indent=0pt,
  entrynumberformat=\useprefixfigure{\figurename},
  dynnumwidth,
  numsep=1em
]{tocline}{figure}
\newcommand\useprefixfigure[2]{#1\hspace{3pt}#2:\hfill}



%Formatierung Inhaltsverzeichnis
\usepackage{titletoc}
\contentsmargin{2em}
\dottedcontents{chapter}[21pt]{\addvspace{15pt}\bfseries}{20pt}{9.5pt}
\dottedcontents{section}[50pt]{\addvspace{3pt}}{2.3em}{9.5pt}
\dottedcontents{subsection}[89pt]{\addvspace{3pt}}{3.2em}{9.5pt}



% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
% Formatierung der Kopfzeile
% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
\setlength{\headheight}{0.6cm}

\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL,OR]{\fontsize{8}{10} \selectfont \thepage}
\fancyhead[ER,OL]{\fontsize{8}{10} \selectfont \leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[EL,OR]{\fontsize{8}{10} \selectfont \thepage}
\fancyhead[ER,OL]{\fontsize{8}{10} \selectfont \nouppercase \leftmark}
}


% = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
\begin{document}
\listoffigures
\newpage

\begin{figure}[!ht]
  \centering
  \rule{2cm}{2cm}
  \caption{test figure one}
  \label{fig:test1}
\end{figure}

\begin{figure}[!ht]
  \centering
  \rule{2cm}{2cm}
  \caption{test figure two}
  \label{fig:test2}
\end{figure}


\end{document}

因此,对于水平间距,我认为

\newcommand\useprefixfigure[2]{#1\hspace{3pt}#2:\hfill}

可以改变,但到目前为止,我只能调整“Abbildung”和“1.1”之间的空间\hspace{3pt}。我希望“1.1”紧挨着冒号“:”,然后与图形标题定义间距。但是当我改变`\hfill时,冒号突然不再是“1.1”旁边了。有人知道这是为什么吗?该怎么做?对于垂直空间,我仍然一无所知……

提前致谢!

答案1

要在每个figure条目前添加垂直空间,请使用选项beforeskip。我建议也添加一些胶水。最宽数字与其条目之间的水平空间可以通过以下方式设置numsep

\usepackage{tocbasic}
\DeclareTOCStyleEntry[
  indent=0pt,
  entrynumberformat=\useprefixfigure{\figurename},
  dynnumwidth,
  numsep=.5em,% <- changed
  beforeskip=3pt plus .2pt% <- added
]{tocline}{figure}
\newcommand\useprefixfigure[2]{#1\hspace{3pt}#2:\hfill}

您将获得相同的结果

\DeclareTOCStyleEntry[
  ...
  numsep=0pt,% <- changed
  ...
]{tocline}{figure}
\newcommand\useprefixfigure[2]{#1\hspace{3pt}#2:\hspace{.5em}\hfill}% <- changed

例子:

\documentclass[10pt,a4paper,twoside]{report} %openright

%Schriftart Arial - ACHTUNG: Compile with XeLaTeX (not PDFLaTeX)!
\usepackage{fontspec}
\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{Arial}[Scale = 1.0]
\usepackage[top=2.5cm, bottom=2cm, left=2.5cm, right=2.5cm,
  %paper=a4paper,% not needed because of the class option a4paper
  headheight=.6cm% set headheight by geometry
]{geometry}
\usepackage[ngerman]{babel}%package ngerman is deprecated
\usepackage{cite} 
\usepackage{parskip} 
\usepackage[onehalfspacing]{setspace} 
\usepackage{color} 
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{psfrag}
\usepackage{wrapfig}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{fancyhdr}
\usepackage[clearempty]{titlesec}
\titleformat{\chapter}{\normalfont\fontsize{16pt}{0}\bfseries}{\thechapter.}{9pt}{}
\titleformat{\section}{\normalfont\fontsize{14pt}{0}\bfseries}{\thesection}{9pt}{}
\titleformat{\subsection}{\normalfont\fontsize{12pt}{0}\bfseries}{\thesubsection}{9pt}{}
\titlespacing*{\chapter}{0pt}{-22pt}{4pt}
\usepackage[notindex, nottoc, numbib]{tocbibind} %TOC

\usepackage{tocbasic}
\DeclareTOCStyleEntry[
  indent=0pt,
  entrynumberformat=\useprefixfigure{\figurename},
  dynnumwidth,
  numsep=.5em,% <- changed
  beforeskip=3pt plus .2pt% <- added
]{tocline}{figure}
\newcommand\useprefixfigure[2]{#1\hspace{3pt}#2:\hfill}

\DeclareTOCStyleEntry[
  linefill=\bfseries\TOCLineLeaderFill,
  numwidth=1.7em,
  indent=1pt,
  beforeskip=15pt plus 1pt
]{tocline}{chapter}
\DeclareTOCStyleEntry[
  indent=1.87em,
  beforeskip=3pt plus .2pt
]{tocline}{section}
\DeclareTOCStyleEntry[
  indent=4.22em,
  beforeskip=3pt plus .2pt
]{tocline}{subsection}

\makeatletter
\renewcommand\@tocrmarg{2em}
\makeatother

\pagestyle{fancy}
\fancyhf{}
\fancyhead[EL,OR]{\fontsize{8}{10} \selectfont \thepage}
\fancyhead[ER,OL]{\fontsize{8}{10} \selectfont \leftmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[EL,OR]{\fontsize{8}{10} \selectfont \thepage}
\fancyhead[ER,OL]{\fontsize{8}{10} \selectfont \nouppercase \leftmark}
}

\usepackage{blindtext}% only for dummy text in the example

\begin{document}
\tableofcontents
\listoffigures

\blinddocument
\begin{figure}[!ht]
  \centering
  \rule{2cm}{2cm}
  \caption{test figure one}
  \label{fig:test1}
\end{figure}
\begin{figure}[!ht]
  \centering
  \rule{2cm}{2cm}
  \caption{test figure two}
  \label{fig:test2}
\end{figure}
\end{document}

运行三次即可获得

在此处输入图片描述

相关内容