# Compiling error regarding scrlayer-scrpage

A solution for one of my questions works well for the one who provided it, but results in the error "Missing \begin{document}. \ofoot*{\pagemark" for me during compiling. Could it be a problem with my installation, packages, os? On this online latex compiler the same error is preventing him to produce an output so may I don´t have a problem but the code need to be changed?

\documentclass[12pt,a4paper,listof=flat,oneside]{scrartcl}
\usepackage{nicefrac}
\usepackage{scrlayer-scrpage}
\ofoot*{\pagemark}
\cfoot*{}
\automark[section]{section}
\KOMAoptions{
markcase=upper}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xfrac}
\usepackage{xspace}
\newcommand{\eg}{\mbox{e.\,g.}\xspace}
\newcommand{\Eg}{\mbox{E.\,g.}\xspace}
\usepackage[english]{babel}
\usepackage[onehalfspacing]{setspace}
\usepackage{lmodern}
%\usepackage{helvet}
%\renewcommand{\familydefault}{\sfdefault}
%\fontfamily{phv}\selectfont
\usepackage{color}
\usepackage[
pdftoolbar = false,
pdftitle   = mwe,
pdfauthor  = {author},
allcolors =  {blue},
bookmarks         = true,
bookmarksopen     = true,
bookmarksnumbered = true
]{hyperref}
\usepackage{subcaption}

\begin{document}
\section{Chapter one} \label{sec:ChapterOne}
This text shows the current options that I have used for the printed version of my document. What and why would you change something?
\begin{itemize}
\item Referencing in blue. \Eg: Chapter one on page \ref{sec:ChapterOne}
\item In-text math mode I use tfrac or nicefrac like this $\tfrac{1}{2}$ or this $\nicefrac{1}{2}$ and dfrac in the stand-alone equations. Or is sfrac of the xfrac package the way to go? $\sfrac{1}{2}$. What is the difference?
\item Different fonts for print-out and digital copy? \Eg helvet for pdf for no serifs?
\end{itemize}
\newpage
Thats what the pagestyle I have choosed looks like, but there is a warning about fancyhdr, how to produce the same output with KOMA?

\begin{figure}[!htbp]
\null\hfill
\begin{minipage}[b]{0.4\linewidth}
\centering \includegraphics[width=\textwidth]{example-image-a}
\subcaption{Example A}\label{fig:a}
\end{minipage}
\hfill
\begin{minipage}[b]{0.4\linewidth}
\centering \includegraphics[width=\textwidth]{example-image-b}
\subcaption{Example B}\label{fig:b}
\end{minipage}
\hfill\null
\caption{Two figures with subcaption and minipage}
\end{figure}
\end{document}

• If you have an error please show the full error from the log in a code section so line endings are preserved, show the full text from ! to ? It is possible you have an invisible control character in your input (there is not in the version pasted above) Apr 27, 2017 at 9:30
• I am using TeXstudio and I can´t find the ? in the log, but I guess that is the important part: ! LaTeX Error: Missing \begin{document}. Apr 27, 2017 at 9:37
• If the starred versions of \ihead etc. are unknown, the used KOMA-Script version is very old. The "Missing \begin{document} is only a result of the unknown starred versions.
– esdd
Apr 27, 2017 at 9:39
• @NN123 no the missing document bit is the least important part of the error message! Apr 27, 2017 at 9:55
• Sorry... for esdd it seems to be clear. The rest of the log was just too long to post I guessed and also for me to understand, but I can see now the v3.12 KOMA-Script package, which is outdated and produces the error Apr 27, 2017 at 9:59

The mentioned online compiler uses a really old KOMA-Script version:

Document Class: scrartcl 2013/12/19 v3.12 KOMA-Script document class (article)

Current version is 3.22 and version 3.23 will be soon available on CTAN. The starred versions of \ihead etc. are introduced in version 3.14.

If you can not update, then use:

\usepackage[automark,markcase=upper,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ofoot[\pagemark]{\pagemark}


Complette example:

\documentclass{scrartcl}
\clearpairofpagestyles
\ofoot[\pagemark]{\pagemark}

\usepackage{blindtext}
\begin{document}
\thispagestyle{plain}
{\huge\KOMAScriptVersion\par}
\blinddocument
\end{document}


Output by the Online Compiler mentioned in the question:

• This works also for my installation, is it fine to just use it like this or how should I update my packages/installtation properly? Apr 27, 2017 at 9:42
• If possible update the installation. It seems to be really outdated.
– esdd
Apr 27, 2017 at 9:48
• Okay, I will check it once there is more time, but for now this works fine, thank you and also thank you for the answer you provided on how to change the italic to upshape in another question, I also needed this :-) Have a nice day Apr 27, 2017 at 9:51

The posted code gives

! Paragraph ended before \@fileswith@ptions was complete.


because of the blank line in the hyperref options.

If you remove that

\usepackage[
pdftoolbar = false,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<<<<<<<<<<,
pdftitle   = mwe,
pdfauthor  = {author},
allcolors =  {blue},
bookmarks         = true,
bookmarksopen     = true,
bookmarksnumbered = true
]{hyperref}


Then it gives the error

! Undefined control sequence.
<argument> \undefinedpagestyle

l.48 \thispagestyle{leer}


I can not guess if that is a typo for a page style that is defined, or if the definition of that page style is missing. But if you remove that, so:

%\thispagestyle{leer}


then the document runs without error.

• Sorry, it should be named like that \thispagestyle{plain.scrheadings}` as defined and as the question shows, it does not run without an error for me or for this online compiler. Apr 27, 2017 at 9:30
• @NN123 as it shows now :-) that it has been edited. The current version as posted in your edited question is error free so as I have commented under the question you need to show the error that you get. Apr 27, 2017 at 9:33