更改文档中章节标题的字体大小,而不会弄乱目录和标题

更改文档中章节标题的字体大小,而不会弄乱目录和标题

我知道这在技术上是错误的,我甚至不应该尝试这样做...尽管如此,我有一个文档,其中的节标题大小设置为,Large并且在任何地方都可以正常工作除了一个部分太长了。我想更改字体大小仅限该部分标题使其看起来更漂亮(即使与其他部分标题的大小不一致)

我唯一能做到的是改变尺寸本地通过做

\section{\large{My very long section title}}

然而,这会使标题和目录变得混乱,因为那里的字体也发生了变化。

我曾尝试使用minipage或包装部分命令\begin{small}--\end{small},但由于部分标题大小是在其他地方定义的,所以没有任何变化......

这是一个 mwe:

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

\usepackage{lipsum}
\usepackage{fancyhdr}   % To change header and footers
    \pagestyle{fancy}       % Turn on the style
    \fancyhf{}              % Clears everything in the header and footer
    \fancyfoot[CE,CO]{\thepage}         %Page number centered in all pages
    \fancyhead[LE]{\slshape\nouppercase{\leftmark}}     %Chapter title in the outer margin of even pages
    \fancyhead[RO]{\slshape\nouppercase{\rightmark}}    %Section title in the outer margin of odd pages

\begin{document}

\tableofcontents

\chapter{My chapter}
\lipsum[3-6]

\section{This title is great}
\lipsum[3-10]

\section{This title is  veryvery veryveryvery increadibly and mindblowingly very very superlong}
The title is 3 lines long! It would look much better if I could just very slightly reduce the font size, so that it fits in two lines.

\bigskip

\lipsum[3-2]

\section{Some other nice title}
\lipsum[3-8]

\section{\large{This title is  veryvery veryveryvery increadibly and mindblowingly very very superlong}}
Great! it is now 2 lines... but the header is huge! and look at the table of contents!!

\bigskip

\lipsum[3-2]

\end{document}

结果是这样的: 目录

太大

混乱的标题/目录

答案1

您可以使用以下内容:\chapter[short title in header & TOC]{long title in document}

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

\usepackage{lipsum}
\usepackage{fancyhdr}   % To change header and footers
    \pagestyle{fancy}       % Turn on the style
    \fancyhf{}              % Clears everything in the header and footer
    \fancyfoot[CE,CO]{\thepage}         %Page number centered in all pages
    \fancyhead[LE]{\slshape\nouppercase{\leftmark}}     %Chapter title in the outer margin of even pages
    \fancyhead[RO]{\slshape\nouppercase{\rightmark}}    %Section title in the outer margin of odd pages

\begin{document}

\tableofcontents

\chapter{My chapter}
\lipsum[3-6]

\section{This title is great}
\lipsum[3-10]

\section[This title is a bit shorter]{This title is  veryvery veryveryvery increadibly and mindblowingly very very superlong}
The title is 3 lines long! It would look much better if I could just very slightly reduce the font size, so that it fits in two lines.

\bigskip

\lipsum[3-2]

\section{Some other nice title}
\lipsum[3-8]

\chapter[This title is short]{\large This title is  veryvery veryveryvery increadibly and mindblowingly very very superlong}

Great! it is now 2 lines... but the header is huge! and look at the table of contents!!

\bigskip

\lipsum[3-2]

\end{document}

在此处输入图片描述

在此处输入图片描述

答案2

使用组内的\titleformat*命令,如下所示:titlesec

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

\usepackage{lipsum}
\usepackage{titlesec} 
\usepackage{fancyhdr} % To change header and footers
    \pagestyle{fancy} % Turn on the style
    \fancyhf{} % Clears everything in the header and footer
    \fancyfoot[CE,CO]{\thepage} %Page number centered in all pages
    \fancyhead[LE]{\slshape\nouppercase{\leftmark}} %Chapter title in the outer margin of even pages
    \fancyhead[RO]{\slshape\nouppercase{\rightmark}} %Section title in the outer margin of odd pages

\begin{document}

\tableofcontents

\chapter{My chapter}
\lipsum[3-6]

\section{This title is great}
\lipsum[3-10]

\section{This title is veryvery veryveryvery increadibly and mindblowingly very very superlong}
The title is 3 lines long! It would look much better if I could just very slightly reduce the font size, so that it fits in two lines.

\bigskip

\lipsum[3-2]

\section{Some other nice title}
\lipsum[3-8]

{
\titleformat*{\section}{\Large\bfseries\itshape}
\section{This title is veryvery veryveryvery increadibly and mindblowingly very very superlong}}
Great! it is now 2 lines... but the header is huge! and look at the table of contents!!

\bigskip

\lipsum[3-2]

\section{Some other nice title}

\end{document} 

在此处输入图片描述

在此处输入图片描述

相关内容