![章节编号和名称以斜体显示](https://linux22.com/image/248892/%E7%AB%A0%E8%8A%82%E7%BC%96%E5%8F%B7%E5%92%8C%E5%90%8D%E7%A7%B0%E4%BB%A5%E6%96%9C%E4%BD%93%E6%98%BE%E7%A4%BA.png)
请注意,我“继承”了我想改编的序言:
\documentclass[a4paper,12pt]{book}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.1pt} % for upper line
\renewcommand{\footrulewidth}{0.1pt} % for lower line
\fancyhead[LE,RO]{\itshape \nouppercase \rightmark}
\fancyhead[LO,RE]{\itshape \nouppercase \leftmark}
\fancyfoot[C]{\thepage}
\usepackage{fancybox}
\usepackage{xcolor}
\usepackage{framed}
\numberwithin{equation}{section} % numbering according to the section
\bibliographystyle{plain} %Choose a bibliograhpic style
\setlength{\headheight}{15pt}
%\parindent0em
\parskip1ex
有了上述序言,每当我创建新章节,即 时\section{My Section}
,章节编号和文本My Section
都会定期显示。为了使文本变成斜体,我将其放入\textit{My Section}
。但是,这种方式不会使章节编号变成斜体。我应该如何更改才能使章节编号和名称始终为斜体?
答案1
将以下内容添加到您的序言中:
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
% {\normalfont\Large\bfseries}}% DELETED
{\normalfont\Large\bfseries\itshape}}% ADDED
\makeatother