2

I am having an issue with the firsthead option in scrlttr2 class. See attached code. The document compiles with firsthead=off but when the option is set to firsthead=on, it generates the following error message.

Head of first page ! Missing number, treated as zero.

I do not know if it is a compatibility issue or something else. This has happened with many tex files I use. Surprisingly enough the same tex file compiles fine on my work laptop.

My code is as follows:

\documentclass[
pagenumber = off,       % Removes page numbers from page 2 onwards
parskip = half,         % Separates paragraphs with some whitespace, use parskip=full for more space or comment out to return to default
fromalign = right,      % Aligns the from address to the right
foldmarks=on,           % Prints small fold marks on the left of the page
addrfield=on,           % Set to false to hide the addressee section - you will then want to adjust the height of the body of the letter on the page by adding the following in this section: \makeatletter \@setplength{refvpos}{\useplength{toaddrvpos}} \makeatletter
fromphone = on,         % add phone
fromemail = on,         % add emaill
frommobilephone = on,   % add mobile phone
firstfoot = off,            % if first foot is on
firsthead = on
]{scrlttr2}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{url}
\usepackage{graphicx}
\usepackage{eurosym}
\usepackage[headheight=20pt, headsep=20pt]{geometry}
%\usepackage{showframe}
%\usepackage{datetime}
\usepackage{amsmath}
%\usepackage{gfsdidot}
%\usepackage{calligra}
\usepackage[hidelinks]{hyperref}
\usepackage{scrlayer-scrpage}
\usepackage{graphicx} % Um Grafiken (bspw. das Logo) einbinden zu können
\usepackage{blindtext}


\setlength{\parskip}{0.1\baselineskip}

\renewcommand*{\raggedsignature}{\raggedright} % Stop the signature from indenting

\LoadLetterOption{DIN} % Einstellungen für DIN 676 laden
\renewcommand*{\raggedsignature}{\raggedright}


\setkomavar{fromname}{Ct. Jack Sparrow}
\setkomavar{fromaddress}{Musterstr. 15, 05050 Musterstadt}
\setkomavar{frommobilephone}{+49 152 00000000}
\setkomavar{fromemail}{[email protected]}
\setlength{\parindent}{0pt}

