How to remove the section's title from the header

1,688

In the following suggestion I will remove all the unrelated packages and code. Especially you can remove the line \pagestyle{headings} because it is overwritten by the later \pagestyle{fancy}.

For a onesided document you can remove the left header entry:

\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}

Or you can declare the contents of the page header:

\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}

enter image description here

Share:
1,688

Related videos on Youtube

J doe
Author by

J doe

Updated on September 24, 2020

Comments

  • J doe
    J doe about 3 years

    In my header right now i have the title of the chapter and the title of the current section, I would like to remove the title of the section of the header and leavejust the chapter title

    used packages

    \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}
    
    • Skillmon
      Skillmon about 6 years
      This depends on the used packages and classes. Please provide a complete MWE.
    • J doe
      J doe about 6 years
      i just edit my question
    • Bernard
      Bernard about 6 years
      Welcome to TeX SX! This is not a full compilable code.
    • J doe
      J doe about 6 years
      i just need to know to modify the text on the header
    • magula
      magula about 6 years
      Please follow the link Skillmon gave you. As Bernard said, the code you provide should be compilable. It also should be minimal (without unnecessary parts not connected to the problem), as explained in that link.
    • Bernard
      Bernard about 6 years
      Just a comment aside: your preamble loads several packages which conflict with each other (sectsty and titlesec, titletoc and tocloft