From 34310603e5253ef5742542e3f0123b341a70ee20 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 28 Sep 2020 03:04:08 +0000
Subject: CTAN sync 202009280304

---
 .../koma-script/source/scrlayer-scrpage.dtx        | 2365 +++++++++-----------
 1 file changed, 1044 insertions(+), 1321 deletions(-)

(limited to 'macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx')

diff --git a/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx b/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
index 22dfc382b8..6f223ad944 100644
--- a/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
+++ b/macros/latex/contrib/koma-script/source/scrlayer-scrpage.dtx
@@ -1,8 +1,7 @@
-% \CheckSum{2604}
 % \iffalse^^A meta-comment
 % ======================================================================
 % scrlayer-scrpage.dtx
-% Copyright (c) Markus Kohm, 2012-2019
+% Copyright (c) Markus Kohm, 2012-2020
 %
 % This file is part of the LaTeX2e KOMA-Script bundle.
 %
@@ -20,7 +19,7 @@
 % This work consists of all files listed in manifest.txt.
 % ----------------------------------------------------------------------
 % scrlayer-scrpage.dtx
-% Copyright (c) Markus Kohm, 2012-2019
+% Copyright (c) Markus Kohm, 2012-2020
 %
 % Diese Datei ist Teil der LaTeX2e KOMA-Script-Sammlung.
 %
@@ -38,26 +37,8 @@
 %
 % Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
 % ======================================================================
-% \fi^^A meta-comment
-%
-% \CharacterTable
-%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%   Digits        \0\1\2\3\4\5\6\7\8\9
-%   Exclamation   \!     Double quote  \"     Hash (number) \#
-%   Dollar        \$     Percent       \%     Ampersand     \&
-%   Acute accent  \'     Left paren    \(     Right paren   \)
-%   Asterisk      \*     Plus          \+     Comma         \,
-%   Minus         \-     Point         \.     Solidus       \/
-%   Colon         \:     Semicolon     \;     Less than     \<
-%   Equals        \=     Greater than  \>     Question mark \?
-%   Commercial at \@     Left bracket  \[     Backslash     \\
-%   Right bracket \]     Circumflex    \^     Underscore    \_
-%   Grave accent  \`     Left brace    \{     Vertical bar  \|
-%   Right brace   \}     Tilde         \~}
 %
-% \iffalse^^A meta-comment
-%%% From File: $Id: scrlayer-scrpage.dtx 3390 2019-11-18 17:09:35Z kohm $
+%%% From File: $Id: scrlayer-scrpage.dtx 3531 2020-09-11 12:28:41Z kohm $
 %<identify>%%%            (run: identify)
 %<init>%%%            (run: init)
 %<options>%%%            (run: options)
@@ -66,9 +47,9 @@
 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
 \begingroup
   \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
-  \filedate$Date: 2019-11-18 18:09:35 +0100 (Mon, 18 Nov 2019) $
+  \filedate$Date: 2020-09-11 14:28:41 +0200 (Fri, 11 Sep 2020) $
   \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
-  \filerevision$Revision: 3390 $
+  \filerevision$Revision: 3531 $
   \edef\reserved@a{%
     \noexpand\endgroup
     \noexpand\ProvidesFile{scrlayer-scrpage.dtx}%
@@ -185,6 +166,7 @@
 % \selectlanguage{english}
 %
 % \changes{v0.0}{2012/01/01}{start of interface}
+% \changes{v3.32}{2020/09/11}{do not use deprecated interface commands}
 % \let\restorechapter\chapter
 % \let\chapter\section
 % \let\section\subsection
@@ -301,8 +283,6 @@
     }%
   \reserved@a
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headwidth@default}
 \KOMA@key{footwidth}{%
   \begingroup
     \sls@split@at@iicolons#1:::\@nil
@@ -317,8 +297,6 @@
     }%
   \reserved@a
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footwidth@default}
 %    \end{macrocode}
 % \begin{macro}{\sls@split@at@iicolons}
 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
@@ -332,24 +310,23 @@
 % This little helper is used, e.g., by options \Option{headwidth} and
 % \Option{footwidth}.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@split@at@iicolons{%
-  \def\sls@split@at@iicolons#1:#2:#3:#4\@nil{%
-    \Ifstr{#4}{}{}{%
-      \Ifstr{#4}{:}{}{%
-        \Ifstr{#4}{::}{}{%
-          \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
-            You've used more than two colons at the argument\MessageBreak
-            of a two value option.\MessageBreak
-            The extra value(s) will be ignored%
-          }%
+\newcommand\sls@split@at@iicolons{}
+\def\sls@split@at@iicolons#1:#2:#3:#4\@nil{%
+  \Ifstr{#4}{}{}{%
+    \Ifstr{#4}{:}{}{%
+      \Ifstr{#4}{::}{}{%
+        \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
+          You've used more than two colons at the argument\MessageBreak
+          of a two value option.\MessageBreak
+          The extra value(s) will be ignored%
         }%
       }%
     }%
-    \def\reserved@a{#1}%
-    \def\reserved@b{#2}%
-    \def\reserved@c{#3}%
   }%
-}
+  \def\reserved@a{#1}%
+  \def\reserved@b{#2}%
+  \def\reserved@c{#3}%
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@split@at@iicolons
 % \begin{macro}{\sls@set@hf@width}
@@ -364,62 +341,60 @@
 %   \end{description}
 % This helper will generally set up width an offset of either head or footer.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@set@hf@width{%
-  \newcommand*{\sls@set@hf@width}[4]{%
-    \sls@settowidthof{\@tempdima}{#4}%
-    \ifdim\@tempdima>\paperwidth
-      \PackageWarning
-        {scrlayer-scrpage}%
-        {You've set width of #1 to a value\MessageBreak
-          greater than width of page!\MessageBreak%
-          I'll reduce width of #1 to width of page}%
-      \setlength{\@tempdima}{\paperwidth}%
+\newcommand*{\sls@set@hf@width}[4]{%
+  \sls@settowidthof{\@tempdima}{#4}%
+  \ifdim\@tempdima>\paperwidth
+    \PackageWarning
+      {scrlayer-scrpage}%
+      {You've set width of #1 to a value\MessageBreak
+        greater than width of page!\MessageBreak%
+        I'll reduce width of #1 to width of page}%
+    \setlength{\@tempdima}{\paperwidth}%
+  \else
+    \ifdim\@tempdima<\z@
+       \PackageWarning
+         {scrlayer-scrpage}%
+         {You've set width of #1 to negative value!\MessageBreak%
+           I'll set it to 0pt}%
+       \setlength{\@tempdima}{\z@}%
+     \fi
+  \fi
+  \expandafter\edef\csname sls@#1width\endcsname{\the\@tempdima}%
+  \setlength{\@tempdima}{\textwidth}%
+  \addtolength{\@tempdima}{-\csname sls@#1width\endcsname}%
+  \Ifstr{#2}{}{%
+    \ifdim \csname sls@#1width\endcsname
+         = \dimexpr \textwidth+\marginparwidth+\marginparsep\relax
+      \setlength{\@tempdimb}{\z@}
     \else
-      \ifdim\@tempdima<\z@
-         \PackageWarning
-           {scrlayer-scrpage}%
-           {You've set width of #1 to negative value!\MessageBreak%
-             I'll set it to 0pt}%
-         \setlength{\@tempdima}{\z@}%
-       \fi
-    \fi
-    \expandafter\edef\csname sls@#1width\endcsname{\the\@tempdima}%
-    \setlength{\@tempdima}{\textwidth}%
-    \addtolength{\@tempdima}{-\csname sls@#1width\endcsname}%
-    \Ifstr{#2}{}{%
-      \ifdim \csname sls@#1width\endcsname
-           = \dimexpr \textwidth+\marginparwidth+\marginparsep\relax
-        \setlength{\@tempdimb}{\z@}
+      \if@twoside
+        \setlength{\@tempdimb}{.3333333333\@tempdima}%
       \else
-        \if@twoside
-          \setlength{\@tempdimb}{.3333333333\@tempdima}%
-        \else
-          \setlength{\@tempdimb}{.5\@tempdima}%
-        \fi
+        \setlength{\@tempdimb}{.5\@tempdima}%
       \fi
-    }{%
-      \sls@settowidthof{\@tempdimb}{#2}%
-    }%
-    \Ifstr{#3}{}{%
-      \addtolength{\@tempdima}{-\@tempdimb}%
-    }{%
-      \sls@settowidthof{\@tempdima}{#3}%
-      \setlength{\@tempdima}{-\@tempdima}%
-    }%
-    \ifdim\@tempdimb<\z@
-      \setlength{\@tempdimb}{-\@tempdimb}%
-      \expandafter\edef\csname sls@odd#1shift\endcsname{-\the\@tempdimb}%
-    \else
-      \expandafter\edef\csname sls@odd#1shift\endcsname{\the\@tempdimb}%
-    \fi
-    \ifdim\@tempdima<\z@
-      \setlength{\@tempdima}{-\@tempdima}%
-      \expandafter\edef\csname sls@even#1shift\endcsname{-\the\@tempdima}%
-    \else
-      \expandafter\edef\csname sls@even#1shift\endcsname{\the\@tempdima}%
     \fi
+  }{%
+    \sls@settowidthof{\@tempdimb}{#2}%
   }%
-}
+  \Ifstr{#3}{}{%
+    \addtolength{\@tempdima}{-\@tempdimb}%
+  }{%
+    \sls@settowidthof{\@tempdima}{#3}%
+    \setlength{\@tempdima}{-\@tempdima}%
+  }%
+  \ifdim\@tempdimb<\z@
+    \setlength{\@tempdimb}{-\@tempdimb}%
+    \expandafter\edef\csname sls@odd#1shift\endcsname{-\the\@tempdimb}%
+  \else
+    \expandafter\edef\csname sls@odd#1shift\endcsname{\the\@tempdimb}%
+  \fi
+  \ifdim\@tempdima<\z@
+    \setlength{\@tempdima}{-\@tempdima}%
+    \expandafter\edef\csname sls@even#1shift\endcsname{-\the\@tempdima}%
+  \else
+    \expandafter\edef\csname sls@even#1shift\endcsname{\the\@tempdima}%
+  \fi
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@set@hf@width
 % \begin{macro}{\sls@headwidth}
@@ -432,28 +407,24 @@
 % also used by the options and therefore need to be initialised before option
 % usage.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@headwidth{%
-  \scr@ifundefinedorrelax{@headwidth}{%
-    \newcommand*{\sls@headwidth}{\textwidth}%
-    \KOMA@kav@add{.scrlayer-scrpage.sty}{headwidth}{\textwidth:0pt:0pt}%
-  }{%
-    \newcommand*{\sls@headwidth}{\@headwidth}%
-    \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headwidth}{\@headwidth:0pt:0pt}%
-  }%
-}
-\scrlayerAddToInterface\sls@oddheadshift{\newcommand*{\sls@oddheadshift}{0pt}}
-\scrlayerAddToInterface\sls@evenheadshift{\newcommand*{\sls@evenheadshift}{0pt}}
-\scrlayerAddToInterface\sls@footwidth{%
-  \scr@ifundefinedorrelax{@footwidth}{%
-    \newcommand*{\sls@footwidth}{\textwidth}%
-    \KOMA@kav@add{.scrlayer-scrpage.sty}{footwidth}{\textwidth:0pt:0pt}
-  }{%
-    \newcommand*{\sls@footwidth}{\@footwidth}%
-    \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footwidth}{\@footwidth:0pt:0pt}
-  }%
-}
-\scrlayerAddToInterface\sls@oddfootshift{\newcommand*{\sls@oddfootshift}{0pt}}
-\scrlayerAddToInterface\sls@evenfootshift{\newcommand*{\sls@evenfootshift}{0pt}}
+\scr@ifundefinedorrelax{@headwidth}{%
+  \newcommand*{\sls@headwidth}{\textwidth}%
+  \KOMA@kav@add{.scrlayer-scrpage.sty}{headwidth}{\textwidth:0pt:0pt}%
+}{%
+  \newcommand*{\sls@headwidth}{\@headwidth}%
+  \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headwidth}{\@headwidth:0pt:0pt}%
+}%
+\newcommand*{\sls@oddheadshift}{0pt}
+\newcommand*{\sls@evenheadshift}{0pt}
+\scr@ifundefinedorrelax{@footwidth}{%
+  \newcommand*{\sls@footwidth}{\textwidth}%
+  \KOMA@kav@add{.scrlayer-scrpage.sty}{footwidth}{\textwidth:0pt:0pt}
+}{%
+  \newcommand*{\sls@footwidth}{\@footwidth}%
+  \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footwidth}{\@footwidth:0pt:0pt}
+}%
+\newcommand*{\sls@oddfootshift}{0pt}
+\newcommand*{\sls@evenfootshift}{0pt}
 %    \end{macrocode}
 % \end{macro}%^^A \sls@headwidth
 % \end{macro}%^^A \sls@oddheadshift
@@ -474,50 +445,48 @@
 % expression. But it cannot be both a dimensional expression using symbolic
 % values!
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@settotwidthof{%
-  \newcommand*{\sls@settowidthof}[2]{%
-    \Ifstr{#2}{paper}{%
-      \setlength{#1}{\paperwidth}%
+\newcommand*{\sls@settowidthof}[2]{%
+  \Ifstr{#2}{paper}{%
+    \setlength{#1}{\paperwidth}%
+  }{%
+    \Ifstr{#2}{text}{%
+      \setlength{#1}{\textwidth}%
     }{%
-      \Ifstr{#2}{text}{%
-        \setlength{#1}{\textwidth}%
+      \Ifstr{#2}{marginpar}{%
+        \setlength{#1}{\dimexpr \marginparwidth+\marginparsep\relax}%
       }{%
-        \Ifstr{#2}{marginpar}{%
-          \setlength{#1}{\dimexpr \marginparwidth+\marginparsep\relax}%
+        \Ifstr{#2}{textwithmarginpar}{%
+          \setlength{#1}{\dimexpr\textwidth
+                                +\marginparwidth
+                                +\marginparsep\relax}%
         }{%
-          \Ifstr{#2}{textwithmarginpar}{%
-            \setlength{#1}{\dimexpr\textwidth
-                                  +\marginparwidth
-                                  +\marginparsep\relax}%
+          \Ifstr{#2}{head}{%
+            \setlength{#1}{\sls@headwidth}%
           }{%
-            \Ifstr{#2}{head}{%
-              \setlength{#1}{\sls@headwidth}%
+            \Ifstr{#2}{foot}{%
+              \setlength{#1}{\sls@footwidth}%
             }{%
-              \Ifstr{#2}{foot}{%
-                \setlength{#1}{\sls@footwidth}%
+              \Ifstr{#2}{headtopline}{%
+                \setlength{#1}{\sls@headabove@linelength}%
               }{%
-                \Ifstr{#2}{headtopline}{%
-                  \setlength{#1}{\sls@headabove@linelength}%
+                \Ifstr{#2}{headsepline}{%
+                  \setlength{#1}{\sls@headbelow@linelength}%
                 }{%
-                  \Ifstr{#2}{headsepline}{%
-                    \setlength{#1}{\sls@headbelow@linelength}%
+                  \Ifstr{#2}{footsepline}{%
+                    \setlength{#1}{\sls@footabove@linelength}%
                   }{%
-                    \Ifstr{#2}{footsepline}{%
-                      \setlength{#1}{\sls@footabove@linelength}%
+                    \Ifstr{#2}{footbotline}{%
+                      \setlength{#1}{\sls@footbelow@linelength}%
                     }{%
-                      \Ifstr{#2}{footbotline}{%
-                        \setlength{#1}{\sls@footbelow@linelength}%
+                      \Ifstr{#2}{page}{%
+                        \setlength{#1}{\paperwidth}%
+                        \begingroup
+                        \expandafter\expandafter\expandafter\endgroup
+                        \expandafter\ifx\csname ta@bcor\endcsname\relax\else
+                          \addtolength{#1}{-\ta@bcor}%
+                        \fi
                       }{%
-                        \Ifstr{#2}{page}{%
-                          \setlength{#1}{\paperwidth}%
-                          \begingroup
-                          \expandafter\expandafter\expandafter\endgroup
-                          \expandafter\ifx\csname ta@bcor\endcsname\relax\else
-                            \addtolength{#1}{-\ta@bcor}%
-                          \fi
-                        }{%
-                          \setlength{#1}{\dimexpr #2\relax}%
-                        }%
+                        \setlength{#1}{\dimexpr #2\relax}%
                       }%
                     }%
                   }%
@@ -529,21 +498,19 @@
       }%
     }%
   }%
-}
-\scrlayerAddToInterface\sls@deftowidthof{%
-  \newcommand*{\sls@deftowidthof}[2]{%
-    \Ifstr{#2}{autohead}{%
-      \expandafter\def\csname #1\endcsname{\sls@headwidth}%
+}%
+\newcommand*{\sls@deftowidthof}[2]{%
+  \Ifstr{#2}{autohead}{%
+    \expandafter\def\csname #1\endcsname{\sls@headwidth}%
+  }{%
+    \Ifstr{#2}{autofoot}{%
+      \expandafter\def\csname #1\endcsname{\sls@footwidth}%
     }{%
-      \Ifstr{#2}{autofoot}{%
-        \expandafter\def\csname #1\endcsname{\sls@footwidth}%
-      }{%
-        \sls@settowidthof{\@tempdima}{#2}%
-        \expandafter\edef\csname #1\endcsname{\the\@tempdima}%
-      }%
+      \sls@settowidthof{\@tempdima}{#2}%
+      \expandafter\edef\csname #1\endcsname{\the\@tempdima}%
     }%
   }%
-}
+}%
 %</options>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@deftowidthof
@@ -556,16 +523,12 @@
 % For compatibility with \Package{scrpage2}, map the commands to the options:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\setheadwidth{%
-  \newcommand*{\setheadwidth}[2][]{%
-    \KOMAoptions{headwidth=#2:#1}%
-  }%
-}
-\scrlayerAddToInterface\setfootwidth{%
-  \newcommand*{\setfootwidth}[2][]{%
-    \KOMAoptions{footwidth=#2:#1}%
-  }%
-}
+\newcommand*{\setheadwidth}[2][]{%
+  \KOMAoptions{headwidth=#2:#1}%
+}%
+\newcommand*{\setfootwidth}[2][]{%
+  \KOMAoptions{footwidth=#2:#1}%
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \setheadwidth
@@ -611,23 +574,15 @@
 \KOMA@key{headtopline}[:]{%
   \sls@set@values[headtopline]{head}{above}{#1}%
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headtopline@default}
 \KOMA@key{headsepline}[:]{%
   \sls@set@values[headsepline]{head}{below}{#1}%
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@headsepline@default}
 \KOMA@key{footsepline}[:]{%
   \sls@set@values[footsepline]{foot}{above}{#1}%
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footsepline@default}
 \KOMA@key{footbotline}[:]{%
   \sls@set@values[footbotline]{foot}{below}{#1}%
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@footbotline@default}
 %    \end{macrocode}
 % \begin{macro}{\sls@set@values}
 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
@@ -643,65 +598,63 @@
 % Helper macros for the options to set two macros by two values of one
 % option. The two values are separated by a colon.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@set@values{%
-  \newcommand*{\sls@set@values}[4][]{%
-    \begingroup
-      \Ifstr{#1}{}{%
-        \FamilyKeyStateUnknown
-      }{%
-        \KOMA@set@ifkey{#1}{@tempswa}{#4}%
-      }%
-      \ifx\FamilyKeyState\FamilyKeyStateProcessed
-        \if@tempswa
-          \edef\reserved@b{%
-            \noexpand\endgroup
-            \noexpand\@namedef{sls@#2#3@linethickness}{.4pt}%
-            \noexpand\@namedef{sls@#2#3@linelength}{%
-              \expandafter\noexpand\csname sls@#2width\endcsname
-            }%
-          }%
-        \else
-          \def\reserved@b{%
-            \endgroup
-            \@namedef{sls@#2#3@linethickness}{0pt}%
-            \@namedef{sls@#2#3@linelength}{0pt}%
+\newcommand*{\sls@set@values}[4][]{%
+  \begingroup
+    \Ifstr{#1}{}{%
+      \FamilyKeyStateUnknown
+    }{%
+      \KOMA@set@ifkey{#1}{@tempswa}{#4}%
+    }%
+    \ifx\FamilyKeyState\FamilyKeyStateProcessed
+      \if@tempswa
+        \edef\reserved@b{%
+          \noexpand\endgroup
+          \noexpand\@namedef{sls@#2#3@linethickness}{.4pt}%
+          \noexpand\@namedef{sls@#2#3@linelength}{%
+            \expandafter\noexpand\csname sls@#2width\endcsname
           }%
-        \fi
+        }%
       \else
-        \let\reserved@a\@empty
-        \let\reserved@b\@empty
-        \sls@split@at@colon#4::\@nil
-        \ifx\reserved@a\@empty
-          \def\reserved@a{\endgroup\@namedef{sls@#2#3@linethickness}{.4pt}}%
-        \else
-          \setlength{\@tempdima}{\dimexpr\reserved@a\relax}%
-          \edef\reserved@a{%
-            \noexpand\endgroup
-            \noexpand\@namedef{sls@#2#3@linethickness}{\the\@tempdima}%
-          }%
-        \fi
-        \ifx\reserved@b\@empty
-          \def\reserved@b{%
-            \reserved@a
-            \@namedef{sls@#2#3@linelength}{\@nameuse{sls@#2width}}%
-          }%
-        \else
-          \edef\reserved@b{%
-            \noexpand\reserved@a
-            \noexpand\sls@deftowidthof{sls@#2#3@linelength}{\reserved@b}%
-          }%
-        \fi
+        \def\reserved@b{%
+          \endgroup
+          \@namedef{sls@#2#3@linethickness}{0pt}%
+          \@namedef{sls@#2#3@linelength}{0pt}%
+        }%
       \fi
-    \reserved@b
-    \FamilyKeyStateProcessed
-    \Ifstr{#1}{}{}{%
-      \KOMA@kav@xreplacevalue{.scrlayer-scrpage.sty}{#1}{%
-        \csname sls@#2#3@linethickness\endcsname
-        :\csname sls@#2#3@linelength\endcsname
-      }%
+    \else
+      \let\reserved@a\@empty
+      \let\reserved@b\@empty
+      \sls@split@at@colon#4::\@nil
+      \ifx\reserved@a\@empty
+        \def\reserved@a{\endgroup\@namedef{sls@#2#3@linethickness}{.4pt}}%
+      \else
+        \setlength{\@tempdima}{\dimexpr\reserved@a\relax}%
+        \edef\reserved@a{%
+          \noexpand\endgroup
+          \noexpand\@namedef{sls@#2#3@linethickness}{\the\@tempdima}%
+        }%
+      \fi
+      \ifx\reserved@b\@empty
+        \def\reserved@b{%
+          \reserved@a
+          \@namedef{sls@#2#3@linelength}{\@nameuse{sls@#2width}}%
+        }%
+      \else
+        \edef\reserved@b{%
+          \noexpand\reserved@a
+          \noexpand\sls@deftowidthof{sls@#2#3@linelength}{\reserved@b}%
+        }%
+      \fi
+    \fi
+  \reserved@b
+  \FamilyKeyStateProcessed
+  \Ifstr{#1}{}{}{%
+    \KOMA@kav@xreplacevalue{.scrlayer-scrpage.sty}{#1}{%
+      \csname sls@#2#3@linethickness\endcsname
+      :\csname sls@#2#3@linelength\endcsname
     }%
   }%
-}
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@set@values
 % \begin{macro}{\sls@split@at@colon}
@@ -716,21 +669,20 @@
 % This little helper is used, e.g., by options \Option{headwidth} and
 % \Option{footwidth}.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@split@at@colon{%
-  \def\sls@split@at@colon#1:#2:#3\@nil{%
-    \Ifstr{#3}{}{}{%
-      \Ifstr{#3}{:}{}{%
-        \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
-          You've used more than one colon at the argument\MessageBreak
-          of a two value option.\MessageBreak
-          The extra value(s) will be ignored%
-        }%
+\newcommand*{\sls@split@at@colon}{}
+\def\sls@split@at@colon#1:#2:#3\@nil{%
+  \Ifstr{#3}{}{}{%
+    \Ifstr{#3}{:}{}{%
+      \PackageWarning{scrlayer}{extra `:' found!\MessageBreak
+        You've used more than one colon at the argument\MessageBreak
+        of a two value option.\MessageBreak
+        The extra value(s) will be ignored%
       }%
     }%
