1

I have a problem during the re-creation of a Word template concerning scrlayer-scrpage and possibly the geometry package inside a KOMA-script document class.

My template has a constant header in the whole document and a footer, but only on the first page. Usually, this is no problem. However, in the original template, the space occupied by the footer on the first page is added to the text area on the following pages. So I need something like includefoot=true inside the geometry definition of the first page and includefoot=false on all following pages.

I hope the following pictures explain what I want to achieve. The current state: on the left, the first page has the footer. On the right, the second page has all the white space where the empty footer is.

enter image description here enter image description here

I want to add the footer space for every page from page 2 to the end as shown on the right:

enter image description here enter image description here

Unfortunately, I only achieve the desired result for page 2 and forward for includefoot=false which messes up the footer on the first page. I tried to use newgeometry after my title section, but as explained in this thread this works on full pages and my first section is moved to the second page. I do not want that.

Is there a possibility to switch geometry definitions without jumping to a new page or anything else that solves my problem?


MWE

\documentclass[listof=totoc,bibliography=totoc,parskip=half-,11pt]{scrartcl}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ---------------------------
% Packages
% ---------------------------

\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{coffee4}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage[autooneside]{scrlayer-scrpage}

% Page geometry
\geometry{
  left=25mm,
  right=20mm,
  top=25mm,
  bottom=12mm,
  includefoot=true,
  headsep = \dimexpr2\baselineskip\relax,
  footskip = \dimexpr1\baselineskip+1.5mm\relax,
}

% ---------------------------
% Template adjustments
% ---------------------------

% Title
\makeatletter
\def\@maketitle{%
  \newpage
  % Zweck
  \begingroup%
    \normalsize%
    \bfseries%
    Test
    \par
  \endgroup%
  % Abstand
  \vskip 2\baselineskip
  % Authors
  \begingroup%
    \normalsize%
    \bfseries%
    \begin{tabularx}{\linewidth}{@{}X}%
      \@author
    \end{tabularx}
    \par
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  % Title
  \begingroup%
    \normalsize
    \bfseries
    \@title%
    \par%
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  \rule{\textwidth}{0.4pt}%
  %\vskip 1.5em%
  \vskip 1\baselineskip
  % Beschreibung des Vorhabens
  \begingroup%
    \normalsize
    \bfseries
    Schalala
    \par%
  \endgroup%
  \vskip 2\baselineskip
}
\makeatother

% Font sizes
\setkomafont{section}{\normalsize\bfseries}
\setkomafont{subsection}{\normalsize\bfseries}
\setkomafont{subsubsection}{\normalsize\bfseries}
\setkomafont{paragraph}{\normalsize\bfseries}
\setkomafont{subparagraph}{\normalsize\bfseries}

% ---------------------------
% Header/Footer commands
% ---------------------------

% Clear old  headers/footers
\clearpairofpagestyles

% Fonts for headers/footers
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagehead}{\sffamily}
\setkomafont{pagination}{}

% Trennlinien fuer Kopf und Fuss
\KOMAoptions{
  headsepline = false,
  footsepline = false,
  plainfootsepline = false,
}

% Create new header for title page
\newpairofpagestyles{firstpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{
    \begin{tabular}[t]{@{}l}
    \textbf{An organization}\\
    With an address\\
    and communication channels
    \end{tabular}
  }
  \cfoot{Footer on 1\textsuperscript{st} page only}
  \ofoot{\fontsize{37}{44}\selectfont XYZ}
}
% Page Layout for normal pages
\newpairofpagestyles{normalpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{}
  \ofoot{}
}

% Abstaende
\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{section}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsubsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{paragraph}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subparagraph}

% 
\setlength{\parskip}{0cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title and author                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Title}
\author{Author}
\date{\today}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\maketitle
\thispagestyle{firstpage}
\pagestyle{normalpage}

\section{First section}

\subsection{Subsection 1}

\Blindtext[2]

\subsection{Subsection 2}

\Blindtext[6]

\section{Second section}

\cofeAm{1}{0.85}{0}{0.25\textwidth}{-0.25\textheight} % needs \usepackage{coffee4}
\Blindtext[9]
\cofeDm{0.5}{0.2}{0}{-0.35\textwidth}{-0.4\textheight} % needs \usepackage{coffee4}

\end{document}

Update

using the approach proposed by @UlrikeFischer:

\documentclass[listof=totoc,bibliography=totoc,parskip=half-,11pt]{scrartcl}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ---------------------------
% Packages
% ---------------------------

\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{coffee4}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage[autooneside]{scrlayer-scrpage}

