[Tex/LaTex] Problem with scrlayer-scrpage header when changing chapter

page-numberingscrlayer-scrpage

I am having trouble with the scrlayer-scrpage package. I am using the scrreprt class, for which scrlayer-scrpage is recommended.
I have a two-sided document, where I want the page number on the outer bottom of the page and sections/subsections in the inner/outer header. I am using a MAIN-document, where I incorporate my chapters via \include{}. Following chapters are from my original document:

\setcounter{page}{1}

\include{Diss_Zusammenfassung}
\include{Diss_Abstract}
\include{Diss_Introduction}
\include{Diss_Background}
\include{Diss_Aim}
\include{Diss_MundM}
\include{Diss_Results}
\include{Diss_Discussion}

Maybe the inclusion has to do with one of my problems, as I cannot reproduce it in the MWE. That's why I put it here.

Now to my Problems:

  1. I set \ifoot*{\pagemark}, which gives me the correct page number in the correct position – but the page number is also given on the inside of the page (see MWE). If I uncomment \clearpairofpagestyles I get the desired page number position only, but get no headers at all. If it is commented, I get the described double page numbering, plus headers, that are sometimes correct, sometimes incorrect (see next problems :D).
  2. Headings in Glossary and Acronyms: If Glossary and Acronyms exceed one page, glossary gets a header, but acronyms doesn't (see MWE). I don't get it. Is there a way to suppress the heading on the second glossary page? I tried \thispagestyle{plain/empty}, but it does not affect the heading on the second glossary page at all.
  3. Headings just incorrect. I wasn't able to reproduce this problem in the MWE example, which is why I am thinking it might have to do with the \include thingy. In the original document I included the chapters displayed above. I know that the pagestyle is set to plain, whenever a new chapter starts – so I am not confused by empty headers at the beginning of a chapter. What does confuse me though, is that on the second page of the chapter "Zusammenfassung" a heading "Acronyms" appears. Chapter "Abstract" is only one page long – so there is no heading. Then comes "General Introduction", where again "Acronyms" appears on the second page. The same happens again, when the chapter "Aim and Approach" is included (again, second page). On the second page of the chapter "Material and Methods" "Materials" appears in the header, as intended. It also works fine in the "Results" chapter. But then, in the chapter "Discussion", the most recent section of the "Results" chapter is displayed. I think the problem arises, when there are no sections/subsections in the current chapter. But how do I tell LaTeX to not display anything or display the current chapter instead of the latest section/subsection? And why does it work without a problem in the Bibliography?

Here is my MWE, that unfortunately does not work for problem 3 (sorry =/).

\documentclass[11pt,a4paper,twoside,bibliography=totocnumbered]{scrreprt} % twoside=zweiseitiges Drucklayout
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % für Deutsch ngerman
\usepackage{marvosym}
\usepackage{blindtext}     

\usepackage[headsepline,markcase=used]{scrlayer-scrpage} % Für die Kopf- und Fußzeile inkl. Trennlinie und Titel groß geschrieben 
%\clearpairofpagestyles %löscht Voreinstellungen von plain und des headings-Stils
\pagestyle{scrheadings}
\automark*[section]{section} 
\automark*[subsection]{}
\ifoot*{\pagemark}
%\setkomafont{pageheadfoot}{}% Fußzeile normale Schrift 


\usepackage[acronyms,toc,translate=babel,nopostdot,nonumberlist]{glossaries} % weitere Optionen: shortcuts

%%%%%%%%% Abkürzungen %%%%%%%%%%%
\pagenumbering{gobble}
\makenoidxglossaries
\setglossarystyle{long}