-    \def\reserved@a{#1}%
-    \def\reserved@b{#2}%
   }%
-}
+  \def\reserved@a{#1}%
+  \def\reserved@b{#2}%
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@split@at@colon
 % \begin{macro}{\sls@headabove@linelength}
@@ -745,42 +697,30 @@
 % use macros. Those are also used by the options and therefore need to be
 % initialised before option usage.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@headabove@linelength{%
-  \newcommand*{\sls@headabove@linelength}{\sls@headwidth}%
-}
-\scrlayerAddToInterface\sls@headabove{%
-  \newcommand*{\sls@headabove@linethickness}{0pt}%
-}
+\newcommand*{\sls@headabove@linelength}{\sls@headwidth}%
+\newcommand*{\sls@headabove@linethickness}{0pt}%
 \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headtopline}{%
   \expandafter\noexpand\sls@headabove@linethickness:%
-  \expandafter\noexpand\sls@headabove@linelength}
-\scrlayerAddToInterface\sls@headbelow@linelength{%
-  \newcommand*{\sls@headbelow@linelength}{\sls@headwidth}%
-}
-\scrlayerAddToInterface\sls@headbelow@linethickness{%
-  \newcommand*{\sls@headbelow@linethickness}{0pt}%
+  \expandafter\noexpand\sls@headabove@linelength
 }
+\newcommand*{\sls@headbelow@linelength}{\sls@headwidth}%
+\newcommand*{\sls@headbelow@linethickness}{0pt}%
 \KOMA@kav@xadd{.scrlayer-scrpage.sty}{headsepline}{%
   \expandafter\noexpand\sls@headbelow@linethickness:%
-  \expandafter\noexpand\sls@headbelow@linelength}
-\scrlayerAddToInterface\sls@footabove@linelength{%
-  \newcommand*{\sls@footabove@linelength}{\sls@footwidth}%
-}
-\scrlayerAddToInterface\sls@footabove@linethickness{%
-  \newcommand*{\sls@footabove@linethickness}{0pt}%
+  \expandafter\noexpand\sls@headbelow@linelength
 }
+\newcommand*{\sls@footabove@linelength}{\sls@footwidth}%
+\newcommand*{\sls@footabove@linethickness}{0pt}%
 \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footsepline}{%
   \expandafter\noexpand\sls@footabove@linethickness:%
-  \expandafter\noexpand\sls@footabove@linelength}
-\scrlayerAddToInterface\sls@footbelow@linelength{%
-  \newcommand*{\sls@footbelow@linelength}{\sls@footwidth}%
-}
-\scrlayerAddToInterface\sls@footbelow@linethickness{%
-  \newcommand*{\sls@footbelow@linethickness}{0pt}%
+  \expandafter\noexpand\sls@footabove@linelength
 }
+\newcommand*{\sls@footbelow@linelength}{\sls@footwidth}%
+\newcommand*{\sls@footbelow@linethickness}{0pt}%
 \KOMA@kav@xadd{.scrlayer-scrpage.sty}{footbotline}{%
   \expandafter\noexpand\sls@footbelow@linethickness:%
-  \expandafter\noexpand\sls@footbelow@linelength}
+  \expandafter\noexpand\sls@footbelow@linelength
+}
 %</options>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@footbelow@linethickness
@@ -810,38 +750,10 @@
 % While these only switches the rule on or off, we need only some switches.
 %    \begin{macrocode}
 %<*options>
-\scrlayerAddCsToInterface{ifsls@plain@head@above@line}{%
-  \KOMA@ifkey{plainheadtopline}{sls@plain@head@above@line}%
-  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadtopline}%
-  \scrlayer@AddCsToInterface{%
-    KV@KOMA.scrlayer-scrpage.sty@plainheadtopline@default}%
-  \scrlayer@AddCsToInterface{sls@plain@head@above@linetrue}
-  \scrlayer@AddCsToInterface{sls@plain@head@above@linefalse}
-}
-\scrlayerAddCsToInterface{ifsls@plain@head@sbelow@line}{%
-  \KOMA@ifkey{plainheadsepline}{sls@plain@head@below@line}%
-  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainheadsepline}%
-  \scrlayer@AddCsToInterface{%
-    KV@KOMA.scrlayer-scrpage.sty@plainheadsepline@default}%
-  \scrlayer@AddCsToInterface{sls@plain@head@below@linetrue}%
-  \scrlayer@AddCsToInterface{sls@plain@head@below@linefalse}%
-}
-\scrlayerAddCsToInterface{ifsls@plain@foot@above@line}{%
-  \KOMA@ifkey{plainfootsepline}{sls@plain@foot@above@line}%
-  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootsepline}%
-  \scrlayer@AddCsToInterface{%
-    KV@KOMA.scrlayer-scrpage.sty@plainfootsepline@default}%
-  \scrlayer@AddCsToInterface{sls@plain@foot@above@linetrue}%
-  \scrlayer@AddCsToInterface{sls@plain@foot@above@linefalse}%
-}
-\scrlayerAddCsToInterface{ifsls@plain@foot@below@line}{%
-  \KOMA@ifkey{plainfootbotline}{sls@plain@foot@below@line}%
-  \scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@plainfootbotline}%
-  \scrlayer@AddCsToInterface{%
-    KV@KOMA.scrlayer-scrpage.sty@plainfootbotline@default}%
-  \scrlayer@AddCsToInterface{sls@plain@foot@below@linetrue}%
-  \scrlayer@AddCsToInterface{sls@plain@foot@below@linefalse}%
-}
+\KOMA@ifkey{plainheadtopline}{sls@plain@head@above@line}%
+\KOMA@ifkey{plainheadsepline}{sls@plain@head@below@line}%
+\KOMA@ifkey{plainfootsepline}{sls@plain@foot@above@line}%
+\KOMA@ifkey{plainfootbotline}{sls@plain@foot@below@line}%
 %</options>
 %    \end{macrocode}
 % \end{macro}%^^A \ifsls@plain@foot@below@line
@@ -866,9 +778,7 @@
 % may help.
 %    \begin{macrocode}
 %<*options>
-\scrlayerAddToInterface\sls@hfline@adjust{%
-  \newcommand*{\sls@hfline@adjust}{0}%
-}
+\newcommand*{\sls@hfline@adjust}{0}%
 \KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}
 \KOMA@key{ilines}[]{%
   \ifx\relax#1\relax
@@ -882,8 +792,6 @@
     \def\FamilyKeyStateProcessed{unexpected value}%
   \fi
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@ilines@default}
 \KOMA@key{clines}[]{%
   \ifx\relax#1\relax
     \renewcommand*{\sls@hfline@adjust}{1}%
@@ -896,8 +804,6 @@
     \def\FamilyKeyStateProcessed{unexpected value}%
   \fi
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@clines@default}
 \KOMA@key{olines}[]{%
   \ifx\relax#1\relax
     \renewcommand*{\sls@hfline@adjust}{2}%
@@ -910,8 +816,6 @@
     \def\FamilyKeyStateProcessed{unexpected value}%
   \fi
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@olines@default}
 \KOMA@kav@add{.scrlayer-scrpage.sty}{ilines}{}
 %</options>
 %    \end{macrocode}