% Page geometry
\geometry{
  left=25mm,
  right=20mm,
  top=25mm,
  %bottom=20mm,
  %includefoot=true,
  bottom=12mm,
  includefoot=false,
  headsep = \dimexpr2\baselineskip\relax,
  footskip = \dimexpr1\baselineskip+1.5mm\relax,
}

% ---------------------------
% Template adjustments
% ---------------------------

% Title
\makeatletter
\def\@maketitle{%
  \newpage
  % Zweck
  \begingroup%
    \normalsize%
    \bfseries%
    Test
    \par
  \endgroup%
  % Abstand
  \vskip 2\baselineskip
  % Authors
  \begingroup%
    \normalsize%
    \bfseries%
    \begin{tabularx}{\linewidth}{@{}X}%
      \@author
    \end{tabularx}
    \par
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  % Title
  \begingroup%
    \normalsize
    \bfseries
    \@title%
    \par%
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  \rule{\textwidth}{0.4pt}%
  %\vskip 1.5em%
  \vskip 1\baselineskip
  % Beschreibung des Vorhabens
  \begingroup%
    \normalsize
    \bfseries
    Schalala
    \par%
  \endgroup%
  \vskip 2\baselineskip
}
\makeatother

% Font sizes
\setkomafont{section}{\normalsize\bfseries}
\setkomafont{subsection}{\normalsize\bfseries}
\setkomafont{subsubsection}{\normalsize\bfseries}
\setkomafont{paragraph}{\normalsize\bfseries}
\setkomafont{subparagraph}{\normalsize\bfseries}

% ---------------------------
% Header/Footer commands
% ---------------------------

% Clear old  headers/footers
\clearpairofpagestyles

% Fonts for headers/footers
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagehead}{\sffamily}
\setkomafont{pagination}{}

% Trennlinien fuer Kopf und Fuss
\KOMAoptions{
  headsepline = false,
  footsepline = false,
  plainfootsepline = false,
}

% Create new header for title page
\newpairofpagestyles{firstpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{
    \raisebox{1cm}[0pt][0pt]{%
      \begin{tabular}[t]{@{}l}
      \textbf{An organization}\\
      With an address\\
      and communication channels
      \end{tabular}
    }
  }
  \cfoot{
    \raisebox{1cm}[0pt][0pt]{%
      Footer on 1\textsuperscript{st} page only
    }
  }
  \ofoot{
    \raisebox{1cm}[0pt][0pt]{%
      {\fontsize{37}{44}\selectfont XYZ}
      %\normalsize
    }
  }
}
% Page Layout for normal pages
\newpairofpagestyles{normalpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{}
  \ofoot{}
}

% Abstaende
\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{section}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsubsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{paragraph}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subparagraph}

% 
\setlength{\parskip}{0cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title and author                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Title}
\author{Author}
\date{\today}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\maketitle
\enlargethispage{-1cm}
\thispagestyle{firstpage}
\pagestyle{normalpage}

\section{First section}

\subsection{Subsection 1}

\Blindtext[2]

\subsection{Subsection 2}

\Blindtext[6]

\section{Second section}

\Blindtext[9]

\end{document}

enter image description here

What happens with the \ofoot?

  • 1
    Use \enlargethispage{-1cm} (or whatever) on the first page and let the footer stick into the textbody. – Ulrike Fischer Aug 15 '17 at 12:26
  • Thanks @UlrikeFischer. But if I use \enlargethispage{-1cm} and includefoot=false my footer on the first page is still stuck at the very bottom of the page which does not look nice. Additionally, I would later like to use this as a template without much user influence. – raedma Aug 15 '17 at 12:38
  • 1
    It is easy to move content around, e.g. with \raisebox{1cm}[0pt][0pt]{TEXT OF THE FOOTER}. I don't understand your remark about the user. Why should he/she care if you use \enlargethispage or \newgeometry or something else to change the layout of the first page? – Ulrike Fischer Aug 15 '17 at 12:44
  • I already tried using a raisebox but the behaviour is kind of weird for the ofoot. Please see my update in the question. – raedma Aug 15 '17 at 12:58
  • Spaces matters in tex. So add % after opening braces. Beside this you are getting exactly what you are asking for. Every three part have their baseline aligned. If you don't want the XXX to move up, well then don't move it up ... – Ulrike Fischer Aug 15 '17 at 13:09
1

Based on your update you simple need to change your command \raisebox{1cm}[0pt][0pt] in command \ofoot to for example \raisebox{0cm}[0pt][0pt]. Please see that I changed the first parameter 1cm to 0cm.