\newacronym{RP}{RP}{retinitis pigmentosa}
\newacronym{AMD}{AMD}{age-related macular degeneration}
\newacronym{LANUV}{LANUV}{Landesamt für Natur, Umwelt und Verbraucherschutz Nordrhein-Westfalen; State Agency for Nature, Environment and Consumer Protection Northrhine-Westfalia} 
\newacronym{HE}{HE}{hematoxylin and eosin}
\newacronym{UV}{UV}{ultraviolet}
\newacronym{LED}{LED}{light-emitting diode}
\newacronym{NaCl}{NaCl}{sodium chloride}
\newacronym{OCT}{OCT}{optical coherence tomography}
\newacronym{sd-OCT}{sd-OCT}{spectral-domain optical coherence tomography}
\newacronym{ERG}{ERG}{electroretinography}
\newacronym{ffERG}{ffERG}{full-field electroretinography}
\newacronym{mfERG}{mfERG}{multifocal electroretinography}
\newacronym{MEA}{MEA}{multielectrode array}
\newacronym{IR}{IR}{inner retina}
\newacronym{OR}{OR}{outer retina}
\newacronym{ONL}{ONL}{outer nuclear layer}
\newacronym{OPL}{OPL}{outer plexiform layer}
\newacronym{IS}{IS}{inner segment}
\newacronym{OS}{OS}{outer segment}
\newacronym{IPL}{IPL}{inner plexiform layer}
\newacronym{INL}{INL}{inner nuclear layer}
\newacronym{GCL}{GCL}{ganglion cell layer}
\newacronym{NFL}{NFL}{nerve fiber layer}
\newacronym{ONF}{ONF}{optic nerve fiber layer}
\newacronym{ASR}{ASR}{Artificial Silicon Retina}
\newacronym{rd1}{rd1}{retinal degeneration 1}
\newacronym{rd10}{rd10}{retinal degeneration 10}


% RHO
\newglossaryentry{RHO}
{
 name=RHO,
 description={rhodopsin:
              \newline G-protein coupled photon receptor}
}

% PDE6B
\newglossaryentry{PDE6B}
{
 name=PDE6B,
 description={Rod cGMP-specific 3',5'-cyclic phosphodiesterase subunit beta: 
              \newline G-protein effector enzyme}
}

% RLBP1
\newglossaryentry{RLBP1}
{
 name=RLBP1,
 description={retinaldehyde binding protein:
              \newline 11-cis-retinaldehyde carrier}
}

% RP1
\newglossaryentry{RP1}
{
 name=RP1,
 description={microtubule-associated protein: 
             \newline microtubule formation and stabilization}
}


% cGMP
\newglossaryentry{cGMP}
{
 name=cGMP,
 description={cyclic guanosine monophosphate:
              \newline second messenger in phototransduction cascade}
}

% VEGF
\newglossaryentry{VEGF}
{
 name=VEGF,
 description={vascular endothelial growth factor:
              \newline signal protein involved in angiogenesis}
}

% mGluR6
\newglossaryentry{mGluR6}
{
 name=mGluR6,
 description={metabotropic glutamate receptor 6:
             \newline G protein-coupled receptor, linked to inhibition of cAMP}
}

% CNQX
\newglossaryentry{CNQX}
{
 name=CNQX,
 description={6-cyano-2,3-dihydroxy-7-nitro-quinoxaline-2,3-dione disodium:
              \newline AMPA/kainate receptor antagonist}
}

% DL-AP5
\newglossaryentry{DL-AP5}
{
 name=DL-AP5,
 description={DL-2-Amino-5- phosphonopentanoic acid:
             \newline NMDA receptor antagonist}
}

% MFA
\newglossaryentry{MFA}
{
 name=MFA,
 description={meclofenamic acid:
             \newline gap junction blocker}
}

% DHA
\newglossaryentry{DHA}
{
 name=DHA,
 description={dietary docosahexaenoic acid:
             \newline omega-3 fatty acid}
}


% FPG protein
\newglossaryentry{FPG protein}
{
 name=FPG protein,
 description={Formamidopyrimidine-DNA glycosylase:
              \newline repair endoduclease}
}

% NADPH
\newglossaryentry{NADPH}
{
 name=NADPH,
 description={Nicotinamide adenine dinucleotide phosphate:
              \newline coenzyme; reducing agent; anabolic metabolism
              }
}

% NADH
\newglossaryentry{NADH}
{
 name=NADH,
 description={Nicotinamide adenine dinucleotide:
              \newline coenzyme; oxidizing agent; catabolic metabolism
              }
}


% RNAi
\newglossaryentry{RNAi}
{
 name=RNAi,
 description={RNA interference:
              \newline \textit{small interfering RNA} prohibits translation by interfering with \textit{messenger RNA}
              }
}


