1

I want to have different headers/footers, depending on what "part" I have, which is defined in the "mPart" variable...

I'm using the following code to distinguish between the parts:

\newcommand{\PartEinleitung}{0}
\newcommand{\PartHauptteil}{1}
\newcommand{\PartAppendix}{2}
\newcommand{\mPart}{}
\newcommand{\setPart}[1]{\renewcommand{\mPart}{#1}}
\newcommand{\mWriter}{}
\newcommand{\setWriter}[1]{\renewcommand{\mWriter}{#1}}

\ifnum\mPart=\PartEinleitung
    \rofoot*{\small\color{gray} Seite \thepage~von \pageref{LastPageEinleitung}}
\fi
\ifnum\mPart=\PartHauptteil
        \rehead*{\headmark}
        \lehead*{\mWriter}
        \rofoot*{\small\color{gray} Seite \thepage~von \pageref{LastPageHauptteil}}
\fi

The error is:

Missing number, treated as zero. \ifnum\mPart=

Hope you can help me, thank you!

the_dani
  • 135
  • 4

1 Answers1

0

Here's how I solved it:

\usepackage{scrlayer-scrpage}
\automark*{chapter}
\automark*{section}
\setkomafont{pageheadfoot}{\sffamily}
\setkomafont{pagination}{}

\newcommand{\PartEinleitung}{
    \clearpairofpagestyles
    \KOMAoptions{footsepline=true, plainfootsepline=true}
    \ofoot*{\small\color{gray} Seite \thepage~von \pageref{LastPageEinleitung}}
}
\newcommand{\PartHauptteil}{
    \clearpairofpagestyles
    \KOMAoptions{headsepline=true, plainheadsepline=true}
    \ihead*{\headmark}
    \ohead*{\mWriter}
    \ofoot*{\small\color{gray} Seite \thepage~von \pageref{LastPageHauptteil}}
}
\newcommand{\PartAppendix}{
    \clearpairofpagestyles
    \KOMAoptions{headsepline=false, plainheadsepline=false}
    \ofoot*{\small\color{gray} Seite \thepage~von \pageref{LastPageAppendix}}
}

Instead of using if else, i just change the Header and Footer using a command.

the_dani
  • 135
  • 4