我知道這在技術上是錯誤的,我什至不應該嘗試這樣做...儘管如此,我有一個文檔,其節標題大小設置為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}