3

I am using the fancyhdr package to create a heading for my document. It is working really good, but on the odd pages on the right side I get "1.1. Section 1", but what I want is "1.1 Section 1". Could you help me with erasing the dot?

\documentclass[12pt,twoside]{report} 
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}} %chapter oben ohne Nummer 
\renewcommand*\MakeUppercase[1]{#1} %macht das nich alles Großgeschrieben wird 

\fancyhead{} %löscht den Standardtext oben 
\fancyhead[LE] {\leftmark} %chaptername=current language bezeichnung für Kapitel, \chaptermark= Titel; Text in{} wird links bzw. rechts gestzt (gerade und ungerade Seiten)
\fancyhead[RO] {\rightmark}
\fancyfoot{}
\fancyfoot[LE,RO] {\thepage} %the page returns page number; R=Right O=Odd page L=LEft E=even page
\renewcommand{\headrulewidth}{0.6pt} %dicke vom Strich
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{} % empty pagestyle plan (für Seiten mit Chapter o.ä)
\fancypagestyle{plain}{
    \fancyhf{} % clear all header and footer fields
    \fancyfoot[LE,RO]{\thepage}
    \renewcommand{\footrulewidth}{0pt}
    \renewcommand{\headrulewidth}{0pt}
    }

\begin{document}
\chapter{Chapter1}
\blindtext
\section{Section1}
\blindtext
\subsection{subsection1}
\Blindtext

\end{document}
3

Add \renewcommand{\sectionmark}[1]{\markright{\thesection ~ \ #1}}

a

\documentclass[12pt,twoside]{report} 
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}} %chapter oben ohne Nummer 
\renewcommand{\sectionmark}[1]{\markright{\thesection ~ \ #1}} % added <<<<<<<<<<<<<<<<<<<<<<
\renewcommand*\MakeUppercase[1]{#1} %macht das nich alles Großgeschrieben wird 

\fancyhead{} %löscht den Standardtext oben 
\fancyhead[LE] {\leftmark} %chaptername=current language bezeichnung für Kapitel, \chaptermark= Titel; Text in{} wird links bzw. rechts gestzt (gerade und ungerade Seiten)
\fancyhead[RO] {\rightmark}
\fancyfoot{}
\fancyfoot[LE,RO] {\thepage} %the page returns page number; R=Right O=Odd page L=LEft E=even page
\renewcommand{\headrulewidth}{0.6pt} %dicke vom Strich
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{} % empty pagestyle plan (für Seiten mit Chapter o.ä)
\fancypagestyle{plain}{
    \fancyhf{} % clear all header and footer fields
    \fancyfoot[LE,RO]{\thepage}
    \renewcommand{\footrulewidth}{0pt}
    \renewcommand{\headrulewidth}{0pt}
}

\begin{document}
    \chapter{Chapter1}
    \blindtext
    \section{Section1}
    \blindtext
    \subsection{subsection1}
    \Blindtext
    
\end{document}
4

If you wish to keep the entire structure the same, you can patch \sectionmark and perform a search-and-replace; add the following to your preamble:

\usepackage{etoolbox}

% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\sectionmark}% <cmd>
  {\thesection.}% <search>
  {\thesection}% <replace>
  {}{}% <success><failure>

There already is a space inserted between the section number (\thesection) and the section title:

enter image description here

3

The dot is added in \sectionmark, which is defined by

\def\sectionmark##1{%
  \markright {\MakeUppercase{%
    \ifnum \c@secnumdepth >\z@
      \thesection. \ %
    \fi
  ##1}}}}

in standard classes report and book, see texdoc classes. You can redefine \sectionmark to remove the dot as @SimonDispa's answer shows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.