2

Thank you for any help in advance!

I want to set up an a5 document in this way - where every single page looks this way except the page number changes. I just want to add the notes in the middle of the page as normal.

I have been trying but I usually use exam class and a4 page so I am very confused.

    \documentclass[a5paper,pagesize,11pt,bibtotoc,pointlessnumbers,
normalheadings,DIV=9,twoside=false]{scrbook}

% twoside, openright
\KOMAoptions{DIV=last}

\usepackage{trajan}

\linespread{1.05} 


\begin{document}

notes here

\end{document}

enter image description here

5
  • 1
    If you add the header-footer tag on your question you will get numerous suggestions. The overleaf tag is unecessary as this is a LaTeX question and that what overleaf uses at the back end to process your document. As a matter of fact you will be better off to get a latex distribution locally and use it, especially if you intent to write a book. Why use twoside option if you want all the pages to have a header or footer the same? You will be better off with oneside. ok back to your issue. Use fancyhdr package, it will be the easiest to get you going.
    – yannisl
    Commented Feb 11 at 10:31
  • First of all you should have a look into the log file of you example and then replace all the deprecated options according to the recommendation in the warning messages. Next have a look into the scrlayer-scrpage chapter of the KOMA-Script manual.
    – cabohah
    Commented Feb 11 at 10:33
  • @yannisl With scrbook package scrlayer-scrpage instead of fancyhdr is recommended (and won't result in a warning message).
    – cabohah
    Commented Feb 11 at 10:36
  • @cabohah I know, thought it was easier through fancyhdr, as there are lots of examples here and is an easier read rather than the koma documentation. Personally I find it easier to redefine the ps@.
    – yannisl
    Commented Feb 11 at 10:42
  • @yannisl We already have more than 200 questions about scrlayer-scrpage. The answers to the scrpage2 questions also can be easily adapted to use scrlayer-scrpage instead of scrpage2. So no need to lead the questioner to a not recommended package combination.
    – cabohah
    Commented Feb 11 at 13:01

1 Answer 1

2

KOMA-Script provides the packages scrlayer and scrlayer-scrpage to change the page header and footer. There are several possible ways to get the result you want. An IMHO easy example would be to define the whole page header inclusive the double separation line using \ihead or \ihead* (for the difference see the KOMA-Script manual):

\ihead*{\includegraphics[height=5.5\baselineskip,width=7em]{example-image}
  \parbox[b][5.5\baselineskip]{\dimeval{\linewidth-8em}}{\raggedright
    Topic x: xxx x xxxxxx xx\\
    xxxxxxxx xxx xxxxxxxx\\
    xxxxxx xxxx x xx xxxxxxxx xxxxxx xxxxxxx xxx\\
    01.10 xxxx 1/2\\
    \null
  }\\[-1ex]
  \makebox[0pt][l]{\rule[2pt]{\linewidth}{1pt}}%
  \rule{\linewidth}{1pt}
}

Because this head is a lot higher than the usual one, we also need to increase the head height. The warning message without increasing the head height gives more information about the needed height.

If you want (automatic) running heads (similar to page style headings) you need to use \headmark somewhere in that head definition. See the KOMA-Script manual for more information.

For the page footer we could use a similar solution. But because the page number should be placed in the middle of the footer and at a lower position, I would suggest to use \ifoot* and \cfoot*:

\ifoot*{%
  \makebox[0pt][l]{\rule[2pt]{\linewidth}{1pt}}%
  \rule{\linewidth}{1pt}\\
  @copyright stuff hre\dots
}
\cfoot*{%
  \raisebox{-5\baselineskip}[0pt][0pt]{\pagemark}
}

Again there will be a warning message, because of the height.

A complete example respecting the additional needed height for the page header and footer could be:

\documentclass[
  a5paper,
  % pagesize,11pt,% both are default and therefore not needed
  bibliography=totoc,% bibtotoc is deprecated and therefore replaced according
                     % to the warning message
  numbers=noenddot,% pointlessnumbers is deprecated and therefore replaced
                   % according to the warning message
  headings=normal,% normalheadings is deprecated and therefore replaced
                  % according to the warning message
  DIV=9,twoside=false,
  headinclude,
  headheight=87pt,% see the KOMA-Script manual and the warning message without
                  % this line
  footheight=24pt,% see the KOMA-Script manual and the warning message without
                  % this line
]{scrbook}

\KOMAoptions{DIV=last}

\usepackage{trajan}

\linespread{1.05}

\KOMAoptions{DIV=last}% moved according to the KOMA-Script manual, because it
                      % makes no sense before changing font an linespread.

\usepackage{graphicx}
\usepackage{blindtext}

\usepackage[manualmark]{scrlayer-scrpage}% or maybe automark, this
                                % is not clear due to missing information in
                                % the question.
\clearpairofpagestyles
\setkomafont{pageheadfoot}{\footnotesize}
\ihead*{\includegraphics[height=5.5\baselineskip,width=7em]{example-image}
  \parbox[b][5.5\baselineskip]{\dimeval{\linewidth-8em}}{\raggedright
    Topic x: xxx x xxxxxx xx\\
    xxxxxxxx xxx xxxxxxxx\\
    xxxxxx xxxx x xx xxxxxxxx xxxxxx xxxxxxx xxx\\
    01.10 xxxx 1/2\\
    \null
  }\\[-1ex]
  \makebox[0pt][l]{\rule[2pt]{\linewidth}{1pt}}%
  \rule{\linewidth}{1pt}
}
\ifoot*{%
  \makebox[0pt][l]{\rule[2pt]{\linewidth}{1pt}}%
  \rule{\linewidth}{1pt}\\
  @copyright stuff hre\dots
}
\cfoot*{%
  \raisebox{-5\baselineskip}[0pt][0pt]{\pagemark}
}
\renewcommand{\familydefault}{trjn}% If you want to the font as document default.

\begin{document}

\blindtext

\end{document}

enter image description here

If you want other margins or less distance between page header and text area, see package geometry.

Another suggestion would be draw one separation line using option headsepline resp. footsepline and to add the second separation line using two new layers. Also instead of using \raisebox to lower the page number one more layer could be added to the page styles:

\documentclass[
  a5paper,
  % pagesize,11pt,% both are default and therefore not needed
  bibliography=totoc,% bibtotoc is deprecated and therefore replaced according
                     % to the warning message
  numbers=noenddot,% pointlessnumbers is deprecated and therefore replaced
                   % according to the warning message
  headings=normal,% normalheadings is deprecated and therefore replaced
                  % according to the warning message
  DIV=9,twoside=false,
  headsepline,footsepline,footinclude=false,% see the KOMA-Script manual
%  headheight=87pt,% not used, to not lower the header, but this results in a warning
%  footheight=24pt,% no longer needed, because the lines are not part of the footer
]{scrbook}

\KOMAoptions{DIV=last}

\usepackage{trajan}

\linespread{1.05}

\KOMAoptions{DIV=last}% moved according to the KOMA-Script manual, because it
                      % makes no sense before changing font an linespread.

\usepackage{graphicx}
\usepackage{blindtext}

\usepackage[%
  autoenlargeheadfoot=false,% only warn but don't change height reserved for header or footer  
  manualmark,% or maybe automark, this is not clear due to missing information
             % in the question.
  plainheadsepline,plainfootsepline,% See the KOMA-Script manual for more information
  ]{scrlayer-scrpage}
\clearpairofpagestyles
\setkomafont{pageheadfoot}{\footnotesize}
\ihead*{\includegraphics[height=5.5\baselineskip,width=7em]{example-image}
  \parbox[b][5.5\baselineskip]{\dimeval{\linewidth-8em}}{\raggedright
    Topic x: xxx x xxxxxx xx\\
    xxxxxxxx xxx xxxxxxxx\\
    xxxxxx xxxx x xx xxxxxxxx xxxxxx xxxxxxx xxx\\
    01.10 xxxx 1/2\\
    \null
  }\\[-1ex]
}
\ifoot*{%
  @copyright stuff hre\dots
}

% Defining new layers for the second separation line.
% We simply clone the existing lines and raise or lower them:
\DeclareLayer[clone=scrheadings.head.below.line,addvoffset=-2pt]{scrheadings.head.below.line2}
\DeclareLayer[clone=scrheadings.foot.above.line,addvoffset=2pt]{scrheadings.foot.above.line2}
\DeclareLayer[clone=plain.scrheadings.head.below.line,addvoffset=-2pt]{plain.scrheadings.head.below.line2}
\DeclareLayer[clone=plain.scrheadings.foot.above.line,addvoffset=2pt]{plain.scrheadings.foot.above.line2}

% Define a new layer for the page number:
\DeclareLayer[foreground,foot,addvoffset=2cm,contents={\centering \pagemark\par}]{pagenumber}

% Add the new layers to the existing page styles:
\AddLayersToPageStyle{scrheadings}{scrheadings.head.below.line2,scrheadings.foot.above.line2,pagenumber}
\AddLayersToPageStyle{plain.scrheadings}{plain.scrheadings.head.below.line2,plain.scrheadings.foot.above.line2,pagenumber}

\renewcommand{\familydefault}{trjn}% If you want to the font as document default.

\begin{document}

\blindtext

\end{document}

enter image description here

Even the image and the text in the page header could be placed using separate layers. See the KOMA-Script manual for more information about defining new layers and adding them to existing page styles or defining new page styles.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .