I am trying to use the answer supplied in question Change \headheight for a \pagestyle in my own document, but am having trouble understanding the error messages that come up.

Here is the document: (UPDATED)


\begin{lecture}{01}{Sample Lecture Notes}{Tom Jack}{01/01/2000}{Chris Karl}{PHYSICS 130: Physics of Energy}


And the style file lecturenotes.sty: (UPDATED)


\usepackage[top=2cm, bottom=2cm, outer=5.5cm, inner=2cm, heightrounded, marginparwidth=3.5cm, marginparsep=0.4cm, includeheadfoot]{geometry}

            \hbox to 12.5cm { {\bfseries {\course}} \hfill {Lecture \lecturenum\ -- \lecturedate} }
            \hbox to 12.5cm { {\Large \hfill {\lecturetitle}  \hfill} }
            \hbox to 12.5cm { {\itshape {Lecturer: \lecturer} \hfill {Notes by: \lecturescribe}} }



{{\rlap{\lecturedate}\hfill \lecturetitle\hfill\llap{Lecture \lecturenum}}}
{{\rlap{\lecturedate}\hfill \lecturetitle\hfill\llap{Lecture \lecturenum}}}
{{\rlap{\lecturedate}\hfill \lecturetitle\hfill\llap{Lecture \lecturenum}}}
{{\rlap{}\hfill \thepage\hfill\llap{}}}
{{\rlap{}\hfill \thepage\hfill\llap{}}}
{{\rlap{}\hfill \thepage\hfill\llap{}}}

{{\rlap{}\hfill \thepage\hfill\llap{}}}
{{\rlap{}\hfill \thepage\hfill\llap{}}}
{{\rlap{}\hfill \thepage\hfill\llap{}}}


        \global\advance\headheight by -3cm

    \global \def \lecturenum {#1}
    \global \def \lecturetitle {#2}
    \global \def \lecturescribe {#3}
    \global \def \lecturedate {#4}
    \global \def \lecturer {#5}
    \global \def \course {#6}
  • Consider switching to the new package scrlayer-scrpage. It is downwards compatible to scrpage2, but offers more features. – Speravir Feb 8 '14 at 23:30

Your use of new page styles is completely incorrect. To define a new page style, the KOMA-Script syntax is (see the KOMA-Script documentation, section 5.2.2. The Interface for Experts, p 217 onward):

\newpagestyle{<name>}{<header definition>}{<footer definition>}

where <header definition> and <footer definition> should resemble



  • <ALL> – above line length: (header = outside, footer = separation line)
  • <ALT> – above line thickness
  • <EP> – definition for even pages
  • <OP> – definition for odd pages
  • <OS> – definition for one-sided layout
  • <BLL> – below line length: (header = separation line, footer = outside)
  • <BLT> – below line thickness

Also, the syntax for creating a macro is \newcommand{\<csname>}, not \newcommand{<csname>}. You've used \newcommand{normalpagehead}. Finally, you create a lecture environment that doesn't have an end:

  {<begin>}% \begin{lecture}
  {<end>}% \end{lecture}
  • 1
    Also, there's no \begin{document}... OK. There is, but it is in completely the wrong place... – cfr Feb 7 '14 at 4:07
  • Thanks for the comprehensive rundown @Werner, I ended up getting completely confused trying to mix the code I saw in the "Change \headheight for a \pagestyle" question with the stuff I already had, which as you probably guessed used fancyhdr. I've straightened everything out, and it runs perfectly. Just one final question, with the code as it is now the header on the first page is lower than other header, and I'm not really sure why? Ill update the code in the question. – Heisenbugs Feb 7 '14 at 5:25
  • @Heisenbugs: This may be partially as a result of spurious spaces in your definitions (like \firstpagehead) as well as \AtBeginDocument (see What is the use of percent signs (%) at the end of lines?). However, it's sometimes better to mock up what you want and supply what you've tried, than to try and force something into something that it's not. Perhaps a follow-up question could be just that... – Werner Feb 7 '14 at 6:21
  • @Heisenbugs: Did you notice cfr’s comment? \begin{document} does not belong in a package definition and not even in an environment definition. – Speravir Feb 7 '14 at 22:28

For example, though this makes no attempt to emulate your formatting as I don't understand what it is meant to look like. This does, however, include the information in a fairly sane way:

\ProvidesPackage{lecturenotes}[2014/02/05 v1.0 lecturenotes]

\RequirePackage{amsmath,amssymb,amsthm}% use \RequirePackage in a package or class file; \usepackage in the preamble; amssymb calls amsfonts
% \RequirePackage[top=2cm, bottom=2.5cm, outer=5.5cm, inner=2cm, heightrounded, marginparwidth=3.5cm, marginparsep=0.4cm, includeheadfoot]{geometry}% don't use geometry with the koma-script classes - koma-script manages this differently - or you could use a different class and use geometry, of course.

\newcommand*{\lecturenum}{}% make sure stuff is defined


\ihead[\bfseries\course]{\lecturedate}% use \bfseries/\textbf{} - not \bf
\ohead[Lecture \lecturenum --- \lecturedate]{Lecture \lecturenum}

% \RequirePackage{afterpage}
% \addtolength{\textheight}{-3cm}% don't do this (either use geometry with other classes or koma-script's facilities)
% \addtolength{\headheight}{3cm}
%     \thispagestyle{firstpage}
%     \addtolength{\textheight}{3cm}
%     \afterpage{
%         \global\advance\headheight by -3cm
%     }

    \renewcommand*\lecturenum {#1}% use \newcommand/\renewcommand rather than \def etc. whenever possible
    \renewcommand* \lecturetitle {#2}%
    \renewcommand* \lecturescribe {#3}%
    \renewcommand*\lecturedate {#4}%
    \renewcommand* \lecturer {#5}%
    \renewcommand* \course {#6}%
    {\itshape Lecturer: \lecturer\hfill Notes by: \lecturescribe}\bigskip\par% \itshape or \textit{} - not \it


\lecture{01}{Sample Lecture Notes}{James Cook}{01/01/2000}{Mark Cook}{PHYSICS 130: Physics of Energy}

\lipsum[1-20]% optional arguments in square brackets not curly ones


lecture notes

Obviously this isn't how you want it to look. My code is rather intended to give you an idea about how to go about it. The Koma-Script manual has a lot of information, as Werner indicated.

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.