过长的 \section 标题会导致奇怪的花哨页眉和目录

过长的 \section 标题会导致奇怪的花哨页眉和目录

下面是我的文档。我的问题是,只要 \section 标题太长,它们就会与徽标重叠,并且目录看起来很奇怪,有缩进,而这些缩进本来不应该有。有没有办法减小标题字体大小或使其适应 section-title 长度?

以下是一条链接到文档中您可以看到重叠等等。

\documentclass[a4paper,10pt,titlepage,twoside]{article}

\usepackage[ngerman]{babel}

%lots of maths packages
\usepackage{tikz-3dplot,framed,enumitem,bbm}

%break after each section
\usepackage{titlesec}
\newcommand{\sectionbreak}{\vspace{6mm}}

\usepackage[margin=1.5cm, headheight=12.6pt, includeheadfoot, left=2cm, right=2cm]{geometry}%new borders

\usepackage{fancyhdr}%header
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RE,LO]{\scshape\nouppercase{{\rightmark}}}
\fancyhead[LE]{\includegraphics[width=1cm]{tub_logo.png}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{1.2pt}
\setlength\headheight{25pt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{titlepage}
\begin{center}
    {\scshape\Large Technische Universität Berlin \par}
    % title page (omitted text etc. because its not relevant)
\tableofcontents
\end{center}   
\end{titlepage}


\section{Vollständigkeit, Kompaktheit, endliche Durchschnittseigenschaft und der Banachsche Fixpunktsatz}

text
\end{document}  

答案1

这是基于的目录解决方案titletoc

无关:自 3.10 版起,的语言选项babel应随文档类一起加载,以便所有依赖语言的包都知道文档语言。您还可以为 设定两​​个值\headheight

\documentclass[a4paper, 10pt, titlepage, twoside, ngerman]{article}

\usepackage{babel}

%lots of maths packages
\usepackage{tikz, tikz-3dplot,framed,enumitem,bbm}

%break after each section
\usepackage{titlesec}
\newcommand{\sectionbreak}{\vspace{6mm}}

\usepackage[margin=1.5cm, headheight=12.6pt, includeheadfoot, hmargin=2cm]{geometry}%new borders

\usepackage{fancyhdr}%header
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RE,LO]{\scshape\nouppercase{{\rightmark}}}
\fancyhead[LE]{\includegraphics[width=1cm]{tub_logo.png}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{1.2pt}
\setlength\headheight{25pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titletoc}
\titlecontents{section}[0em]{\medskip\bfseries}% formatting for numbered sections
{\thecontentslabel\quad\parbox[t]{36pc}}
{}% for unnumbered sections
{\hfill\contentspage}%

\usepackage{lipsum}

\begin{document}
\begin{titlepage}
\begin{center}
    {\scshape\Large Technische Universität Berlin \par}
    % title page (omitted text etc. because its not relevant)
\tableofcontents
\end{center}
\end{titlepage}

\section{Vollständigkeit, Kompaktheit, endliche Durchschnittseigenschaft und der Banachsche Fixpunktsatz}

\lipsum

\section{Vollständigkeit, Kompaktheit, endliche Durchschnittseigenschaft und der Banachsche Fixpunktsatz}

\lipsum

\section{Vollständigkeit, Kompaktheit, endliche Durchschnittseigenschaft und der Banachsche Fixpunktsatz}

\lipsum

\section{Vollständigkeit, Kompaktheit, endliche Durchschnittseigenschaft und der Banachsche Fixpunktsatz}

\lipsum

\end{document} 

在此处输入图片描述

相关内容