With the complete MWE

\documentclass[%
  listof=totoc,
  bibliography=totoc,
  parskip=half-,
  11pt
]{scrartcl}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Preamble                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% ---------------------------
% Packages
% ---------------------------

\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}
%\usepackage{coffee4}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage[autooneside]{scrlayer-scrpage}

% Page geometry
\geometry{
  left=25mm,
  right=20mm,
  top=25mm,
  bottom=12mm,
  includefoot=false,
  headsep = \dimexpr2\baselineskip\relax,
  footskip = \dimexpr1\baselineskip+1.5mm\relax,
}

% ---------------------------
% Template adjustments
% ---------------------------

% Title
\makeatletter
\def\@maketitle{%
  \newpage
  % Zweck
  \begingroup%
    \normalsize%
    \bfseries%
    Test
    \par
  \endgroup%
  % Abstand
  \vskip 2\baselineskip
  % Authors
  \begingroup%
    \normalsize%
    \bfseries%
    \begin{tabularx}{\linewidth}{@{}X}%
      \@author
    \end{tabularx}
    \par
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  % Title
  \begingroup%
    \normalsize
    \bfseries
    \@title%
    \par%
  \endgroup%
  % Abstand
  \vskip 1\baselineskip
  \rule{\textwidth}{0.4pt}%
  %\vskip 1.5em%
  \vskip 1\baselineskip
  % Beschreibung des Vorhabens
  \begingroup%
    \normalsize
    \bfseries
    Schalala
    \par%
  \endgroup%
  \vskip 2\baselineskip
}
\makeatother

% Font sizes
\setkomafont{section}{\normalsize\bfseries}
\setkomafont{subsection}{\normalsize\bfseries}
\setkomafont{subsubsection}{\normalsize\bfseries}
\setkomafont{paragraph}{\normalsize\bfseries}
\setkomafont{subparagraph}{\normalsize\bfseries}

% ---------------------------
% Header/Footer commands
% ---------------------------

% Clear old  headers/footers
\clearpairofpagestyles

% Fonts for headers/footers
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagehead}{\sffamily}
\setkomafont{pagination}{}

% Trennlinien fuer Kopf und Fuss
\KOMAoptions{
  headsepline = false,
  footsepline = false,
  plainfootsepline = false,
}

% Create new header for title page
\newpairofpagestyles{firstpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{
    \raisebox{1cm}[0pt][0pt]{%
      \begin{tabular}[t]{@{}l}
      \textbf{An organization}\\
      With an address\\
      and communication channels
      \end{tabular}
    }
  }
  \cfoot{
    \raisebox{1cm}[0pt][0pt]{%
      Footer on 1\textsuperscript{st} page only
    }
  }
  \ofoot{
    \raisebox{0cm}[0pt][0pt]{%  <=======================================
      {\fontsize{37}{44}\selectfont XYZ}
      %\normalsize
    }
  }
}
% Page Layout for normal pages
\newpairofpagestyles{normalpage}{%
  \ihead{Inner head}
  \ohead{Outer head}
  \ifoot{}
  \ofoot{}
}

% Abstaende
\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{section}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subsubsection}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{paragraph}

\RedeclareSectionCommand[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip
]{subparagraph}

% 
\setlength{\parskip}{0cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title and author                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{Title}
\author{Author}
\date{\today}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\maketitle
\enlargethispage{-1cm}
\thispagestyle{firstpage}
\pagestyle{normalpage}

\section{First section}

\subsection{Subsection 1}

\Blindtext[2]

\subsection{Subsection 2}

\Blindtext[6]

\section{Second section}

\Blindtext[9]

\end{document}

you will get the wished result:

enter image description here

  • I ended up using \raisebox{0.25cm}[0pt][0pt] as the XYZ is a little too low in my opinion for 0cm. – raedma Aug 16 '17 at 8:33
2

Here is another suggestion defining a new layer for the footer on the first page:

\documentclass[listof=totoc,bibliography=totoc,11pt]{scrartcl}
\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}% only for dummy text
\usepackage{showframe}% to show the page layout
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\usepackage{xpatch}% to patch \maketitle (page style and shorten the page)

\geometry{
  left=25mm,
  right=20mm,
  top=25mm,
  bottom=12mm,
  includefoot=false,
  headsep = 2\baselineskip,
  footskip = \dimexpr1\baselineskip+1.5mm\relax,
}

\clearpairofpagestyles
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagination}{}

\ihead{Inner head}
\ohead{Outer head}