% SMA
\newglossaryentry{SMA}
{
 name=SMA,
 description={"alpha smooth muscle actin" staining:
              \newline stains microfilaments of the cytoskeleton, myofibroblasts 
              }
}



% FWHM
\newglossaryentry{FWHM}
{
 name=FWHM,
 description={full width at half maximum:
              \newline in a gaussian curve, the width of the function on the x-axis at 50\,\% of the maximum on the y- 
                       axis
              }
}


% CTA
\newglossaryentry{CTA}
{
 name=CTA,
 description={chemiblocker + Triton X-100 + sodium azide
                           }
}

% CT
\newglossaryentry{CT}
{
 name=CT,
 description={chemiblocker + Triton X-100
                           }
}


\renewcommand*{\glsnamefont}[1]{\textmd{#1}}  %Akronyme in normaler Schriftgröße (ohne diesen Befehl alles fett)



\begin{document}

%------------------------    TOC   ------------------------   
\newpage
\tableofcontents
\thispagestyle{empty} % nicht benötigt mit pagenumbering{gobble} am Anfang

\listoffigures
\listoftables
\printnoidxglossaries 
%\printglossary
\thispagestyle{empty}
%------------------------    KAPITEL   ------------------------   
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}

\Blinddocument

These are glossary entries: \Gls{RHO}, \gls{PDE6B}, \gls{RLBP1}, \gls{RP1},
\gls{CT}, \gls{CTA}, \gls{FWHM}, \gls{SMA}, \gls{RNAi}, \gls{NADH},
\gls{NADPH}, \gls{FPG protein}, \gls{DHA}, \gls{MFA}, \gls{DL-AP5},
\gls{CNQX}, \gls{mGluR6}, , \gls{VEGF}, \gls{cGMP} and these are acronyms: 
\Gls{RP}, \gls{AMD}, \gls{LANUV}, \gls{HE}, \gls{UV}, \gls{LED}, \gls{NaCl},
\gls{OCT}, \gls{sd-OCT}, \gls{ERG}, \gls{ffERG}, \gls{mfERG}, \gls{MEA},
\gls{IR}, \gls{OR}, \gls{ONL}, \gls{OPL}, \gls{IS}, \gls{OS}, \gls{IPL},
\gls{INL}, \gls{GCL}, \gls{NFL}, \gls{ONF}, \gls{ASR}, \gls{rd1}, \gls{rd10}
\end{document}

I would really appreciate any help with this.
Thank you all in advance.

Best Answer

To get the page number at the outer side (eg right on odd pages, left on even pages) of the footer you have to use \ofoot. But this is the default for a twosided document. So it would be enough to use

\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section} 
\automark*[subsection]{}

If you want to use \clearpairofpagestyles then

\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section} 
\automark*[subsection]{}
\clearpairofpagestyles
\ohead{\headmark}
\ofoot*{\pagemark}

If the page numbers should be in inner footer (as in your example code), you can use

\usepackage[headsepline,markcase=used]{scrlayer-scrpage}% sets page style scrheadings
\automark*[section]{section} 
\automark*[subsection]{}
\ifoot*{\pagemark}
\ofoot*{}

or

\usepackage{scrlayer-scrpage}% sets page style scrheadings
\automark[section]{section} 
\automark*[subsection]{}
\clearpairofpagestyles
\ohead{\headmark}
\ifoot*{\pagemark}

To use pagestyle empty on all pages of TOC etc. set

\pagestyle{empty}
\renewcommand\chapterpagestyle{empty}

To switch back to scrheadings

\cleardoublepage
\pagestyle{scrheadings}
\renewcommand\chapterpagestyle{plain}

Important: Use \cleardoubleoddpage before the change of the pagenumbering scheme.

\cleardoubleoddpage
\pagenumbering{arabic}% <- sets the page counter to 1

Regarding your 3. issue: Maybe you have to add option automark to the scrlayer-scrpage options:

\usepackage[headsepline,markcase=used,automark]{scrlayer-scrheadings}
\automark*[section]{section}
\automark*[subsection]{}

or you have to use

\usepackage[headsepline,markcase=used]{scrlayer-scrheadings}
\automark[section]{chapter}
\automark*[section]{section}
\automark*[subsection]{}
Related Question