\newcommand{\logo}[1]{\renewcommand{\logo}{#1}}

\newcommand{\Who}[1]{\renewcommand{\Who}{#1}}
\newcommand{\Title}[1]{\renewcommand{\Title}{#1}}

\Who{\huge Ct. Jack Sparrow \par} % Your name

\Title{Artist for Music and Dance} % Your title, leave blank for no title

\renewcaptionname{ngerman}{\customername}{Steuernummer}
\renewcaptionname{ngerman}{\invoicename}{Rechnungsnummer}


\setkomavar{customer}{222/333/00000}         % Steuernummer
\setkomavar{invoice}{2017-12-E001}          % Rechnungsnummer
\setkomavar{date}{\today}       % Datum         
\KOMAoptions{fromphone=on,fromfax=off}  
\setkomavar{subject}{Rechnung über erbrachte Leistungen}

\begin{document}    
    \begin{letter}{Receiver\\
                   His address\\
                   Pin, City}

        \opening{Sehr geehrte Damen und Herren,}

        \blindtext[2]

        \closing{Best Regards,}
    \end{letter}
\end{document}
3
  • 1
    I cannot reproduce the error with the example above, neither using an up-to-date TeX Live 2017 nor using TeX Live 2016 nor TeX Live 2015. Can you give us some more information about the TeX-Distribution and the versions of KOMA-Script and other packages? Dec 13, 2017 at 6:45
  • 1
    Off-topic: \parindent is already 0 after parskip=half. And the result of setting \parskip to 0.1\baselineskip looks more like a printing error than intent. However, if you want to use such settings, you should use \setparsizes (see the KOMA-Script manual for more information). And I would recommend to change \raggedsignature only once (and after loading the LCO). Dec 13, 2017 at 6:51
  • I can not reproduce the issue using an up-to-date MiKTeX.
    – esdd
    Dec 13, 2017 at 16:47

1 Answer 1

2

After moving the line \usepackage[hidelinks]{hyperref} to be the last called package the changed code can be compiled without error. Please see the changed order of packages in the following MWE.

\documentclass[%
  pagenumber = off,       % Removes page numbers from page 2 onwards
  parskip = half,         % Separates paragraphs with some whitespace, use parskip=full for more space or comment out to return to default
  fromalign = right,      % Aligns the from address to the right
  foldmarks=on,           % Prints small fold marks on the left of the page
  addrfield=on,           % Set to false to hide the addressee section - you will then want to adjust the height of the body of the letter on the page by adding the following in this section: \makeatletter \@setplength{refvpos}{\useplength{toaddrvpos}} \makeatletter
  fromphone = on,         % add phone
  fromemail = on,         % add emaill
  frommobilephone = on,   % add mobile phone
  firstfoot = off,            % if first foot is on
  firsthead = on
]{scrlttr2}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}

\usepackage{url}
\usepackage{graphicx} % Um Grafiken (bspw. das Logo) einbinden zu können
\usepackage{eurosym}
\usepackage[headheight=20pt, headsep=20pt]{geometry}
%\usepackage{showframe}
%\usepackage{datetime}
\usepackage{amsmath}
%\usepackage{gfsdidot}
%\usepackage{calligra}

\usepackage{scrlayer-scrpage}

\usepackage{blindtext}
\usepackage[hidelinks]{hyperref} % <====================================


\setlength{\parskip}{0.1\baselineskip}

\renewcommand*{\raggedsignature}{\raggedright} % Stop the signature from indenting

\LoadLetterOption{DIN} % Einstellungen für DIN 676 laden
\renewcommand*{\raggedsignature}{\raggedright}


\setkomavar{fromname}{Ct. Jack Sparrow}
\setkomavar{fromaddress}{Musterstr. 15, 05050 Musterstadt}
\setkomavar{frommobilephone}{+49 152 00000000}
\setkomavar{fromemail}{[email protected]}
\setlength{\parindent}{0pt}

\newcommand{\logo}[1]{\renewcommand{\logo}{#1}}

\newcommand{\Who}[1]{\renewcommand{\Who}{#1}}
\newcommand{\Title}[1]{\renewcommand{\Title}{#1}}

\Who{\huge Ct. Jack Sparrow \par} % Your name

\Title{Artist for Music and Dance} % Your title, leave blank for no title

\renewcaptionname{ngerman}{\customername}{Steuernummer}
\renewcaptionname{ngerman}{\invoicename}{Rechnungsnummer}


\setkomavar{customer}{222/333/00000}         % Steuernummer
\setkomavar{invoice}{2017-12-E001}          % Rechnungsnummer
\setkomavar{date}{\today}       % Datum         
\KOMAoptions{fromphone=on,fromfax=off}  
\setkomavar{subject}{Rechnung über erbrachte Leistungen}

\begin{document}    
    \begin{letter}{Receiver\\
                   His address\\
                   Pin, City}

        \opening{Sehr geehrte Damen und Herren,}

        \blindtext[2]

        \closing{Best Regards,}
    \end{letter}
\end{document}

It gives the following result without any error message:

resulting first page

3
  • Can you reproduce the problem with the original order of packages? Dec 13, 2017 at 6:46
  • Hello guys, I tried all your suggestions but I am still facing the issue. I am using MikTex 2.9 with Koma-Script 3.24. I am currently running the package updater. I hope it works after!
    – Addi Boy
    Dec 13, 2017 at 17:38
  • I did a MikTex update on all possible packages and the problem seems to have vanished. I can't really understand this because it worked fine for a while with the old package versions. Maybe I got into a compatibility issue when I added one of the packages later on. I version control these documents in tortoise and I am not sure if i screwed up there somewhere. Anyway thank you everyone for the help.
    – Addi Boy
    Dec 13, 2017 at 18:54

You must log in to answer this question.

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