% declare a new layer for the footer on the first page
\DeclareNewLayer[
  foreground,
  textarea,
  contents={\vfill
    \raisebox{\dimexpr\depth-\dp\strutbox\relax}{%
        \makebox[0pt][l]{%
          \begin{tabular}[t]{@{}l}
            \textbf{An organization}\\
            With an address\\
            and communication channels
          \end{tabular}%
        }%
        \makebox[\linewidth][c]{%
          Footer on 1\textsuperscript{st} page only%
        }%
    }%
    \makebox[0pt][r]{%
      {\fontsize{37}{44}\selectfont XYZ}%
    }%
  }
]{firstpage.foot}

% declare a new page style using layer firstpage.foot
\DeclarePageStyleByLayers{firstpage}{firstpage.foot}
% add the head layers from scrheadings to page style firstpage
\ForEachLayerOfPageStyle{scrheadings}{%
  \ifstrstart{#1}{scrheadings.head.}{\AddLayersToPageStyle{firstpage}{#1}}{}%
}

\RedeclareSectionCommands[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip,
  font=\normalsize
]{section,subsection,subsubsection,paragraph,subparagraph}

\xapptocmd{\maketitle}{\enlargethispage{-5\baselineskip}\thispagestyle{firstpage}}
  {}{\PatchFailed}

\title{Title}
\author{Author}
\begin{document}
\maketitle
\section{First section}
\subsection{Subsection 1}
\Blindtext[2]
\subsection{Subsection 2}
\Blindtext[6]
\section{Second section}
\Blindtext[12]
\end{document}

Note that for the "normal" pages the default page style scrheadings is used and that I have removed the unrelated stuff.

Result with package showframe:

enter image description here

Result without package showframe:

enter image description here

It is also possible to add a sep line above the footer on the first page using an additional layer:

enter image description here

Code:

\documentclass[listof=totoc,bibliography=totoc,11pt]{scrartcl}
\usepackage{anyfontsize}
\usepackage[english]{babel}
\usepackage{blindtext}% only for dummy text
%\usepackage{showframe}% to show the page layout
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{scrlayer-scrpage}% sets pagestyle scrheadings automatically
\usepackage{xpatch}% to patch \maketitle (page style and shorten the page)

\geometry{
  left=25mm,
  right=20mm,
  top=25mm,
  bottom=12mm,
  includefoot=false,
  headsep = 2\baselineskip,
  footskip = \dimexpr1\baselineskip+1.5mm\relax,
}

\clearpairofpagestyles
\setkomafont{pageheadfoot}{\sffamily\footnotesize}
\setkomafont{pagination}{}

\ihead{Inner head}
\ohead{Outer head}

% declare a new layer for the footer on the first page
\DeclareNewLayer[
  foreground,
  textarea,
  contents={\vfill
    \raisebox{\dimexpr\depth-\dp\strutbox\relax}{%
        \makebox[0pt][l]{%
          \begin{tabular}[t]{@{}l}
            \textbf{An organization}\\
            With an address\\
            and communication channels
          \end{tabular}%
        }%
        \makebox[\linewidth][c]{%
          Footer on 1\textsuperscript{st} page only%
        }%
    }%
    \makebox[0pt][r]{%
      {\fontsize{37}{44}\selectfont XYZ}%
    }%
  }
]{firstpage.foot}

\DeclareNewLayer[
  clone=scrheadings.foot.above.line,
  textarea,
  addvoffset=\textheight-4\baselineskip
]{firstpage.foot.above.line}

% declare a new page style using layer firstpage.foot
\DeclarePageStyleByLayers[oninit=\KOMAoptions{footsepline}]{firstpage}{firstpage.foot,firstpage.foot.above.line}
% add the head layers from scrheadings to page style firstpage
\ForEachLayerOfPageStyle{scrheadings}{%
  \ifstrstart{#1}{scrheadings.head.}{\AddLayersToPageStyle{firstpage}{#1}}{}%
}

\RedeclareSectionCommands[
  beforeskip=1\baselineskip,
  afterskip=1\baselineskip,
  font=\normalsize
]{section,subsection,subsubsection,paragraph,subparagraph}

\xapptocmd{\maketitle}{\enlargethispage{-5\baselineskip}\thispagestyle{firstpage}}
  {}{\PatchFailed}

\title{Title}
\author{Author}
\begin{document}
\maketitle
\section{First section}
\subsection{Subsection 1}
\Blindtext[2]
\subsection{Subsection 2}
\Blindtext[6]
\section{Second section}
\Blindtext[12]
\end{document}

Your Answer

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

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