
在我的文檔中的一個實例中,我有以下內容:
\section{\large Multi-worded section heading }
目前在目錄中,它看起來比所有其他標題都大(毫無疑問,因為這就是我指示 LaTeX 執行的操作)。我如何更改它,使其與其他標題相同?
答案1
我的理解是:您只想更改一個/幾個部分標題中的字體(並非全部)。最簡單的方法是使用\section
like的可選參數
%\section[optional content]{regular content }
\section[Multi-worded section heading]{\large Multi-worded section heading }
以便可選的未格式化內容用於運行標題和目錄。這是帶有類別的 MWE article
(你沒有告訴哪個類別!)
\documentclass{article}
\begin{document}
\tableofcontents
\section{Some section}
\section[A section]{\Huge A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\section{Some section again}
\end{document}
如果節數較小,這看起來肯定很難看。更好的方法是定義一個新命令,例如:
\makeatletter
\newcommand\mysection{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Huge\bfseries}} %%<-- \Large replaced by \Huge
\makeatother
並按如下方式使用它:
\documentclass{article}
\makeatletter
\newcommand\mysection{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Huge\bfseries}}
\makeatother
\begin{document}
\tableofcontents
\section{Some section}
\mysection{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\section{Some section again}
\end{document}
如果您想將這些變更套用到所有部分,您最好使用sectsty
(如 Werner 連結:部分使用小寫字母,但目錄中不使用小寫字母或使用titlesec
包( titleformat*{\section}{\Huge}
)。