如何从页眉中删除章节标题

如何从页眉中删除章节标题

现在,在我的标题中,我有章节标题和当前部分的标题,我想删除标题部分的标题并保留章节标题

使用的包

\documentclass[12pt]{report}
\usepackage{array}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{sectsty}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{dcolumn,longtable,booktabs}
\usepackage{enumitem}
\usepackage[utf8x]{inputenc} 
\usepackage{soul}
\renewcommand{\baselinestretch}{1.5} 
\usepackage{pifont}
\usepackage{caption}
\usepackage{mathptmx}
\pagestyle{headings}
\usepackage[nottoc]{tocbibind}
\usepackage{comment}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{titlesec}
\usepackage{titletoc}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum}
\usepackage{chngcntr}\counterwithout{figure}{chapter}
\usepackage{float}
\usepackage{siunitx}
\renewcommand{\thefigure}{\arabic{figure}}
\usepackage[table]{xcolor}
\usepackage{textcomp}
\renewcommand\thesection{\Roman{section}}
\renewcommand{\headrulewidth}{0.4pt}
\sisetup{math-micro=\text{µ},text-micro=µ}
\captionsetup[table]{name=Tableau}
\sectionfont{\fontsize{12}{15}\selectfont}
\subsectionfont{\fontsize{12}{15}\selectfont}
\usepackage{tocloft}
\renewcommand{\cftsecaftersnum}{.} 
\renewcommand{\thetable}{\arabic{table}}
\usepackage[labelfont=bf]{caption}

答案1

在以下建议中,我将删除所有不相关的包和代码。特别是您可以删除该行,\pagestyle{headings}因为它被后面的覆盖了\pagestyle{fancy}

对于单面文档,您可以删除左侧标题条目:

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}% option replaced

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead[L]{}

\usepackage{blindtext}% only for dummy text
\begin{document}
\blinddocument
\end{document}

或者也可以声明页眉的内容:

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}% option replaced

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{
  \fancyhead[R]{\slshape\leftmark}
}

\usepackage{blindtext}% only for dummy text
\begin{document}
\blinddocument
\end{document}

在此处输入图片描述

相关内容