@@ -935,18 +839,10 @@
 %   \end{description}
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\setheadtopline{%
-  \newcommand*{\setheadtopline}{\sls@setline{head}{above}}%
-}
-\scrlayerAddToInterface\setheadsepline{%
-  \newcommand*{\setheadsepline}{\sls@setline{head}{below}}%
-}
-\scrlayerAddToInterface\setfootsepline{%
-  \newcommand*{\setfootsepline}{\sls@setline{foot}{above}}%
-}
-\scrlayerAddToInterface\setfootbotline{%
-  \newcommand*{\setfootbotline}{\sls@setline{foot}{below}}%
-}
+\newcommand*{\setheadtopline}{\sls@setline{head}{above}}%
+\newcommand*{\setheadsepline}{\sls@setline{head}{below}}%
+\newcommand*{\setfootsepline}{\sls@setline{foot}{above}}%
+\newcommand*{\setfootbotline}{\sls@setline{foot}{below}}%
 %    \end{macrocode}
 % \begin{macro}{\sls@setline}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -964,78 +860,72 @@
 % Helper to set up the line attributes processing the parameters of the
 % commands above.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@setline{%
-  \newcommand*\sls@setline[2]{%
-    \kernel@ifnextchar[%]
-    {\sls@@setline{#1}{#2}}{\sls@@@setline{#1#2}}%
-  }%
-}
-\scrlayerAddToInterface\sls@@setline{%
-  \def\sls@@setline#1#2[#3]{%
-    \Ifstr{#3}{auto}{%
-      \sls@deftowidthof{sls@#1#2@linelength}{#3#1}%
-    }{%
-      \sls@deftowidthof{sls@#1#2@linelength}{#3}%
-    }%
-    \sls@@@setline{#1#2}%
+\newcommand*\sls@setline[2]{%
+  \kernel@ifnextchar[%]
+  {\sls@@setline{#1}{#2}}{\sls@@@setline{#1#2}}%
+}%
+\newcommand*{\sls@@setline}{}
+\def\sls@@setline#1#2[#3]{%
+  \Ifstr{#3}{auto}{%
+    \sls@deftowidthof{sls@#1#2@linelength}{#3#1}%
+  }{%
+    \sls@deftowidthof{sls@#1#2@linelength}{#3}%
   }%
-}
-\scrlayerAddToInterface\sls@@@setline{%
-  \def\sls@@@setline#1#2{%
-    \edef\@tempa{#2}\edef\@tempb{current}%
-    \Ifstr{#2}{}{}{%
-      \Ifstr{#2}{current}{}{%
-        \setlength{\@tempdima}{#2}%
-        \Ifstr{#1}{headabove}{%
+  \sls@@@setline{#1#2}%
+}%
+\newcommand*{\sls@@@setline}[2]{%
+  \edef\@tempa{#2}\edef\@tempb{current}%
+  \Ifstr{#2}{}{}{%
+    \Ifstr{#2}{current}{}{%
+      \setlength{\@tempdima}{#2}%
+      \Ifstr{#1}{headabove}{%
+        \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+          {headtopline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+      }{\Ifstr{#1}{headbelow}{%
           \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
-            {headtopline=\@tempdima:\csname sls@#1@linelength\endcsname}%
-        }{\Ifstr{#1}{headbelow}{%
+            {headsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+        }{%
+          \Ifstr{#1}{footabove}{%
             \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
-              {headsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
+              {footsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
           }{%
-            \Ifstr{#1}{footabove}{%
-              \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
-                {footsepline=\@tempdima:\csname sls@#1@linelength\endcsname}%
-            }{%
-              \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
-                {footbotline=\@tempdima:\csname sls@#1@linelength\endcsname}%
-            }%
+            \KOMAExecuteOptions[.scrlayer-scrpage.sty]%
+              {footbotline=\@tempdima:\csname sls@#1@linelength\endcsname}%
           }%
         }%
       }%
     }%
-    \PackageWarning{scrlayer-scrpage}{%
-      Command deprecated!\MessageBreak
-      Usage of `\string\setheadtopline',
-      `\string\setheadsepline',\MessageBreak
-      `\string\setfootsepline', and `\string\setfootbotline'\MessageBreak
-      became deprecated with scrlayer-scrpage.\MessageBreak
-      You should use KOMA-Script options\MessageBreak
-      `headsepline', `headtopline', `footsepline',\MessageBreak
-      or `footbotline' with values\MessageBreak
-      `<line thickness>:<line length>' to setup\MessageBreak
-      the line length and thickness, and\MessageBreak
-      `\string\setkomafont' or `\string\addtokomafont' to\MessageBreak
-      setup the colour%
-    }%
-    \kernel@ifnextchar[%]
-    {%
-      \sls@@@@setline{#1}%
-    }{%
-    }%
   }%
-}
-\scrlayerAddToInterface\sls@@@@setline{%
-  \def\sls@@@@setline#1[#2]{%
-    \Ifstr{#1}{headabove}{\setkomafont{headtopline}{#2}}{%
-      \Ifstr{#1}{headbelow}{\setkomafont{headsepline}{#2}}{%
-        \Ifstr{#1}{footabove}{\setkomafont{footsepline}{#2}}{%
-          \setkomafont{footbotline}{#2}%
-        }%
+  \PackageWarning{scrlayer-scrpage}{%
+    Command deprecated!\MessageBreak
+    Usage of `\string\setheadtopline',
+    `\string\setheadsepline',\MessageBreak
+    `\string\setfootsepline', and `\string\setfootbotline'\MessageBreak
+    became deprecated with scrlayer-scrpage.\MessageBreak
+    You should use KOMA-Script options\MessageBreak
+    `headsepline', `headtopline', `footsepline',\MessageBreak
+    or `footbotline' with values\MessageBreak
+    `<line thickness>:<line length>' to setup\MessageBreak
+    the line length and thickness, and\MessageBreak
+    `\string\setkomafont' or `\string\addtokomafont' to\MessageBreak
+    setup the colour%
+  }%
+  \kernel@ifnextchar[%]
+  {%
+    \sls@@@@setline{#1}%
+  }{%
+  }%
+}%
+\newcommand*{\sls@@@@setline}{}
+\def\sls@@@@setline#1[#2]{%
+  \Ifstr{#1}{headabove}{\setkomafont{headtopline}{#2}}{%
+    \Ifstr{#1}{headbelow}{\setkomafont{headsepline}{#2}}{%
+      \Ifstr{#1}{footabove}{\setkomafont{footsepline}{#2}}{%
+        \setkomafont{footbotline}{#2}%
       }%
     }%
   }%
-}
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@setline
 % \end{macro}%^^A \sls@@setline
@@ -1050,32 +940,16 @@
 % become only part of the interface if they are not.
 %    \begin{macrocode}
 \@ifundefined{scr@fnt@headtopline}{%
-  \@ifundefined{@headtoplinefont}{%
-    \scrlayer@AddCsToInterface{@headtoplinefont}%
-  }{}%
   \newkomafont{headtopline}{}%
-  \scrlayer@AddCsToInterface{scr@fnt@headtopline}%
 }{}
 \@ifundefined{scr@fnt@headsepline}{%
-  \@ifundefined{@headseplinefont}{%
-    \scrlayer@AddCsToInterface{@headseplinefont}%
-  }{}%
   \newkomafont{headsepline}{}%
-  \scrlayer@AddCsToInterface{scr@fnt@headsepline}%
 }{}
 \@ifundefined{scr@fnt@footsepline}{%
-  \@ifundefined{@footseplinefont}{%
-    \scrlayer@AddCsToInterface{@footseplinefont}%
-  }{}%
   \newkomafont{footsepline}{}%
-  \scrlayer@AddCsToInterface{scr@fnt@footsepline}%
 }{}
 \@ifundefined{scr@fnt@footbotline}{%
-  \@ifundefined{@footbotlinefont}{%
-    \scrlayer@AddCsToInterface{@footbotlinefont}%
-  }{}%
   \newkomafont{footbotline}{}%
-  \scrlayer@AddCsToInterface{scr@fnt@footbotline}%
 }{}
 %</body>
 %    \end{macrocode}
@@ -1256,7 +1130,6 @@
     \KOMA@kav@replacevalue{.scrlayer-scrpage.sty}{pagestyleset}{#1}%
   }%
 }
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@pagestyleset}
 %    \end{macrocode}
 % \begin{macro}{\sls@ps@style@standard}
 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
@@ -1264,63 +1137,59 @@
 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
 % These are the predefined page style sets.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@ps@style@standard{%
-  \newcommand*{\sls@ps@style@standard}{%
-    \let\MakeMarkcase\MakeUppercase
-    \scrlayer@AtEndOfPackage{%
-      \pagestyle{scrheadings}%
-      \clearpairofpagestyles
-      \ihead{\headmark}%
-      \ohead{\pagemark}%
-      \cfoot[\if@twoside\else\pagemark\fi]{}%
-    }%
+\newcommand*{\sls@ps@style@standard}{%
+  \let\MakeMarkcase\MakeUppercase
+  \scrlayer@AtEndOfPackage{%
+    \pagestyle{scrheadings}%
+    \clearpairofpagestyles
+    \ihead{\headmark}%
+    \ohead{\pagemark}%
+    \cfoot[\if@twoside\else\pagemark\fi]{}%
   }%
-}
-\scrlayerAddCsToInterface{sls@ps@style@KOMA-Script}{%
-  \@namedef{sls@ps@style@KOMA-Script}{%
-    \let\MakeMarkcase\@firstofone
-    \scrlayer@AtEndOfPackage{%
-      \pagestyle{scrheadings}%
-      \clearpairofpagestyles
-      \ohead{\if@twoside\headmark\fi}%
-      \chead{\if@twoside\else\headmark\fi}%
-      \ofoot[\if@twoside\pagemark\fi]{\if@twoside\pagemark\fi}%
-      \cfoot[\if@twoside\else\pagemark\fi]{\if@twoside\else\pagemark\fi}%
-      \scr@ifundefinedorrelax{KOMAClassName}{}{%
-        \Ifstr{\KOMAClassName}{scrlttr2}{%
+}%
+\expandafter\newcommand\expandafter*\csname sls@ps@style@KOMA-Script\endcsname{%
+  \let\MakeMarkcase\@firstofone
+  \scrlayer@AtEndOfPackage{%
+    \pagestyle{scrheadings}%
+    \clearpairofpagestyles
+    \ohead{\if@twoside\headmark\fi}%
+    \chead{\if@twoside\else\headmark\fi}%
+    \ofoot[\if@twoside\pagemark\fi]{\if@twoside\pagemark\fi}%
+    \cfoot[\if@twoside\else\pagemark\fi]{\if@twoside\else\pagemark\fi}%
+    \scr@ifundefinedorrelax{KOMAClassName}{}{%
+      \Ifstr{\KOMAClassName}{scrlttr2}{%
 %    \end{macrocode}
 % We are using \Class{scrlttr2}, so we have to initialise the page style
 % different:
 % \changes{v3.18}{2015/06/24}{missing \cs{lofoot} and \cs{rofoot} added}%^^A
 %    \begin{macrocode}
-          \clearpairofpagestyles
-          \lehead[\ifnum\@pageat=\z@\pagemark\fi]
-                 {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
-          \lohead[\ifnum\@pageat=\z@\pagemark\fi]
-                 {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
-          \chead[\ifnum\@pageat=\@ne\pagemark\fi]
-                {\ifcase\@pageat \rightmark\or \pagemark\or \rightmark\fi}%
-          \rehead[\ifnum\@pageat=\tw@\pagemark\fi]
-                 {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
-                   \else \rightmark\fi}%
-          \rohead[\ifnum\@pageat=\tw@\pagemark\fi]
-                 {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
-                   \else \rightmark\fi}%
-          \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]
-                 {\ifnum\@pageat=\thr@@\pagemark\fi}%
-          \lofoot[\ifnum\@pageat=\thr@@\pagemark\fi]
-                 {\ifnum\@pageat=\thr@@\pagemark\fi}%
-          \cfoot[\ifnum\@pageat=4 \pagemark\fi]
-                {\ifnum\@pageat=4 \pagemark\fi}%
-          \refoot[\ifnum\@pageat=5 \pagemark\fi]
-                 {\ifnum\@pageat=5 \pagemark\fi}%
-          \rofoot[\ifnum\@pageat=5 \pagemark\fi]
-                 {\ifnum\@pageat=5 \pagemark\fi}%
-        }{}%
-      }%
+        \clearpairofpagestyles
+        \lehead[\ifnum\@pageat=\z@\pagemark\fi]
+               {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
+        \lohead[\ifnum\@pageat=\z@\pagemark\fi]
+               {\ifnum\@pageat=\z@\pagemark\else\leftmark\fi}%
+        \chead[\ifnum\@pageat=\@ne\pagemark\fi]
+              {\ifcase\@pageat \rightmark\or \pagemark\or \rightmark\fi}%
+        \rehead[\ifnum\@pageat=\tw@\pagemark\fi]
+               {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
+                 \else \rightmark\fi}%
+        \rohead[\ifnum\@pageat=\tw@\pagemark\fi]
+               {\ifcase\@pageat \leftmark\or \rightmark\or \pagemark
+                 \else \rightmark\fi}%
+        \lefoot[\ifnum\@pageat=\thr@@\pagemark\fi]
+               {\ifnum\@pageat=\thr@@\pagemark\fi}%
+        \lofoot[\ifnum\@pageat=\thr@@\pagemark\fi]
+               {\ifnum\@pageat=\thr@@\pagemark\fi}%
+        \cfoot[\ifnum\@pageat=4 \pagemark\fi]
+              {\ifnum\@pageat=4 \pagemark\fi}%
+        \refoot[\ifnum\@pageat=5 \pagemark\fi]
+               {\ifnum\@pageat=5 \pagemark\fi}%
+        \rofoot[\ifnum\@pageat=5 \pagemark\fi]
+               {\ifnum\@pageat=5 \pagemark\fi}%
+      }{}%
     }%
   }%
-}
+}%
 %</options>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@ps@style@KOMA-Script
@@ -1394,9 +1263,10 @@
 % \end{description}
 % Note: \Package{scrpage2} also provides starred versions of the page style
 % definition commands, doing the same like the starless versions. This has
-% been done for compatibility reasons with deprecated \Package{scrpage2} and
+% been done for compatibility reasons with deprecated \Package{scrpage} and
 % may be removed some times. The layer interface doesn't support this.
 %
+%
 % \begin{macro}{\defpagestyle}
 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}%^^A
 %   \begin{description}
@@ -1410,41 +1280,16 @@
 % See \Package{scrpage2} implementation.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\defpagestyle{%
-  \newcommand*{\defpagestyle}[3]{%
-    \sls@defhead{#1}#2\@empty\@empty\@empty
-    \sls@deffoot{#1}#3\@empty\@empty\@empty 
-    \DeclarePageStyleByLayers{#1}{%
-      #1.head.odd,#1.head.even,#1.head.oneside,%
-      #1.head.above.line,#1.head.below.line,%
-      #1.foot.odd,#1.foot.even,#1.foot.oneside,%
-      #1.foot.above.line,#1.foot.below.line%
-    }%
-    \edef\reserved@a{%
-      \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
-        \noexpand\DestroyLayer{#1.head.odd}%
-        \noexpand\DestroyLayer{#1.head.even}%
-        \noexpand\DestroyLayer{#1.head.oneside}%
-        \noexpand\DestroyLayer{#1.head.above.line}%
-        \noexpand\DestroyLayer{#1.head.below.line}%
-        \noexpand\DestroyLayer{#1.foot.odd}%
-        \noexpand\DestroyLayer{#1.foot.even}%
-        \noexpand\DestroyLayer{#1.foot.oneside}%
-        \noexpand\DestroyLayer{#1.foot.above.line}%
-        \noexpand\DestroyLayer{#1.foot.below.line}%
-        \noexpand\Ifstr{\noexpand\currentpagestyle}{#1}{%
-          \noexpand\PackageWarning{scrlayer-scrpage}{%
-            page style `#1' not longer valid.\noexpand\MessageBreak
-            The page style has been defined using\noexpand\MessageBreak
-            interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
-            has been removed%
-          }%
-        }{}%
-        \noexpand\DestroyRealLayerPageStyle{#1}%
-      }%
-    }\reserved@a
+\newcommand*{\defpagestyle}[3]{%
+  \sls@defhead{#1}#2\@empty\@empty\@empty
+  \sls@deffoot{#1}#3\@empty\@empty\@empty 
+  \DeclarePageStyleByLayers{#1}{%
+    #1.head.odd,#1.head.even,#1.head.oneside,%
+    #1.head.above.line,#1.head.below.line,%
+    #1.foot.odd,#1.foot.even,#1.foot.oneside,%
+    #1.foot.above.line,#1.foot.below.line%
   }%
-}
+}%
 %    \end{macrocode}
 % \begin{macro}{\sls@defhead}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -1473,86 +1318,82 @@
 %   \end{description}
 % Helper to define the head layers.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@defhead{%
-  \newcommand*\sls@defhead[1]{%
-    \kernel@ifnextchar(%)
-    {\sls@@defhead{#1}}%
-    {\sls@@defhead{#1}(\sls@headabove@linelength,\sls@headabove@linethickness)}%
-  }%
-}
-\scrlayerAddToInterface\sls@@defhead{%
-  \def\sls@@defhead#1(#2,#3)#4#5#6{%
-    \kernel@ifnextchar(%)
-    {\sls@@@defhead{#1}({#2},{#3}){#4}{#5}{#6}}%
-    {\sls@@@defhead{#1}%
-                   ({#2},{#3})%
-                   {#4}{#5}{#6}%
-                   (\sls@headbelow@linelength,\sls@headbelow@linethickness)}%
-  }%
-}
-\scrlayerAddToInterface\sls@@@defhead{%
-  \def\sls@@@defhead#1(#2,#3)#4#5#6(#7,#8){%
+\newcommand*\sls@defhead[1]{%
+  \kernel@ifnextchar(%)
+  {\sls@@defhead{#1}}%
+  {\sls@@defhead{#1}(\sls@headabove@linelength,\sls@headabove@linethickness)}%
+}%
+\newcommand*{\sls@@defhead}{}
+\def\sls@@defhead#1(#2,#3)#4#5#6{%
+  \kernel@ifnextchar(%)
+  {\sls@@@defhead{#1}({#2},{#3}){#4}{#5}{#6}}%
+  {\sls@@@defhead{#1}%
+                 ({#2},{#3})%
+                 {#4}{#5}{#6}%
+                 (\sls@headbelow@linelength,\sls@headbelow@linethickness)}%
+}%
+\newcommand*{\sls@@@defhead}{}
+\def\sls@@@defhead#1(#2,#3)#4#5#6(#7,#8){%
 %    \end{macrocode}
 % The lines:
 %    \begin{macrocode}
-    \DeclareLayer[%
-      background,%
-      hoffset=\sls@leftmargin{head},%
-      voffset=\sls@topmargin+\dp\strutbox,%
-      width=\sls@headwidth,%
-      height=0pt,%
-      align=bl,%
-      contents={%
-        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
-              \sls@hf@rule{headtop}{#2}{#3}}}}%
-      }%
-    ]{#1.head.above.line}%
-    \DeclareLayer[%
-      background,%
-      hoffset=\sls@leftmargin{head},%
-      voffset=\sls@topmargin+\headheight-\ht\strutbox+#8,%
-      width=\sls@headwidth,%
-      height=0pt,%
-      align=tl,%
-      contents={%
-        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
-              \sls@hf@rule{headsep}{#7}{#8}}}}%
-      }%
-    ]{#1.head.below.line}%
+  \DeclareLayer[%
+    background,%
+    hoffset=\sls@leftmargin{head},%
+    voffset=\sls@topmargin+\dp\strutbox,%
+    width=\sls@headwidth,%
+    height=0pt,%
+    align=bl,%
+    contents={%
+      {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
+            \sls@hf@rule{headtop}{#2}{#3}}}}%
+    }%
+  ]{#1.head.above.line}%
+  \DeclareLayer[%
+    background,%
+    hoffset=\sls@leftmargin{head},%
+    voffset=\sls@topmargin+\headheight-\ht\strutbox+#8,%
+    width=\sls@headwidth,%
+    height=0pt,%
+    align=tl,%
+    contents={%
+      {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagehead}{%
+            \sls@hf@rule{headsep}{#7}{#8}}}}%
+    }%
+  ]{#1.head.below.line}%
 %    \end{macrocode}
 % The odd side, even side and one side:
 % \changes{v3.13b}{2014/10/16}{workaround: additional group added to avoid
 %   pdf\TeX{} color stack warnings}%^^A
 %    \begin{macrocode}
-    \DeclareLayer[%
-      background,evenpage,twoside,%
-      head,%
-      hoffset=\sls@leftmargin{head},%
-      width=\sls@headwidth,%
-      contents={%
-        \sls@secure@box\headheight{%
-          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#4}}}}}%
-    ]{#1.head.even}%
-    \DeclareLayer[%
-      background,oddpage,twoside,%
-      head,%
-      hoffset=\sls@leftmargin{head},%
-      width=\sls@headwidth,%
-      contents={%
-        \sls@secure@box\headheight{%
-          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#5}}}}}%
-    ]{#1.head.odd}%
-    \DeclareLayer[%
-      background,oddpage,oneside,%
-      head,%
-      hoffset=\sls@leftmargin{head},%
-      width=\sls@headwidth,%
-      contents={%
-        \sls@secure@box\headheight{%
-          \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#6}}}}}%
-    ]{#1.head.oneside}%
-  }%
-}
+  \DeclareLayer[%
+    background,evenpage,twoside,%
+    head,%
+    hoffset=\sls@leftmargin{head},%
+    width=\sls@headwidth,%
+    contents={%
+      \sls@secure@box\headheight{%
+        \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#4}}}}}%
+  ]{#1.head.even}%
+  \DeclareLayer[%
+    background,oddpage,twoside,%
+    head,%
+    hoffset=\sls@leftmargin{head},%
+    width=\sls@headwidth,%
+    contents={%
+      \sls@secure@box\headheight{%
+        \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#5}}}}}%
+  ]{#1.head.odd}%
+  \DeclareLayer[%
+    background,oddpage,oneside,%
+    head,%
+    hoffset=\sls@leftmargin{head},%
+    width=\sls@headwidth,%
+    contents={%
+      \sls@secure@box\headheight{%
+        \normalfont{\usekomafont{pageheadfoot}{\usekomafont{pagehead}{#6}}}}}%
+  ]{#1.head.oneside}%
+}%
 %    \end{macrocode}
 % \begin{macro}{\sls@deffoot}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -1581,93 +1422,89 @@
 %   \end{description}
 % Helper to define the foot layers.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@deffoot{%
-  \newcommand*\sls@deffoot[1]{%
-    \kernel@ifnextchar(%)
-    {\sls@@deffoot{#1}}%
-    {\sls@@deffoot{#1}(\sls@footabove@linelength,\sls@footabove@linethickness)}%
-  }%
-}
-\scrlayerAddToInterface\sls@@deffoot{%
-  \def\sls@@deffoot#1(#2,#3)#4#5#6{%
-    \kernel@ifnextchar(%)
-    {\sls@@@deffoot{#1}({#2},{#3}){#4}{#5}{#6}}%
-    {\sls@@@deffoot{#1}%
-                   ({#2},{#3})%
-                   {#4}{#5}{#6}%
-                   (\sls@footbelow@linelength,\sls@footbelow@linethickness)}%
-  }%
-}
-\scrlayerAddToInterface\sls@@@deffoot{%
-  \def\sls@@@deffoot#1(#2,#3)#4#5#6(#7,#8){%
+\newcommand*\sls@deffoot[1]{%
+  \kernel@ifnextchar(%)
+  {\sls@@deffoot{#1}}%
+  {\sls@@deffoot{#1}(\sls@footabove@linelength,\sls@footabove@linethickness)}%
+}%
+\newcommand*{\sls@@deffoot}{}
+\def\sls@@deffoot#1(#2,#3)#4#5#6{%
+  \kernel@ifnextchar(%)
+  {\sls@@@deffoot{#1}({#2},{#3}){#4}{#5}{#6}}%
+  {\sls@@@deffoot{#1}%
+                 ({#2},{#3})%
+                 {#4}{#5}{#6}%
+                 (\sls@footbelow@linelength,\sls@footbelow@linethickness)}%
+}%
+\newcommand*{\sls@@@deffoot}{}
+\def\sls@@@deffoot#1(#2,#3)#4#5#6(#7,#8){%
 %    \end{macrocode}
 % The lines:
 %    \begin{macrocode}
-    \DeclareLayer[%
-      foreground,%
-      hoffset=\sls@leftmargin{foot},%
-      voffset=\sls@topmargin
-              +\headheight+\headsep
-              +\textheight
-              +\footskip-\footheight
-              +2\dp\strutbox,%
-      width=\sls@footwidth,%
-      height=0pt,%
-      align=bl,%
-      contents={%
-        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
-              \sls@hf@rule{footsep}{#2}{#3}}}}%
-      }%
-    ]{#1.foot.above.line}%
-    \DeclareLayer[%
-      foreground,%
-      hoffset=\sls@leftmargin{foot},%
-      voffset=\sls@topmargin
-              +\headheight+\headsep
-              +\textheight
-              +\footskip
-              +2\dp\strutbox
-              +#8,%
-      width=\sls@footwidth,%
-      height=0pt,%
-      align=bl,%
-      contents={%
-        {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
-              \sls@hf@rule{footbot}{#7}{#8}}}}%
-      }%
-    ]{#1.foot.below.line}%
+  \DeclareLayer[%
+    foreground,%
+    hoffset=\sls@leftmargin{foot},%
+    voffset=\sls@topmargin
+            +\headheight+\headsep
+            +\textheight
+            +\footskip-\footheight
+            +2\dp\strutbox,%
+    width=\sls@footwidth,%
+    height=0pt,%
+    align=bl,%
+    contents={%
+      {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
+            \sls@hf@rule{footsep}{#2}{#3}}}}%
+    }%
+  ]{#1.foot.above.line}%
+  \DeclareLayer[%
+    foreground,%
+    hoffset=\sls@leftmargin{foot},%
+    voffset=\sls@topmargin
+            +\headheight+\headsep
+            +\textheight
+            +\footskip
+            +2\dp\strutbox
+            +#8,%
+    width=\sls@footwidth,%
+    height=0pt,%
+    align=bl,%
+    contents={%
+      {\normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{%
+            \sls@hf@rule{footbot}{#7}{#8}}}}%
+    }%
+  ]{#1.foot.below.line}%
 %    \end{macrocode}
 % The odd side, even side and one side:
 %    \begin{macrocode}
-    \DeclareLayer[%
-      foreground,evenpage,twoside,%
-      foot,%
-      hoffset=\sls@leftmargin{foot},%
-      width=\sls@footwidth,%
-      contents={%
-        \sls@secure@box\footheight{%
-          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#4}}}}%
-    ]{#1.foot.even}%
-    \DeclareLayer[%
-      foreground,oddpage,twoside,%
-      foot,%
-      hoffset=\sls@leftmargin{foot},%
-      width=\sls@footwidth,%
-      contents={%
-        \sls@secure@box\footheight{%
-          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#5}}}}%
-    ]{#1.foot.odd}%
-    \DeclareLayer[%
-      foreground,oddpage,oneside,%
-      foot,%
-      hoffset=\sls@leftmargin{foot},%
-      width=\sls@footwidth,%
-      contents={%
-        \sls@secure@box\footheight{%
-          \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#6}}}}%
-    ]{#1.foot.oneside}%
-  }%
-}
+  \DeclareLayer[%
+    foreground,evenpage,twoside,%
+    foot,%
+    hoffset=\sls@leftmargin{foot},%
+    width=\sls@footwidth,%
+    contents={%
+      \sls@secure@box\footheight{%
+        \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#4}}}}%
+  ]{#1.foot.even}%
+  \DeclareLayer[%
+    foreground,oddpage,twoside,%
+    foot,%
+    hoffset=\sls@leftmargin{foot},%
+    width=\sls@footwidth,%
+    contents={%
+      \sls@secure@box\footheight{%
+        \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#5}}}}%
+  ]{#1.foot.odd}%
+  \DeclareLayer[%
+    foreground,oddpage,oneside,%
+    foot,%
+    hoffset=\sls@leftmargin{foot},%
+    width=\sls@footwidth,%
+    contents={%
+      \sls@secure@box\footheight{%
+        \normalfont\usekomafont{pageheadfoot}{\usekomafont{pagefoot}{#6}}}}%
+  ]{#1.foot.oneside}%
+}%
 %    \end{macrocode}
 % \begin{macro}{\sls@secure@box}
 %   \begin{description}
@@ -1678,68 +1515,66 @@
 %   \end{description}
 % Note, that several length may be changed, to fit.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@secure@box{%
-  \newcommand*{\sls@secure@box}[2]{%
-    \begingroup
-      \setbox\z@\vbox{%
-        \ifsls@leavevmode\leavevmode\expandafter\ignorespaces\fi 
-        #2%
-      }%
-      \ifdim #1<\dimexpr \ht\z@+\dp\z@\relax
-        \PackageWarning{scrlayer-scrpage}{%
-          \string#1 to low.\MessageBreak
-          At least \the\dimexpr \ht\z@+\dp\z@\relax\space needed,\MessageBreak
-          but only \the#1 found.\MessageBreak
-          \ifsls@autoenlarge
-            I'll enlarge \string#1, for further\MessageBreak
-            processing, but you should do this yourself,\MessageBreak
-          \else
-            You should enlarge \string#1,\MessageBreak
-          \fi
-          e.g.,
-          \scr@ifundefinedorrelax{geometry}{%
-            \scr@ifundefinedorrelax{typearea}{%
-              using\MessageBreak
-              \space\space\string\setlength{\string#1}{%
-                \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
-              in your preamble%
-            }{%
-              setting typearea's option\MessageBreak
-              `\expandafter\@gobble\string#1=\the\dimexpr \ht\z@+\dp\z@\relax'%
-            }%
+\newcommand*{\sls@secure@box}[2]{%
+  \begingroup
+    \setbox\z@\vbox{%
+      \ifsls@leavevmode\leavevmode\expandafter\ignorespaces\fi 
+      #2%
+    }%
+    \ifdim #1<\dimexpr \ht\z@+\dp\z@\relax
+      \PackageWarning{scrlayer-scrpage}{%
+        \string#1 to low.\MessageBreak
+        At least \the\dimexpr \ht\z@+\dp\z@\relax\space needed,\MessageBreak
+        but only \the#1 found.\MessageBreak
+        \ifsls@autoenlarge
+          I'll enlarge \string#1, for further\MessageBreak
+          processing, but you should do this yourself,\MessageBreak
+        \else
+          You should enlarge \string#1,\MessageBreak
+        \fi
+        e.g.,
+        \scr@ifundefinedorrelax{geometry}{%
+          \scr@ifundefinedorrelax{typearea}{%
+            using\MessageBreak
+            \space\space\string\setlength{\string#1}{%
+              \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
+            in your preamble%
           }{%
-            \ifx #1\headheight
-              setting geometry's option\MessageBreak
-              `head=\the\dimexpr \ht\z@+\dp\z@\relax'%
-            \else
-              using\MessageBreak
-              \space\space\string\setlength{\string#1}{%
-                \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
-              in your preamble%
-            \fi
+            setting typearea's option\MessageBreak
+            `\expandafter\@gobble\string#1=\the\dimexpr \ht\z@+\dp\z@\relax'%
           }%
-          \ifsls@autoenlarge
-            .\MessageBreak
-            I'll also
-            \ifx #1\headheight decrease \string\topmargin
-            \else increase \string\footskip\fi
-          \fi
-        }%
-        \ifsls@autoenlarge
-          \@tempdima\dimexpr \ht\z@+\dp\z@\relax
+        }{%
           \ifx #1\headheight
-            \global\advance\topmargin by \dimexpr #1-(\ht\z@+\dp\z@)\relax
-            \dp\z@\dimexpr \dp\z@+\ht\z@+\dp\z@-\headheight\relax
+            setting geometry's option\MessageBreak
+            `head=\the\dimexpr \ht\z@+\dp\z@\relax'%
           \else
-            \global\advance\footskip by \dimexpr \ht\z@+\dp\z@-#1\relax
+            using\MessageBreak
+            \space\space\string\setlength{\string#1}{%
+              \the\dimexpr \ht\z@+\dp\z@\relax}\MessageBreak
+            in your preamble%
           \fi
-          \global#1\@tempdima
+        }%
+        \ifsls@autoenlarge
+          .\MessageBreak
+          I'll also
+          \ifx #1\headheight decrease \string\topmargin
+          \else increase \string\footskip\fi
+        \fi
+      }%
+      \ifsls@autoenlarge
+        \@tempdima\dimexpr \ht\z@+\dp\z@\relax
+        \ifx #1\headheight
+          \global\advance\topmargin by \dimexpr #1-(\ht\z@+\dp\z@)\relax
+          \dp\z@\dimexpr \dp\z@+\ht\z@+\dp\z@-\headheight\relax
+        \else
+          \global\advance\footskip by \dimexpr \ht\z@+\dp\z@-#1\relax
         \fi
+        \global#1\@tempdima
       \fi
-      \usebox\z@
-    \endgroup
-  }%
-}
+    \fi
+    \usebox\z@
+  \endgroup
+}%
 %</body>
 %    \end{macrocode}
 % \begin{option}{hmode}
@@ -1748,10 +1583,6 @@
 %    \begin{macrocode}
 %<*options>
 \KOMA@ifkey{hmode}{sls@leavevmode}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@hmode@default}
-\scrlayer@AddCsToInterface{sls@leavevmode@linetrue}
-\scrlayer@AddCsToInterface{sls@leavevmode@linefalse}
 %</options>
 %    \end{macrocode}
 % \end{option}%^^A hmode
@@ -1763,11 +1594,6 @@
 %<*options>
 \KOMA@ifkey{autoenlargeheadfoot}{sls@autoenlarge}
 \KOMAExecuteOptions{autoenlargeheadfoot=true}
-\scrlayer@AddCsToInterface{KV@KOMA.scrlayer-scrpage.sty@autoenlargeheadfoot}
-\scrlayer@AddCsToInterface{%
-  KV@KOMA.scrlayer-scrpage.sty@autoenlargeheadfoot@default}
-\scrlayer@AddCsToInterface{sls@autoenlargetrue}
-\scrlayer@AddCsToInterface{sls@autoenlargefalse}
 %</options>
 %    \end{macrocode}
 % \end{option}%^^A autoenlargeheadfoot
@@ -1797,16 +1623,13 @@
     }%
     \let\scr@fnt@instead@pagehead\relax
   }%
-  \scrlayer@AddCsToInterface{scr@fnt@pagehead}%
   \@ifundefined{@pageheadfont}{%
     \newcommand*{\@pageheadfont}{}%
-    \scrlayer@AddCsToInterface{@pageheadfont}%
   }{}%
   \newcommand*{\scr@fnt@pagehead}{\@pageheadfont}%
 }{}
 \@ifundefined{scr@fnt@pageheadfoot}{%
   \newcommand*{\scr@fnt@pageheadfoot}{\headfont}%
-  \scrlayer@AddCsToInterface{scr@fnt@pageheadfoot}%
   \@ifundefined{headfont}{%
     \newcommand*{\headfont}{\normalcolor\slshape}%
   }{}
@@ -1831,11 +1654,9 @@
 % \changes{v0.9}{2014/01/13}{warning always deactivated}
 %    \begin{macrocode}
 \@ifundefined{scr@fnt@pagefoot}{%
-  \scrlayer@AddCsToInterface{scr@fnt@pagefoot}%
   \def\scr@fnt@pagefoot{\footfont}%
   \@ifundefined{footfont}{%
     \newcommand*{\footfont}{}%
-    \scrlayer@AddCsToInterface{footfont}%
   }{}%
 }{}
 \scr@ifundefinedorrelax{scr@fnt@wrn@pagefoot}{}{%
@@ -1858,56 +1679,50 @@
 %   \end{description}
 % Helper to draw the line.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@hf@rule{%
-  \newcommand*\sls@hf@rule[3]{%
-    \begingroup
-      \normalfont\usekomafont{#1line}{%
-        \vbox to \z@{%
-          \kern -\dimexpr #3\relax
-          \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
-          \if@twoside\ifodd\value{page}\else
-            \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
-          \fi\fi
-          \if@tempswa
-            \hskip \z@\@plus 1fill\@minus \paperwidth
-          \fi
-          \vrule \@width\dimexpr #2\relax \@height\dimexpr #3\relax \@depth\z@
+\newcommand*\sls@hf@rule[3]{%
+  \begingroup
+    \normalfont\usekomafont{#1line}{%
+      \vbox to \z@{%
+        \kern -\dimexpr #3\relax
+        \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
+        \if@twoside\ifodd\value{page}\else
           \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
-          \if@twoside\ifodd\value{page}\else
-            \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
-          \fi\fi
-          \if@tempswa
-            \hskip \z@\@plus 1fill\@minus \paperwidth\null
-          \fi
-        }%
-      }%      
-    \endgroup
-  }%
-}
+        \fi\fi
+        \if@tempswa
+          \hskip \z@\@plus 1fill\@minus \paperwidth
+        \fi
+        \vrule \@width\dimexpr #2\relax \@height\dimexpr #3\relax \@depth\z@
+        \ifnum \sls@hfline@adjust<\tw@ \@tempswatrue\else \@tempswafalse\fi
+        \if@twoside\ifodd\value{page}\else
+          \ifnum \sls@hfline@adjust>\z@ \@tempswatrue \else \@tempswafalse\fi
+        \fi\fi
+        \if@tempswa
+          \hskip \z@\@plus 1fill\@minus \paperwidth\null
+        \fi
+      }%
+    }%      
+  \endgroup
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@hf@rule
 % \begin{macro}{\sls@topmargin}
 % \begin{macro}{\sls@leftmargin}
 % Two simple helper macros:
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@topmargin{%
-  \newcommand*{\sls@topmargin}{\dimexpr\topmargin+1in\relax}%
-}
-\scrlayerAddToInterface\sls@leftmargin{%
-  \newcommand*{\sls@leftmargin}[1]{%
-    \dimexpr
-    \if@twoside
-      \ifodd\value{page}
-        \oddsidemargin+\csname sls@odd#1shift\endcsname
-      \else
-        \evensidemargin+\csname sls@even#1shift\endcsname
-      \fi
-    \else
+\newcommand*{\sls@topmargin}{\dimexpr\topmargin+1in\relax}%
+\newcommand*{\sls@leftmargin}[1]{%
+  \dimexpr
+  \if@twoside
+    \ifodd\value{page}
       \oddsidemargin+\csname sls@odd#1shift\endcsname
-    \fi 
-    +1in\relax
-  }%
-}
+    \else
+      \evensidemargin+\csname sls@even#1shift\endcsname
+    \fi
+  \else
+    \oddsidemargin+\csname sls@odd#1shift\endcsname
+  \fi 
+  +1in\relax
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@leftmargin
@@ -1915,49 +1730,89 @@
 % \end{macro}%^^A \defpagestyle
 %
 % \begin{macro}{\newpagestyle}
+% \changes{v3.32}{2020/09/11}{test for \textsf{titlesec}}
 % For the parameters see \Macro{defpagestyle}.
-% Define only, if not already defined:
+% Define the pagestyle only, if not already defined. Unfortunately
+% \textsf{titlesec} also defines this command. So new definition will
+% fail. \textsf{titlesec} uses \cs{providecommand} so if the order would be
+% changed, everything would be OK.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\newpagestyle{%
-  \newcommand*\newpagestyle[3]{%
-    \@ifundefined{ps@#1}{\defpagestyle{#1}{#2}{#3}}{%
-      \PackageError{scrlayer-scrpage}{Page style `#1' already defined}{%
-        Only not yet defined page style may be defined using
-        \string\newpagestyle.\MessageBreak
-        You may use either \string\renewpagestyle, \string\providepagestyle,
-        or \string\defpagestyle\MessageBreak
-        with already defined page styles.\MessageBreak
-        If you'll continue, your command will be ignored.%
+\@ifpackageloaded{titlesec}{%
+  \@ifundefined{newpagestyle}{}{%
+    \@ifpackageloaded{titleps}{}{%
+      \PackageWarningNoLine{scrlayer-scrpage}{%
+        it seems that package `titlesec' is used\MessageBreak
+        and has already defined `\string\newpagestyle'.\MessageBreak
+        To avoid this warning message, you should\MessageBreak
+        load package `titlesec' not before package\MessageBreak
+        `scrlayer-scrpage'. If you need `titlesec'\MessageBreak
+        you could load it after `scrlayer-scrpage',\MessageBreak
+        but you still would not be able to use\MessageBreak
+        the `titlesec' implemenation of\MessageBreak
+        `\string\newpagestyle'%
       }%
+      \let\newpagestyle\relax
     }%
   }%
-}
+}{}
+\newcommand*\newpagestyle[3]{%
+  \@ifundefined{ps@#1}{\defpagestyle{#1}{#2}{#3}}{%
+    \PackageError{scrlayer-scrpage}{Page style `#1' already defined}{%
+      Only not yet defined page style may be defined using
+      \string\newpagestyle.\MessageBreak
+      You may use either \string\renewpagestyle, \string\providepagestyle,
+      or \string\defpagestyle\MessageBreak
+      with already defined page styles.\MessageBreak
+      If you'll continue, your command will be ignored.%
+    }%
+  }%
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \newpagestyle
 %
 % \begin{macro}{\renewpagestyle}
+% \changes{v3.32}{2020/09/11}{test for \textsf{titlesec}}
 % For the parameters see \Macro{defpagestyle}.
-% Define only, if not already defined:
+% Define the pagestyle only, if not already defined.  Unfortunately
+% \textsf{titlesec} also defines this command. So new definition will
+% fail. \textsf{titlesec} uses \cs{providecommand} so if the order would be
+% changed, everything would be OK.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\renewpagestyle{%
-  \newcommand*\renewpagestyle[3]{%
-    \@ifundefined{ps@#1}{%
-      \PackageError{scrlayer-scrpage}{Undefined page style `#1'}{%
-        Only already defined page style may be re-defined using
-        \string\renewpagestyle.\MessageBreak
-        You may use either \string\newpagestyle, \string\providepagestyle,
-        or \string\defpagestyle\MessageBreak
-        with not yet defined page styles.\MessageBreak
-        If you'll continue, your command will be ignored.%
+\@ifpackageloaded{titlesec}{%
+  \@ifundefined{renewpagestyle}{}{%
+    \@ifpackageloaded{titleps}{}{%
+      \PackageWarningNoLine{scrlayer-scrpage}{%
+        It seems that package `titlesec' is used\MessageBreak
+        and has already defined `\string\renewpagestyle'.\MessageBreak
+        To avoid this warning message, you should\MessageBreak
+        load package `titlesec' not before package\MessageBreak
+        `scrlayer-scrpage'. If you need `titlesec'\MessageBreak
+        you could load it after `scrlayer-scrpage',\MessageBreak
+        but you still would not be able to use\MessageBreak
+        the `titlesec' implemenation of\MessageBreak
+        `\string\renewpagestyle'%
       }%
-    }{%
-      \defpagestyle{#1}{#2}{#3}%
+      \let\renewpagestyle\relax
     }%
   }%
-}
+}{}
+\newcommand*\renewpagestyle[3]{%
+  \@ifundefined{ps@#1}{%
+    \PackageError{scrlayer-scrpage}{Undefined page style `#1'}{%
+      Only already defined page style may be re-defined using
+      \string\renewpagestyle.\MessageBreak
+      You may use either \string\newpagestyle, \string\providepagestyle,
+      or \string\defpagestyle\MessageBreak
+      with not yet defined page styles.\MessageBreak
+      If you'll continue, your command will be ignored.%
+    }%
+  }{%
+    \defpagestyle{#1}{#2}{#3}%
+  }%
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \renewpagestyle
@@ -1967,18 +1822,16 @@
 % Define only, if not already defined:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\providepagestyle{%
-  \newcommand*\providepagestyle[3]{%
-    \@ifundefined{ps@#1}{%
-      \defpagestyle{#1}{#2}{#3}%
-    }{%
+\newcommand*\providepagestyle[3]{%
+  \@ifundefined{ps@#1}{%
+    \defpagestyle{#1}{#2}{#3}%
+  }{%
 %<*trace>
-      \PackageInfo{scrlayer-scrpage}{%
-        page style `#1' already defined.\MessageBreak
-        New definition ignored%
-      }%
-%</trace>
+    \PackageInfo{scrlayer-scrpage}{%
+      page style `#1' already defined.\MessageBreak
+      New definition ignored%
     }%
+%</trace>
   }%
 }
 %</body>
@@ -2029,30 +1882,22 @@
 % defined. Additional commands have been added.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface{\deftriplepagestyle}{%
-  \newcommand*{\deftriplepagestyle}[1]{%
-    \let\@tempa\defpagestyle
-    \scrlayer@triplestyle{#1}%
-  }%
-}
-\scrlayerAddToInterface{\newtriplepagestyle}{%
-  \newcommand*{\newtriplepagestyle}[1]{%
-    \let\@tempa\newpagestyle
-    \scrlayer@triplestyle{#1}%
-  }%
-}
-\scrlayerAddToInterface{\renewtriplepagestyle}{%
-  \newcommand*{\renewtriplepagestyle}[1]{%
-    \let\@tempa\renewpagestyle
-    \scrlayer@triplestyle{#1}%
-  }%
-}
-\scrlayerAddToInterface{\providetriplepagestyle}{%
-  \newcommand*{\providetriplepagestyle}[1]{%
-    \let\@tempa\providepagestyle
-    \scrlayer@triplestyle{#1}%
-  }%
-}
+\newcommand*{\deftriplepagestyle}[1]{%
+  \let\@tempa\defpagestyle
+  \scrlayer@triplestyle{#1}%
+}%
+\newcommand*{\newtriplepagestyle}[1]{%
+  \let\@tempa\newpagestyle
+  \scrlayer@triplestyle{#1}%
+}%
+\newcommand*{\renewtriplepagestyle}[1]{%
+  \let\@tempa\renewpagestyle
+  \scrlayer@triplestyle{#1}%
+}%
+\newcommand*{\providetriplepagestyle}[1]{%
+  \let\@tempa\providepagestyle
+  \scrlayer@triplestyle{#1}%
+}%
 %    \end{macrocode}
 % \begin{macro}{\scrlayer@triplestyle}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2065,73 +1910,67 @@
 % to be one of \Macro{defpagestyle}, \Macro{newpagestyle},
 % \Macro{renewpagestyle}, or \Macro{providepagestyle}.
 %    \begin{macrocode}
-\scrlayerAddToInterface\scrlayer@triplestyle{%
-  \def\scrlayer@triplestyle#1{%
-    \kernel@ifnextchar[%]
-    {\scrlayer@@triplestyle{#1}}%
-    {\scrlayer@@triplestyle{#1}[\z@]}%
-  }
-}
-\scrlayerAddToInterface\scrlayer@@triplestyle{%
-  \def\scrlayer@@triplestyle#1[#2]{%
-   \kernel@ifnextchar[%]
-    {\scrlayer@@@triplestyle{#1}[#2]}%
-    {\scrlayer@@@triplestyle{#1}[\z@][#2]}%
-  }%
-}
-\scrlayerAddToInterface\scrlayer@@@triplestyle{%
-  \def\scrlayer@@@triplestyle#1[#2][#3]#4#5#6#7#8#9{%
-    \@tempa{#1}{%
-      (\sls@headwidth,#2)%
-      {%
-        \makebox[\z@][l]{#6}\hfill
-        \makebox[\z@][c]{#5}\hfill
-        \makebox[\z@][r]{#4}%
-      }{%
-        \makebox[\z@][l]{#4}\hfill
-        \makebox[\z@][c]{#5}\hfill
-        \makebox[\z@][r]{#6}%
-      }{%
-        \makebox[\z@][l]{#4}\hfill
-        \makebox[\z@][c]{#5}\hfill
-        \makebox[\z@][r]{#6}%
-      }%
-      (\sls@headwidth,#3)%
+\newcommand*{\scrlayer@triplestyle}[1]{%
+  \kernel@ifnextchar[%]
+  {\scrlayer@@triplestyle{#1}}%
+  {\scrlayer@@triplestyle{#1}[\z@]}%
+}
+\newcommand*{\scrlayer@@triplestyle}{}
+\def\scrlayer@@triplestyle#1[#2]{%
+ \kernel@ifnextchar[%]
+  {\scrlayer@@@triplestyle{#1}[#2]}%
+  {\scrlayer@@@triplestyle{#1}[\z@][#2]}%
+}%
+\newcommand*{\scrlayer@@@triplestyle}{}
+\def\scrlayer@@@triplestyle#1[#2][#3]#4#5#6#7#8#9{%
+  \@tempa{#1}{%
+    (\sls@headwidth,#2)%
+    {%
+      \makebox[\z@][l]{#6}\hfill
+      \makebox[\z@][c]{#5}\hfill
+      \makebox[\z@][r]{#4}%
     }{%
-      (\sls@footwidth,#3)%
-      {%
-        \makebox[\z@][l]{#9}\hfill
-        \makebox[\z@][c]{#8}\hfill
-        \makebox[\z@][r]{#7}%
-      }{%
-        \makebox[\z@][l]{#7}\hfill
-        \makebox[\z@][c]{#8}\hfill
-        \makebox[\z@][r]{#9}%
-      }{%
-        \makebox[\z@][l]{#7}\hfill
-        \makebox[\z@][c]{#8}\hfill
-        \makebox[\z@][r]{#9}%
-      }%
-      (\sls@footwidth,#2)%
+      \makebox[\z@][l]{#4}\hfill
+      \makebox[\z@][c]{#5}\hfill
+      \makebox[\z@][r]{#6}%
+    }{%
+      \makebox[\z@][l]{#4}\hfill
+      \makebox[\z@][c]{#5}\hfill
+      \makebox[\z@][r]{#6}%
+    }%
+    (\sls@headwidth,#3)%
+  }{%
+    (\sls@footwidth,#3)%
+    {%
+      \makebox[\z@][l]{#9}\hfill
+      \makebox[\z@][c]{#8}\hfill
+      \makebox[\z@][r]{#7}%
+    }{%
+      \makebox[\z@][l]{#7}\hfill
+      \makebox[\z@][c]{#8}\hfill
+      \makebox[\z@][r]{#9}%
+    }{%
+      \makebox[\z@][l]{#7}\hfill
+      \makebox[\z@][c]{#8}\hfill
+      \makebox[\z@][r]{#9}%
     }%
+    (\sls@footwidth,#2)%
   }%
-}
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \scrlayer@@@triplestyle
 % \end{macro}%^^A \scrlayer@@triplestyle
 % \end{macro}%^^A \scrlayer@triplestyle
 %    \begin{macrocode}
-\scrlayerAddToInterface{\deftripstyle}{%
-  \newcommand*{\deftripstyle}{%
-    \PackageWarning{scrlayer-scrpage}{%
-      Command \string\deftripstyle\space is deprecate.\MessageBreak
-      You should replace it by \string\deftriplepagestyle,\MessageBreak
-      e.g.,%
-    }%
-    \let\deftripstyle\deftriplepagestyle
-    \deftripstyle
+\newcommand*{\deftripstyle}{%
+  \PackageWarning{scrlayer-scrpage}{%
+    Command \string\deftripstyle\space is deprecate.\MessageBreak
+    You should replace it by \string\deftriplepagestyle,\MessageBreak
+    e.g.,%
   }%
-}
+  \let\deftripstyle\deftriplepagestyle
+  \deftripstyle
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \deftripstyle
@@ -2176,132 +2015,105 @@
 % they depend on page style \texttt{scrheadings}.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\defpairofpagestyles{%
-  \newcommand*{\defpairofpagestyles}[3][]{%
-    \def\reserved@a##1##2##3##4##5##6##7\@nil{##1##2##3##4##5##6}%
-    \edef\reserved@a{\expandafter\reserved@a #2xxxxxx\@nil}%
-    \Ifstr\reserved@a{plain.}{%
-      \PackageError{scrlayer-scrpage}{plain page style `#2' not allowed}{%
-        You may not define a plain page style using
-        \string\defpairofpagestyles, \string\newpairofpagestyles,
-        \string\renewpairofpagestyles, or\MessageBreak
-        \string\providepairofpagestyles.  I'd suggest to simply define the
-        corresponding\MessageBreak
-        non-plain page style to also define the plain one.\MessageBreak
-        If you'll continue, your command will be ignored.}%
-    }{%
-      \sls@init@pair@page@style*{#2}%
-      \sls@init@pair@page@style*{plain.#2}%
-      \ifx\relax #1\relax\else
-        \scr@ifundefinedorrelax{sls@ps@#1@even@left@head}{%
-          \PackageError{scrlayer-scrpage}{`#1' not a pair page style}{%
-            Only pair page styles may be used to initialise new pairs of page
-            styles. So\MessageBreak
-            optional argument of \string\defpairofpagestyles,
-            \string\newpairofpagestyles,\MessageBreak
-            \string\renewpairofpagestyles, or \string\providepairofpagestyle has
-            to be a pair\MessageBreak
-            page style or should be unused.\MessageBreak
-            If you'll continue, the initialisation will be ignored.}%
+\newcommand*{\defpairofpagestyles}[3][]{%
+  \def\reserved@a##1##2##3##4##5##6##7\@nil{##1##2##3##4##5##6}%
+  \edef\reserved@a{\expandafter\reserved@a #2xxxxxx\@nil}%
+  \Ifstr\reserved@a{plain.}{%
+    \PackageError{scrlayer-scrpage}{plain page style `#2' not allowed}{%
+      You may not define a plain page style using
+      \string\defpairofpagestyles, \string\newpairofpagestyles,
+      \string\renewpairofpagestyles, or\MessageBreak
+      \string\providepairofpagestyles.  I'd suggest to simply define the
+      corresponding\MessageBreak
+      non-plain page style to also define the plain one.\MessageBreak
+      If you'll continue, your command will be ignored.}%
+  }{%
+    \sls@init@pair@page@style*{#2}%
+    \sls@init@pair@page@style*{plain.#2}%
+    \ifx\relax #1\relax\else
+      \scr@ifundefinedorrelax{sls@ps@#1@even@left@head}{%
+        \PackageError{scrlayer-scrpage}{`#1' not a pair page style}{%
+          Only pair page styles may be used to initialise new pairs of page
+          styles. So\MessageBreak
+          optional argument of \string\defpairofpagestyles,
+          \string\newpairofpagestyles,\MessageBreak
+          \string\renewpairofpagestyles, or \string\providepairofpagestyle has
+          to be a pair\MessageBreak
+          page style or should be unused.\MessageBreak
+          If you'll continue, the initialisation will be ignored.}%
+      }{%
+        \sls@init@pair@page@style{#2}{#1}%
+        \scr@ifundefinedorrelax{sls@ps@plain.#1@even@left@head}{%
+          \sls@init@pair@page@style{plain.#2}{#1}%
         }{%
-          \sls@init@pair@page@style{#2}{#1}%
-          \scr@ifundefinedorrelax{sls@ps@plain.#1@even@left@head}{%
-            \sls@init@pair@page@style{plain.#2}{#1}%
-          }{%
-            \sls@init@pair@page@style{plain.#2}{plain.#1}%
-          }%
+          \sls@init@pair@page@style{plain.#2}{plain.#1}%
         }%
-      \fi
-      \edef\reserved@a{%
-        \noexpand\scrlayerOnAutoRemoveInterface[scrlayer-scrpage.sty]{%
-          \noexpand\sls@init@pair@page@style**{#2}%
-          \noexpand\sls@init@pair@page@style**{plain.#2}%
-          \noexpand\expandafter\noexpand\ifx\noexpand
-          \csname ps@plain.#2\noexpand\endcsname\noexpand\ps@plain
-          \noexpand\PackageWarning{scrlayer-scrpage}{%
-            page style `#2' not longer valid.\noexpand\MessageBreak
-            This was the current plain page style.\noexpand\MessageBreak
-            Making current plain page style empty.\noexpand\MessageBreak
-            The page style has been defined using\noexpand\MessageBreak
-            interface `scrlayer-scrpage.sty', that\noexpand\MessageBreak
-            has been removed%
-          }%
-          \noexpand\def\noexpand\ps@plain{%
-            \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
-            \noexpand\def\noexpand\@oddhead{}\noexpand\def\noexpand\@evenhead{}%
-          }%
-          \noexpand\fi
-        }%
-      }\reserved@a
-      \sls@def@pair@page@style@member{#2}%
-      \AddToLayerPageStyleOptions{#2}{%
-        onselect={%
+      }%
+    \fi
+    \sls@def@pair@page@style@member{#2}%
+    \AddToLayerPageStyleOptions{#2}{%
+      onselect={%
 %    \end{macrocode}
 % \changes{v3.15}{2015/01/08}{usage of \cs{DeclarePageStyleAlias} instead of
 % \cs{let}}%^^A fixme: Is this correct?
 %    \begin{macrocode}
-          \DeclarePageStyleAlias{plain}{plain.#2}%
-          \DeclarePageStyleAlias{headings}{#2}%
-          \def\sls@currentheadings{#2}%
-          \def\sls@currentplain{plain.#2}%
-          #3%
-        }%
+        \DeclarePageStyleAlias{plain}{plain.#2}%
+        \DeclarePageStyleAlias{headings}{#2}%
+        \def\sls@currentheadings{#2}%
+        \def\sls@currentplain{plain.#2}%
+        #3%
       }%
-      \sls@def@pair@page@style@member{plain.#2}%
-      \AddToLayerPageStyleOptions{plain.#2}{%
-        onselect={%
+    }%
+    \sls@def@pair@page@style@member{plain.#2}%
+    \AddToLayerPageStyleOptions{plain.#2}{%
+      onselect={%
 %    \end{macrocode}
 % \changes{v3.15}{2015/01/08}{usage of \cs{DeclarePageStyleAlias} instead of
 % \cs{let}}%^^A fixme: Is this correct?
 %    \begin{macrocode}
-          \DeclarePageStyleAlias{plain}{plain.#2}%
-          \DeclarePageStyleAlias{headings}{#2}%
-          \def\sls@currentheadings{#2}%
-          \def\sls@currentplain{plain.#2}%
-          #3%
-        },%
-        oninit={%
-          \expandafter
-          \ifx\csname ifsls@plain@head@above@line\expandafter\endcsname
+        \DeclarePageStyleAlias{plain}{plain.#2}%
+        \DeclarePageStyleAlias{headings}{#2}%
+        \def\sls@currentheadings{#2}%
+        \def\sls@currentplain{plain.#2}%
+        #3%
+      },%
+      oninit={%
+        \expandafter
+        \ifx\csname ifsls@plain@head@above@line\expandafter\endcsname
+          \csname iftrue\endcsname\else
+          \let\sls@headabove@linelength\z@
+          \let\sls@headabove@linethickness\z@
+        \fi
+        \expandafter
+        \ifx\csname ifsls@plain@head@below@line\expandafter\endcsname
             \csname iftrue\endcsname\else
-            \let\sls@headabove@linelength\z@
-            \let\sls@headabove@linethickness\z@
-          \fi
-          \expandafter
-          \ifx\csname ifsls@plain@head@below@line\expandafter\endcsname
-              \csname iftrue\endcsname\else
-            \let\sls@headbelow@linelength\z@
-            \let\sls@headbelow@linethickness\z@
-          \fi
-          \expandafter
-          \ifx\csname ifsls@plain@foot@above@line\expandafter\endcsname
-              \csname iftrue\endcsname\else
-            \let\sls@footabove@linelength\z@
-            \let\sls@footabove@linethickness\z@
-          \fi
-          \expandafter
-          \ifx\csname ifsls@plain@foot@below@line\expandafter\endcsname
-              \csname iftrue\endcsname\else
-            \let\sls@footbelow@linelength\z@
-            \let\sls@footbelow@linethickness\z@
-          \fi
-        }%
+          \let\sls@headbelow@linelength\z@
+          \let\sls@headbelow@linethickness\z@
+        \fi
+        \expandafter
+        \ifx\csname ifsls@plain@foot@above@line\expandafter\endcsname
+            \csname iftrue\endcsname\else
+          \let\sls@footabove@linelength\z@
+          \let\sls@footabove@linethickness\z@
+        \fi
+        \expandafter
+        \ifx\csname ifsls@plain@foot@below@line\expandafter\endcsname
+            \csname iftrue\endcsname\else
+          \let\sls@footbelow@linelength\z@
+          \let\sls@footbelow@linethickness\z@
+        \fi
       }%
     }%
   }%
-}
+}%
 %    \end{macrocode}
 % \begin{macro}{\sls@currentheadings}
 % \begin{macro}{\sls@currentplain}
 % These little helpers will be set up at selection of each pair page style and
 % stores the last activated page style pair of the scope.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@currentheadings{%
-  \newcommand*\sls@currentheadings{scrheadings}%
-}
-\scrlayerAddToInterface\sls@currentplain{%
-  \newcommand*\sls@currentplain{plain.scrheadings}%
-}
+\newcommand*\sls@currentheadings{scrheadings}%
+\newcommand*\sls@currentplain{plain.scrheadings}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@currentplain
 % \end{macro}%^^A \sls@currentheadings
@@ -2324,47 +2136,43 @@
 % Note also, that the second argument may either be the plain or the non-plain
 % member of the page style pair.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@init@pair@page@style{%
-  \newcommand*{\sls@init@pair@page@style}{%
+\newcommand*{\sls@init@pair@page@style}{%
+  \kernel@ifstar {%
     \kernel@ifstar {%
-      \kernel@ifstar {%
-        \sls@let@pair@page@style\relax
-      }{%
-        \sls@let@pair@page@style\@empty
-      }
+      \sls@let@pair@page@style\relax
     }{%
-      \sls@init@@pair@page@style
-    }%
-  }%
-}
-\scrlayerAddToInterface\sls@init@@pair@page@style{%
-  \newcommand*{\sls@init@@pair@page@style}[2]{%
-    \expandafter\let\csname sls@ps@#1@even@left@head\expandafter\endcsname
-    \csname sls@ps@#2@even@left@head\endcsname
-    \expandafter\let\csname sls@ps@#1@even@middle@head\expandafter\endcsname
-    \csname sls@ps@#2@even@middle@head\endcsname
-    \expandafter\let\csname sls@ps@#1@even@right@head\expandafter\endcsname
-    \csname sls@ps@#2@even@right@head\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@left@head\expandafter\endcsname
-    \csname sls@ps@#2@odd@left@head\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@middle@head\expandafter\endcsname
-    \csname sls@ps@#2@odd@middle@head\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@right@head\expandafter\endcsname
-    \csname sls@ps@#2@odd@right@head\endcsname
-    \expandafter\let\csname sls@ps@#1@even@left@foot\expandafter\endcsname
-    \csname sls@ps@#2@even@left@foot\endcsname
-    \expandafter\let\csname sls@ps@#1@even@middle@foot\expandafter\endcsname
-    \csname sls@ps@#2@even@middle@foot\endcsname
-    \expandafter\let\csname sls@ps@#1@even@right@foot\expandafter\endcsname
-    \csname sls@ps@#2@even@right@foot\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@left@foot\expandafter\endcsname
-    \csname sls@ps@#2@odd@left@foot\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@middle@foot\expandafter\endcsname
-    \csname sls@ps@#2@odd@middle@foot\endcsname
-    \expandafter\let\csname sls@ps@#1@odd@right@foot\expandafter\endcsname
-    \csname sls@ps@#2@odd@right@foot\endcsname
+      \sls@let@pair@page@style\@empty
+    }
+  }{%
+    \sls@init@@pair@page@style
   }%
-}
+}%
+\newcommand*{\sls@init@@pair@page@style}[2]{%
+  \expandafter\let\csname sls@ps@#1@even@left@head\expandafter\endcsname
+  \csname sls@ps@#2@even@left@head\endcsname
+  \expandafter\let\csname sls@ps@#1@even@middle@head\expandafter\endcsname
+  \csname sls@ps@#2@even@middle@head\endcsname
+  \expandafter\let\csname sls@ps@#1@even@right@head\expandafter\endcsname
+  \csname sls@ps@#2@even@right@head\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@left@head\expandafter\endcsname
+  \csname sls@ps@#2@odd@left@head\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@middle@head\expandafter\endcsname
+  \csname sls@ps@#2@odd@middle@head\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@right@head\expandafter\endcsname
+  \csname sls@ps@#2@odd@right@head\endcsname
+  \expandafter\let\csname sls@ps@#1@even@left@foot\expandafter\endcsname
+  \csname sls@ps@#2@even@left@foot\endcsname
+  \expandafter\let\csname sls@ps@#1@even@middle@foot\expandafter\endcsname
+  \csname sls@ps@#2@even@middle@foot\endcsname
+  \expandafter\let\csname sls@ps@#1@even@right@foot\expandafter\endcsname
+  \csname sls@ps@#2@even@right@foot\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@left@foot\expandafter\endcsname
+  \csname sls@ps@#2@odd@left@foot\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@middle@foot\expandafter\endcsname
+  \csname sls@ps@#2@odd@middle@foot\endcsname
+  \expandafter\let\csname sls@ps@#1@odd@right@foot\expandafter\endcsname
+  \csname sls@ps@#2@odd@right@foot\endcsname
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@init@@pair@page@style
 % \begin{macro}{\sls@let@pair@page@style}
@@ -2377,22 +2185,20 @@
 %   \end{description}
 % A little helper for \Macro{sls@init@pair@page@style}.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@let@pair@page@style{%
-  \newcommand*{\sls@let@pair@page@style}[2]{%
-    \expandafter\let\csname sls@ps@#2@even@left@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@even@middle@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@even@right@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@left@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@middle@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@right@head\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@even@left@foot\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@even@middle@foot\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@even@right@foot\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@left@foot\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@middle@foot\endcsname #1%
-    \expandafter\let\csname sls@ps@#2@odd@right@foot\endcsname #1%
-  }%
-}
+\newcommand*{\sls@let@pair@page@style}[2]{%
+  \expandafter\let\csname sls@ps@#2@even@left@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@even@middle@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@even@right@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@left@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@middle@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@right@head\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@even@left@foot\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@even@middle@foot\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@even@right@foot\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@left@foot\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@middle@foot\endcsname #1%
+  \expandafter\let\csname sls@ps@#2@odd@right@foot\endcsname #1%
+}%
 %    \end{macrocode}
 % \end{macro}%^^A \sls@let@pair@page@style
 % \end{macro}%^^A \sls@init@pair@page@style
@@ -2409,57 +2215,55 @@
 %   \end{description}
 % A little helper for \Macro{defpairofpagestyles}.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@def@pair@page@style@member{%
-  \newcommand*{\sls@def@pair@page@style@member}[1]{%
-    \defpagestyle{#1}{%
-      {%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@even@left@head}\strut}}%
-        \parbox{\sls@headwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@even@middle@head}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@even@right@head}\strut}}%
-      }{%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
-        \parbox{\sls@headwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
-      }{%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
-        \parbox{\sls@headwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
-      }%
+\newcommand*{\sls@def@pair@page@style@member}[1]{%
+  \defpagestyle{#1}{%
+    {%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@even@left@head}\strut}}%
+      \parbox{\sls@headwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@even@middle@head}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@even@right@head}\strut}}%
     }{%
-      {%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@even@left@foot}\strut}}%
-        \parbox{\sls@footwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@even@middle@foot}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@even@right@foot}\strut}}%
-      }{%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
-        \parbox{\sls@footwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
-      }{%
-        \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
-            \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
-        \parbox{\sls@footwidth}{\LaTeXcentering
-          \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
-        \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
-            \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
-      }%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
+      \parbox{\sls@headwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
+    }{%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@headwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@odd@left@head}\strut}}%
+      \parbox{\sls@headwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@odd@middle@head}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@headwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@odd@right@head}\strut}}%
+    }%
+  }{%
+    {%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@even@left@foot}\strut}}%
+      \parbox{\sls@footwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@even@middle@foot}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@even@right@foot}\strut}}%
+    }{%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
+      \parbox{\sls@footwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
+    }{%
+      \makebox[0pt][\IfRTL{r}{l}]{\parbox{\sls@footwidth}{\LaTeXraggedright
+          \strut\@nameuse{sls@ps@#1@odd@left@foot}\strut}}%
+      \parbox{\sls@footwidth}{\LaTeXcentering
+        \strut\@nameuse{sls@ps@#1@odd@middle@foot}\strut}%
+      \makebox[0pt][\IfRTL{l}{r}]{\parbox{\sls@footwidth}{\LaTeXraggedleft
+          \strut\@nameuse{sls@ps@#1@odd@right@foot}\strut}}%
     }%
   }%
-}
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@def@pair@page@style@member
@@ -2471,83 +2275,77 @@
 % See \Macro{defpairofpagestyles} for the arguments.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\newpairofpagestyles{%
-  \newcommand*{\newpairofpagestyles}[3][]{%
-    \scr@ifundefinedorrelax{ps@#2}{%
-      \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
-        \PackageError{scrlayer-scrpage}{%
-          Plain page style of `#2' already defined}{%
-          You may only define a new pair of page styles, if neither the style
-          itself\MessageBreak
-          nor it's plain page style has already been defined.\MessageBreak
-          You may use only \string\defpairofpagestyles\space or
-          \string\providepairofpagestyles\space with partly\MessageBreak
-          already defined page styles.\MessageBreak
-          If you'll continue, your command will be ignored.%
-        }%
-      }%
-    }{%
+\newcommand*{\newpairofpagestyles}[3][]{%
+  \scr@ifundefinedorrelax{ps@#2}{%
+    \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
       \PackageError{scrlayer-scrpage}{%
-        Page style `#2' already defined}{%
+        Plain page style of `#2' already defined}{%
         You may only define a new pair of page styles, if neither the style
         itself\MessageBreak
         nor it's plain page style has already been defined.\MessageBreak
-        You may use either \string\renewpairsofpagestyles,
-        \string\defpairofpagestyles, or\MessageBreak
-        \string\providepairofpagestyles\space with already defined page
-        styles.\MessageBreak
+        You may use only \string\defpairofpagestyles\space or
+        \string\providepairofpagestyles\space with partly\MessageBreak
+        already defined page styles.\MessageBreak
         If you'll continue, your command will be ignored.%
       }%
     }%
+  }{%
+    \PackageError{scrlayer-scrpage}{%
+      Page style `#2' already defined}{%
+      You may only define a new pair of page styles, if neither the style
+      itself\MessageBreak
+      nor it's plain page style has already been defined.\MessageBreak
+      You may use either \string\renewpairsofpagestyles,
+      \string\defpairofpagestyles, or\MessageBreak
+      \string\providepairofpagestyles\space with already defined page
+      styles.\MessageBreak
+      If you'll continue, your command will be ignored.%
+    }%
   }%
-}
-\scrlayerAddToInterface\renewpairofpagestyles{%
-  \newcommand*{\renewpairofpagestyles}[3][]{%
-    \scr@ifundefinedorrelax{ps@#2}{%
+}%
+\newcommand*{\renewpairofpagestyles}[3][]{%
+  \scr@ifundefinedorrelax{ps@#2}{%
+    \PackageError{scrlayer-scrpage}{%
+      Undefined page style `#2'}{%
+      You may only redefine existing pairs of page styles. You may use
+      either\MessageBreak
+      \string\newpairsofpagestyles, \string\defpairofpagestyles, or
+      \string\providepairofpagestyles\MessageBreak
+      with not yet defined page styles.\MessageBreak
+      If you'll continue, your command will be ignored.%
+    }%
+  }{%
+    \@ifundefined{ps@plain.#2}{%
       \PackageError{scrlayer-scrpage}{%
-        Undefined page style `#2'}{%
+        Undefined plain page style of `#2'}{%
         You may only redefine existing pairs of page styles. You may use
         either\MessageBreak
-        \string\newpairsofpagestyles, \string\defpairofpagestyles, or
-        \string\providepairofpagestyles\MessageBreak
-        with not yet defined page styles.\MessageBreak
+        \string\defpairofpagestyles\space or
+        \string\providepairofpagestyles\space with partly already
+        defined\MessageBreak
+        page styles.\MessageBreak
         If you'll continue, your command will be ignored.%
       }%
-    }{%
-      \@ifundefined{ps@plain.#2}{%
-        \PackageError{scrlayer-scrpage}{%
-          Undefined plain page style of `#2'}{%
-          You may only redefine existing pairs of page styles. You may use
-          either\MessageBreak
-          \string\defpairofpagestyles\space or
-          \string\providepairofpagestyles\space with partly already
-          defined\MessageBreak
-          page styles.\MessageBreak
-          If you'll continue, your command will be ignored.%
-        }%
-      }{\defpairofpagestyles[#1]{#2}{#3}}%
-    }%
+    }{\defpairofpagestyles[#1]{#2}{#3}}%
   }%
-}
-\scrlayerAddToInterface\providepairofpagestyles{%
-  \newcommand*{\providepairofpagestyles}[3][]{%
-    \scr@ifundefinedorrelax{ps@#2}{%
-      \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
-%<*trace>
-        \PackageInfo{scrlayer-scrpage}{%
-          Plain page style of `#2' already\MessageBreak
-          defined. Definition ignored}%
-%</trace>
-      }%
-    }{%
+}%
+\newcommand*{\providepairofpagestyles}[3][]{%
+  \scr@ifundefinedorrelax{ps@#2}{%
+    \@ifundefined{ps@plain.#2}{\defpairofpagestyles[#1]{#2}{#3}}{%
 %<*trace>
       \PackageInfo{scrlayer-scrpage}{%
-        Page style of `#2' already defined.\MessageBreak
-        Definition ignored}%
+        Plain page style of `#2' already\MessageBreak
+        defined. Definition ignored}%
 %</trace>
     }%
+  }{%
+%<*trace>
+    \PackageInfo{scrlayer-scrpage}{%
+      Page style of `#2' already defined.\MessageBreak
+      Definition ignored}%
+%</trace>
   }%
-}
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \providepairofpagestyles
@@ -2567,7 +2365,6 @@
 % \texttt{scrplain}. So we make a kind of alias:
 %    \begin{macrocode}
 \DeclarePageStyleAlias{scrplain}{plain.scrheadings}
-\scrlayerOnAutoRemoveInterface{\DestroyPageStyleAlias{scrplain}}
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \ps@scrplain
@@ -2653,9 +2450,7 @@
 % member.
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\ihead{%
-  \newcommand*{\ihead}{\kernel@ifstar {\@dblarg\@@@ihead}{\@ihead}}%
-}
+\newcommand*{\ihead}{\kernel@ifstar {\@dblarg\@@@ihead}{\@ihead}}%
 %    \end{macrocode}
 % \begin{macro}{\@ihead}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2666,23 +2461,15 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@ihead{%
-  \newcommand*{\@ihead}{\kernel@ifnextchar[{\@@@ihead}{\@@ihead}}%
-}
-\scrlayerAddToInterface\@@ihead{%
-  \newcommand{\@@ihead}[1]{\rehead{#1}\lohead{#1}}%
-}
-\scrlayerAddToInterface\@@@ihead{%
-  \newcommand{\@@@ihead}[2][]{\rehead[{#1}]{#2}\lohead[{#1}]{#2}}%
-}
+\newcommand*{\@ihead}{\kernel@ifnextchar[{\@@@ihead}{\@@ihead}}%
+\newcommand{\@@ihead}[1]{\rehead{#1}\lohead{#1}}%
+\newcommand{\@@@ihead}[2][]{\rehead[{#1}]{#2}\lohead[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@ihead
 % \end{macro}%^^A \@@ihead
 % \end{macro}%^^A \@ihead
 %    \begin{macrocode}
-\scrlayerAddToInterface\ohead{%
-  \newcommand*{\ohead}{\kernel@ifstar {\@dblarg\@@@ohead}{\@ohead}}%
-}
+\newcommand*{\ohead}{\kernel@ifstar {\@dblarg\@@@ohead}{\@ohead}}%
 %    \end{macrocode}
 % \begin{macro}{\@ohead}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2693,23 +2480,15 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@ohead{%
-  \newcommand*{\@ohead}{\kernel@ifnextchar[{\@@@ohead}{\@@ohead}}%
-}
-\scrlayerAddToInterface\@@ohead{%
-  \newcommand{\@@ohead}[1]{\lehead{#1}\rohead{#1}}%
-}
-\scrlayerAddToInterface\@@@ohead{%
-  \newcommand{\@@@ohead}[2][]{\lehead[{#1}]{#2}\rohead[{#1}]{#2}}%
-}
+\newcommand*{\@ohead}{\kernel@ifnextchar[{\@@@ohead}{\@@ohead}}%
+\newcommand{\@@ohead}[1]{\lehead{#1}\rohead{#1}}%
+\newcommand{\@@@ohead}[2][]{\lehead[{#1}]{#2}\rohead[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@ohead
 % \end{macro}%^^A \@@ohead
 % \end{macro}%^^A \@ohead
 %    \begin{macrocode}
-\scrlayerAddToInterface\chead{%
-  \newcommand*{\chead}{\kernel@ifstar {\@dblarg\@@@chead}{\@chead}}%
-}
+\newcommand*{\chead}{\kernel@ifstar {\@dblarg\@@@chead}{\@chead}}%
 %    \end{macrocode}
 % \begin{macro}{\@chead}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2720,43 +2499,23 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@chead{%
-  \newcommand*{\@chead}{\kernel@ifnextchar[{\@@@chead}{\@@chead}}%
-}
-\scrlayerAddToInterface\@@chead{%
-  \newcommand{\@@chead}[1]{\cehead{#1}\cohead{#1}}%
-}
-\scrlayerAddToInterface\@@@chead{%
-  \newcommand{\@@@chead}[2][]{\cehead[{#1}]{#2}\cohead[{#1}]{#2}}%
-}
+\newcommand*{\@chead}{\kernel@ifnextchar[{\@@@chead}{\@@chead}}%
+\newcommand{\@@chead}[1]{\cehead{#1}\cohead{#1}}%
+\newcommand{\@@@chead}[2][]{\cehead[{#1}]{#2}\cohead[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@chead
 % \end{macro}%^^A \@@chead
 % \end{macro}%^^A \@chead
 %    \begin{macrocode}
-\scrlayerAddToInterface\lehead{%
-  \newcommand*{\lehead}{\sls@renewelement{even}{left}{head}}%
-}
-\scrlayerAddToInterface\lohead{%
-  \newcommand*{\lohead}{\sls@renewelement{odd}{left}{head}}%
-}
-\scrlayerAddToInterface\rehead{%
-  \newcommand*{\rehead}{\sls@renewelement{even}{right}{head}}%
-}
-\scrlayerAddToInterface\rohead{%
-  \newcommand*{\rohead}{\sls@renewelement{odd}{right}{head}}%
-}
-\scrlayerAddToInterface\cehead{%
-  \newcommand*{\cehead}{\sls@renewelement{even}{middle}{head}}%
-}
-\scrlayerAddToInterface\cohead{%
-  \newcommand*{\cohead}{\sls@renewelement{odd}{middle}{head}}%
-}
+\newcommand*{\lehead}{\sls@renewelement{even}{left}{head}}%
+\newcommand*{\lohead}{\sls@renewelement{odd}{left}{head}}%
+\newcommand*{\rehead}{\sls@renewelement{even}{right}{head}}%
+\newcommand*{\rohead}{\sls@renewelement{odd}{right}{head}}%
+\newcommand*{\cehead}{\sls@renewelement{even}{middle}{head}}%
+\newcommand*{\cohead}{\sls@renewelement{odd}{middle}{head}}%
 %    \end{macrocode}
 %    \begin{macrocode}
-\scrlayerAddToInterface\ifoot{%
-  \newcommand*{\ifoot}{\kernel@ifstar {\@dblarg\@@@ifoot}{\@ifoot}}%
-}
+\newcommand*{\ifoot}{\kernel@ifstar {\@dblarg\@@@ifoot}{\@ifoot}}%
 %    \end{macrocode}
 % \begin{macro}{\@ifoot}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2767,23 +2526,15 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@ifoot{%
-  \newcommand*{\@ifoot}{\kernel@ifnextchar[{\@@@ifoot}{\@@ifoot}}%
-}
-\scrlayerAddToInterface\@@ifoot{%
-  \newcommand{\@@ifoot}[1]{\refoot{#1}\lofoot{#1}}%
-}
-\scrlayerAddToInterface\@@@ifoot{%
-  \newcommand{\@@@ifoot}[2][]{\refoot[{#1}]{#2}\lofoot[{#1}]{#2}}%
-}
+\newcommand*{\@ifoot}{\kernel@ifnextchar[{\@@@ifoot}{\@@ifoot}}%
+\newcommand{\@@ifoot}[1]{\refoot{#1}\lofoot{#1}}%
+\newcommand{\@@@ifoot}[2][]{\refoot[{#1}]{#2}\lofoot[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@ifoot
 % \end{macro}%^^A \@@ifoot
 % \end{macro}%^^A \@ifoot
 %    \begin{macrocode}
-\scrlayerAddToInterface\ofoot{%
-  \newcommand*{\ofoot}{\kernel@ifstar {\@dblarg\@@@ofoot}{\@ofoot}}%
-}
+\newcommand*{\ofoot}{\kernel@ifstar {\@dblarg\@@@ofoot}{\@ofoot}}%
 %    \end{macrocode}
 % \begin{macro}{\@ofoot}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2794,23 +2545,15 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@ofoot{%
-  \newcommand*{\@ofoot}{\kernel@ifnextchar[{\@@@ofoot}{\@@ofoot}}%
-}
-\scrlayerAddToInterface\@@ofoot{%
-  \newcommand{\@@ofoot}[1]{\lefoot{#1}\rofoot{#1}}%
-}
-\scrlayerAddToInterface\@@@ofoot{%
-  \newcommand{\@@@ofoot}[2][]{\lefoot[{#1}]{#2}\rofoot[{#1}]{#2}}%
-}
+\newcommand*{\@ofoot}{\kernel@ifnextchar[{\@@@ofoot}{\@@ofoot}}%
+\newcommand{\@@ofoot}[1]{\lefoot{#1}\rofoot{#1}}%
+\newcommand{\@@@ofoot}[2][]{\lefoot[{#1}]{#2}\rofoot[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@ofoot
 % \end{macro}%^^A \@@ofoot
 % \end{macro}%^^A \@ofoot
 %    \begin{macrocode}
-\scrlayerAddToInterface\cfoot{%
-  \newcommand*{\cfoot}{\kernel@ifstar {\@dblarg\@@@cfoot}{\@cfoot}}%
-}
+\newcommand*{\cfoot}{\kernel@ifstar {\@dblarg\@@@cfoot}{\@cfoot}}%
 %    \end{macrocode}
 % \begin{macro}{\@cfoot}
 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
@@ -2821,38 +2564,20 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Two helpers for the previous one to double the command and it's arguments.
 %    \begin{macrocode}
-\scrlayerAddToInterface\@cfoot{%
-  \newcommand*{\@cfoot}{\kernel@ifnextchar[{\@@@cfoot}{\@@cfoot}}%
-}
-\scrlayerAddToInterface\@@cfoot{%
-  \newcommand{\@@cfoot}[1]{\cefoot{#1}\cofoot{#1}}%
-}
-\scrlayerAddToInterface\@@@cfoot{%
-  \newcommand{\@@@cfoot}[2][]{\cefoot[{#1}]{#2}\cofoot[{#1}]{#2}}%
-}
+\newcommand*{\@cfoot}{\kernel@ifnextchar[{\@@@cfoot}{\@@cfoot}}%
+\newcommand{\@@cfoot}[1]{\cefoot{#1}\cofoot{#1}}%
+\newcommand{\@@@cfoot}[2][]{\cefoot[{#1}]{#2}\cofoot[{#1}]{#2}}%
 %    \end{macrocode}
 % \end{macro}%^^A \@@@cfoot
 % \end{macro}%^^A \@@cfoot
 % \end{macro}%^^A \@cfoot
 %    \begin{macrocode}
-\scrlayerAddToInterface\lefoot{%
-  \newcommand*{\lefoot}{\sls@renewelement{even}{left}{foot}}%
-}
-\scrlayerAddToInterface\lofoot{%
-  \newcommand*{\lofoot}{\sls@renewelement{odd}{left}{foot}}%
-}
-\scrlayerAddToInterface\refoot{%
-  \newcommand*{\refoot}{\sls@renewelement{even}{right}{foot}}%
-}
-\scrlayerAddToInterface\rofoot{%
-  \newcommand*{\rofoot}{\sls@renewelement{odd}{right}{foot}}%
-}
-\scrlayerAddToInterface\cefoot{%
-  \newcommand*{\cefoot}{\sls@renewelement{even}{middle}{foot}}%
-}
-\scrlayerAddToInterface\cofoot{%
-  \newcommand*{\cofoot}{\sls@renewelement{odd}{middle}{foot}}%
-}
+\newcommand*{\lefoot}{\sls@renewelement{even}{left}{foot}}%
+\newcommand*{\lofoot}{\sls@renewelement{odd}{left}{foot}}%
+\newcommand*{\refoot}{\sls@renewelement{even}{right}{foot}}%
+\newcommand*{\rofoot}{\sls@renewelement{odd}{right}{foot}}%
+\newcommand*{\cefoot}{\sls@renewelement{even}{middle}{foot}}%
+\newcommand*{\cofoot}{\sls@renewelement{odd}{middle}{foot}}%
 %    \end{macrocode}
 % \begin{macro}{\sls@renewelement}
 % \begin{macro}{\sls@@renewelement}
@@ -2868,43 +2593,34 @@
 % \changes{v3.27}{2019/04/05}{made long}%^^A
 % Little helper for several of the above commands.
 %    \begin{macrocode}
-\scrlayerAddToInterface\sls@renewelement{%
-  \newcommand*{\sls@renewelement}[3]{%
-    \kernel@ifstar{\@dblarg{\sls@@@@renewelement{#1}{#2}{#3}}}%
-                  {\sls@@renewelement{#1}{#2}{#3}}%
-  }%
-}
-\scrlayerAddToInterface\sls@@renewelement{%
-  \newcommand*{\sls@@renewelement}[3]{%
-    \kernel@ifnextchar[%]
-    {\sls@@@@renewelement{#1}{#2}{#3}}%
-    {\sls@@@renewelement{#1}{#2}{#3}}%
-  }%
-}
-\scrlayerAddToInterface\sls@@@renewelement{%
-  \newcommand{\sls@@@renewelement}[4]{%
-    \scr@ifundefinedorrelax{sls@ps@\sls@currentheadings @#1@#2@#3}{%
-      \@namedef{sls@ps@scrheadings@#1@#2@#3}{#4}%
-    }{%
-      \@namedef{sls@ps@\sls@currentheadings @#1@#2@#3}{#4}%
-    }%
-  }%
-}
-\scrlayerAddToInterface\sls@@@@renewelement{%
-  \long\def\sls@@@@renewelement#1#2#3[#4]#5{%
-    \sls@@renewplainelement{#1}{#2}{#3}{#4}%
-    \sls@@@renewelement{#1}{#2}{#3}{#5}%
+\newcommand*{\sls@renewelement}[3]{%
+  \kernel@ifstar{\@dblarg{\sls@@@@renewelement{#1}{#2}{#3}}}%
+                {\sls@@renewelement{#1}{#2}{#3}}%
+}%
+\newcommand*{\sls@@renewelement}[3]{%
+  \kernel@ifnextchar[%]
+  {\sls@@@@renewelement{#1}{#2}{#3}}%
+  {\sls@@@renewelement{#1}{#2}{#3}}%
+}%
+\newcommand{\sls@@@renewelement}[4]{%
+  \scr@ifundefinedorrelax{sls@ps@\sls@currentheadings @#1@#2@#3}{%
+    \@namedef{sls@ps@scrheadings@#1@#2@#3}{#4}%
+  }{%
+    \@namedef{sls@ps@\sls@currentheadings @#1@#2@#3}{#4}%
   }%
-}
-\scrlayerAddToInterface\sls@@renewplainelement{%
-  \newcommand{\sls@@renewplainelement}[4]{%
-    \scr@ifundefinedorrelax{sls@ps@\sls@currentplain @#1@#2@#3}{%
-      \@namedef{sls@ps@plain.scrheadings@#1@#2@#3}{#4}%
-    }{%
-      \@namedef{sls@ps@\sls@currentplain @#1@#2@#3}{#4}%
-    }%
+}%
+\newcommand*{\sls@@@@renewelement}{}
+\long\def\sls@@@@renewelement#1#2#3[#4]#5{%
+  \sls@@renewplainelement{#1}{#2}{#3}{#4}%
+  \sls@@@renewelement{#1}{#2}{#3}{#5}%
+}%
+\newcommand{\sls@@renewplainelement}[4]{%
+  \scr@ifundefinedorrelax{sls@ps@\sls@currentplain @#1@#2@#3}{%
+    \@namedef{sls@ps@plain.scrheadings@#1@#2@#3}{#4}%
+  }{%
+    \@namedef{sls@ps@\sls@currentplain @#1@#2@#3}{#4}%
   }%
-}
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \sls@@renewplainelement
@@ -2933,18 +2649,21 @@
 %
 % \begin{macro}{\clearmainofpairofpagestyles}
 % \begin{macro}{\clearscrheadings}
+% \changes{v3.32}{2020/09/11}{deprecation warning added}
 % Maybe you want to clear the currently defined head and foot. First
 % let's clear only scrheadings pagestyle but not scrplain pagestyle.
 % We do this simply using the already known command:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\clearmainofpairofpagestyles{%
-  \newcommand*{\clearmainofpairofpagestyles}{%
-    \ihead{}\chead{}\ohead{}\ifoot{}\cfoot{}\ofoot{}%
+\newcommand*{\clearmainofpairofpagestyles}{%
+  \ihead{}\chead{}\ohead{}\ifoot{}\cfoot{}\ofoot{}%
+}%
+\newcommand*{\clearscrheadings}{%
+  \PackageWarning{scrlayer-scrpage}{%
+    replacing deprecated \string\clearscrheading\space by\MessageBreak
+    \string\clearmainofpairofpagestyles
   }%
-}
-\scrlayerAddToInterface\clearscrheadings{%
-  \let\clearscrheadings\clearmainofpairofpagestyles
+  \clearmainofpairofpagestyles
 }
 %</body>
 %    \end{macrocode}
@@ -2952,27 +2671,30 @@
 % \end{macro}%^^A \clearmainofpairofpagestyles
 % \begin{macro}{\clearplainofpairofpagestyles}
 % \begin{macro}{\clearscrplain}
+% \changes{v3.32}{2020/09/11}{deprecation warning added}
 % Now, we use the not recommended feature to set up a plain style:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\clearplainofpairofpagestyles{%
-  \newcommand*{\clearplainofpairofpagestyles}{%
-    \sls@@renewplainelement{odd}{left}{head}{}%
-    \sls@@renewplainelement{odd}{right}{head}{}%
-    \sls@@renewplainelement{odd}{middle}{head}{}%
-    \sls@@renewplainelement{even}{left}{head}{}%
-    \sls@@renewplainelement{even}{right}{head}{}%
-    \sls@@renewplainelement{even}{middle}{head}{}%
-    \sls@@renewplainelement{odd}{left}{foot}{}%
-    \sls@@renewplainelement{odd}{right}{foot}{}%
-    \sls@@renewplainelement{odd}{middle}{foot}{}%
-    \sls@@renewplainelement{even}{left}{foot}{}%
-    \sls@@renewplainelement{even}{right}{foot}{}%
-    \sls@@renewplainelement{even}{middle}{foot}{}%
+\newcommand*{\clearplainofpairofpagestyles}{%
+  \sls@@renewplainelement{odd}{left}{head}{}%
+  \sls@@renewplainelement{odd}{right}{head}{}%
+  \sls@@renewplainelement{odd}{middle}{head}{}%
+  \sls@@renewplainelement{even}{left}{head}{}%
+  \sls@@renewplainelement{even}{right}{head}{}%
+  \sls@@renewplainelement{even}{middle}{head}{}%
+  \sls@@renewplainelement{odd}{left}{foot}{}%
+  \sls@@renewplainelement{odd}{right}{foot}{}%
+  \sls@@renewplainelement{odd}{middle}{foot}{}%
+  \sls@@renewplainelement{even}{left}{foot}{}%
+  \sls@@renewplainelement{even}{right}{foot}{}%
+  \sls@@renewplainelement{even}{middle}{foot}{}%
+}%
+\newcommand*{\clearscrplain}{%
+  \PackageWarning{scrlayer-scrpage}{%
+    replacing deprecated \string\clearscrplain\space by\MessageBreak
+    \string\clearplainofpairofpagestyles
   }%
-}
-\scrlayerAddToInterface\clearscrplain{%
-  \let\clearscrplain\clearplainofpairofpagestyles
+  \clearplainofpairofpagestyles
 }
 %</body>
 %    \end{macrocode}
@@ -2980,16 +2702,19 @@
 % \end{macro}%^^A \clearplainofpairofpagestyles
 % \begin{macro}{\clearpairofpagestyles}
 % \begin{macro}{\clearscrheadfoot}
+% \changes{v3.32}{2020/09/11}{deprecation warning added}
 % Last but not least we clean up both, the main and the plain:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\clearpairofpagestyles{%
-  \newcommand*{\clearpairofpagestyles}{%
-    \ihead[]{}\chead[]{}\ohead[]{}\ifoot[]{}\cfoot[]{}\ofoot[]{}%
+\newcommand*{\clearpairofpagestyles}{%
+  \ihead[]{}\chead[]{}\ohead[]{}\ifoot[]{}\cfoot[]{}\ofoot[]{}%
+}%
+\newcommand*{\clearscrheadfoot}{%
+  \PackageWarning{scrlayer-scrpage}{%
+    replacing deprecated \string\clearscrheadfoot\space by\MessageBreak
+    \string\clearpairofpagestyles
   }%
-}
-\scrlayerAddToInterface\clearscrheadfoot{%
-  \let\clearscrheadfoot\clearpairofpagestyles
+  \clearpairofpagestyles
 }
 %</body>
 %    \end{macrocode}
@@ -3000,24 +2725,22 @@
 % Not longer supported:
 %    \begin{macrocode}
 %<*body>
-\scrlayerAddToInterface\ps@useheadings{%
-  \newcommand*\ps@useheadings{%
-    \PackageWarning{scrlayer-scrpage}{incompatible page style!\MessageBreak
-      Page styles like `headings' and `plain'\MessageBreak
-      are incompatible with the page styles\MessageBreak
-      of scrlayer-scrpage. You shouldn't mix\MessageBreak
-      them up. Therefore page style\MessageBreak
-      `useheadings' is not longer provided.\MessageBreak
-      Usage is deprecated and will be replaced\MessageBreak
-      by `scrheadings'%
-    }%
-    \let\ps@useheadings\ps@scrheadings
-    \ps@useheadings
+\newcommand*\ps@useheadings{%
+  \PackageWarning{scrlayer-scrpage}{incompatible page style!\MessageBreak
+    Page styles like `headings' and `plain'\MessageBreak
+    are incompatible with the page styles\MessageBreak
+    of scrlayer-scrpage. You shouldn't mix\MessageBreak
+    them up. Therefore page style\MessageBreak
+    `useheadings' is not longer provided.\MessageBreak
+    Usage is deprecated and will be replaced\MessageBreak
+    by `scrheadings'%
   }%
-}
-\scrlayerAddCsToInterface{ps@plain.useheadings}{%
-  \@namedef{ps@plain.useheadings}{\@nameuse{ps@plain.scrheadings}}%
-}
+  \let\ps@useheadings\ps@scrheadings
+  \ps@useheadings
+}%
+\expandafter\newcommand\expandafter*\csname ps@plain.useheadings\endcsname{%
+  \@nameuse{ps@plain.scrheadings}%
+}%
 %</body>
 %    \end{macrocode}
 % \end{macro}%^^A \ps@useheadings
-- 
cgit v1.2.3

