0

I'm using a template with master latex class document that defines the header and footer section. I want my head separation line to be orange and header itself without chapter or page number information. Here is the code:

\RequirePackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles%
\automark[chapter]{chapter}
\ihead{\headmark}% Inner header
\ohead[\pagemark]{\pagemark}% Outer header
}
\ifoot{}% Inner footer
\ofoot{}% Outer footer
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
\automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
\ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
\ifoot[\today]{\today}
}
\pagestyle{thesis}
\ifbool{headsepline}{\KOMAoption{headsepline}{true}}{}
\PreventPackageFromLoading[\ClassError{\classname}{Package `fancyhdr' is
incompatible\MessageBreak with this class}{The pagesyles are defined 
using package `scrlayer-scrpage', please consult the\MessageBreak 
KOMA-script documentation for details.}]{fancyhdr}


\newcommand{\blank@p@gestyle}{empty}
\newcommand{\chapter@p@gestyle}{plain}
\NewDocumentCommand{\blankpagestyle}{ m }{%
\ClassWarning{\classname}{\string\blankpagestyle\space is
obsolete,\MessageBreak use \string\setblankpagestyle \space instead}\renewcommand{\blank@p@gestyle}{}{#1}
}
\NewDocumentCommand{\setblankpagestyle}{ m }{\renewcommand{\blank@p@gestyle}{#1}}
\NewDocumentCommand{\setchapterpagestyle}{ m }{\renewcommand{\chapter@p@gestyle}{#1}}

\DeclareDocumentCommand\cleardoublepage{}{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{\blank@p@gestyle}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi%
}
1
  • 1
    Welcome to TeX.SE! Can you please make your code snippet compilable? – Mensch Mar 14 '18 at 5:40
4

Unfortunaly there is no MWE in the question and the OP does not say, if one or all page styles should be modified or if a new page style should be defined to get the empty header with an orange separation line.

To modify all layer page styles:

\AddToLayerPageStyleOptions{@everystyle@}
  {oninit=%
    \KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
    \ihead*{}\chead*{}\ohead*{}%
  }

To modify one layer page style including the related plain style, eg. thesisSimple:

\AddToLayerPageStyleOptions{thesisSimple}
  {oninit=%
    \KOMAoptions{headsepline}\setkomafont{headsepline}{\color{orange}}%
    \ihead{}\chead{}\ohead{}%
  }
\AddToLayerPageStyleOptions{plain.thesisSimple}
  {oninit=%
    \KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
    \ihead*{}\chead*{}\ohead*{}%
  }

Defining a new pair of layer page styles:

\providepairofpagestyles{myThesis}{%
  \clearpairofpagestyles
  \ifoot[\currentpagestyle: inner footer]{inner footer}
  \cfoot*{\pagemark}
  \ofoot[outer footer]{\currentpagestyle: outer footer}
}
\AddToLayerPageStyleOptions{myThesis}
  {oninit=\KOMAoptions{headsepline}\setkomafont{headsepline}{\color{orange}}}
\AddToLayerPageStyleOptions{plain.myThesis}
  {oninit=\KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
}

Example:

\documentclass{book}
\usepackage{xcolor}

\usepackage[markcase=used]{scrlayer-scrpage}
\providepairofpagestyles{thesisSimple}{%
\clearpairofpagestyles%
\automark[chapter]{chapter}
\ihead{\headmark}% Inner header
\ohead[\pagemark]{\pagemark}% Outer header
}
\ifoot{}% Inner footer
\ofoot{}% Outer footer
\pagestyle{thesisSimple}
\providepairofpagestyles[thesisSimple]{thesis}{%
\automark*[section]{}%
}
\providepairofpagestyles[thesisSimple]{review}{%
\ofoot[\shorttitle/\authorname]{\shorttitle/\authorname}
\ifoot[\today]{\today}
}
\pagestyle{thesis}

\newcommand*\shorttitle{Short Title}
\newcommand*\authorname{Author Name}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% modify all layer page styles:
\AddToLayerPageStyleOptions{@everystyle@}
  {oninit=%
    \KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
    \ihead*{}\chead*{}\ohead*{}%
  }
%%%%
% or
%%%% modify one layer page style and its plain style
%\AddToLayerPageStyleOptions{thesisSimple}
  %{oninit=%
    %\KOMAoptions{headsepline}\setkomafont{headsepline}{\color{orange}}%
    %\ihead{}\chead{}\ohead{}%
  %}
%\AddToLayerPageStyleOptions{plain.thesisSimple}
  %{oninit=%
    %\KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
    %\ihead*{}\chead*{}\ohead*{}%
  %}
%%%%
% or
%%%% new pair of layer page styles:
%\providepairofpagestyles{myThesis}{%
  %\clearpairofpagestyles
  %\ifoot[\currentpagestyle: inner footer]{inner footer}
  %\cfoot*{\pagemark}
  %\ofoot[outer footer]{\currentpagestyle: outer footer}
%}
%\AddToLayerPageStyleOptions{myThesis}
  %{oninit=\KOMAoptions{headsepline}\setkomafont{headsepline}{\color{orange}}}
%\AddToLayerPageStyleOptions{plain.myThesis}
  %{oninit=\KOMAoptions{headsepline,plainheadsepline}\setkomafont{headsepline}{\color{orange}}%
%}
%%%%

\usepackage{blindtext}% only for dummy text
\begin{document}
\blinddocument
\cleardoublepage
\pagestyle{thesisSimple}
\blinddocument
\IfLayerPageStyleExists{myThesis}{
  \cleardoublepage
  \pagestyle{myThesis}
  \blinddocument
}{}
\cleardoublepage
\pagestyle{review}
\blinddocument
\end{document}
1
  • I works for me! Thank you @esdd . Sorry for not being precise, this is my first post. – MarcinL Mar 14 '18 at 14:04

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.