# KOMA-Script article in LyX [duplicate]

I would like to set the document class of my LyX document to KOMA-Script article. When I try this via Document > Settings > Document Class, the document does not compile any more. Last part of Error message:

Package amsthm Warning: Unknown theoremstyle slplain' on input line 158.

(/usr/local/texlive/2012/texmf-dist/tex/latex/preprint/fullpage.sty)
(./KOMA.aux) (/usr/local/texlive/2012/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2012/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./KOMA.out) (./KOMA.out)
(/usr/local/texlive/2012/texmf-dist/tex/context/base/supp-pdf.mkii
) ABD: EveryShipout initializing macros
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/t1cmss.fd)
(/usr/local/texlive/2012/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2012/texmf-dist/tex/latex/amsfonts/umsb.fd)
./KOMA.tex:181: Undefined control sequence.
\chapter ...ace {10\p@ }}\algocf@original@chapter

l.181 \tableofcontents
{}
?
(./KOMA.toc) [1{/usr/local/texlive/2012/texmf-var/fonts/map/pdftex/updmap/pdfte
x.map}] (./KOMA.aux) ){/usr/local/texlive/2012/texmf-dist/fonts/enc/dvips/cm-su
per/cm-super-t1.enc}</usr/local/texlive/2012/texmf-dist/fonts/type1/public/cm-s
uper/sfrm1000.pfb></usr/local/texlive/2012/texmf-dist/fonts/type1/public/cm-sup
er/sfrm1440.pfb></usr/local/texlive/2012/texmf-dist/fonts/type1/public/cm-super
/sfsx2074.pfb>
Output written on KOMA.pdf (1 page, 27879 bytes).
SyncTeX written on KOMA.synctex.gz.
Transcript written on KOMA.log.


What is wrong with the TOC here? Why is it not compatible with the document class?

EDIT: As requested, here is a minimal example for which the error appears:

%% LyX 2.0.5.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[10pt,english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%------------------- My Packages --------------------------
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}

\usepackage[ruled,vlined, linesnumbered]{algorithm2e}
\usepackage{amsmath, amsthm, amssymb}
\numberwithin{equation}{section}
\usepackage{rotating}
\usepackage{subfigure}
\usepackage{hyperref}
\usepackage{float}
\usepackage{soul} % text highlighting
%\usepackage{minted} % code
\usepackage{multirow}
\usepackage{todonotes}
\usepackage{wrapfig}
%\usepackage{mparhack}
\usepackage{rotating}
%\usepackage[ngerman]{babel}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{numprint}
\usepackage{xspace}
\usepackage[switch]{lineno}
\usepackage{balance}

%----------------- My Settings ------------------------------

\DeclareGraphicsRule{.tif}{png}{.png}{convert #1 dirname #1/basename #1 .tif.png}
\graphicspath{{graphics/}}

%------------------- My Commands --------------------------

% text formatting
\newcommand{\algo}[1]{\textsf{#1}}
\newcommand{\term}[1]{\emph{#1}}
\newcommand{\atitle}[1]{\textsl{#1}}
\newcommand{\func}[1]{ \mathit{#1} }
\newcommand{\var}[1]{\mathtt{#1}}
\newcommand{\name}[1]{\textsc{#1}}
\newcommand{\software}[1]{\textsf{#1}}
\newcommand{\code}[1]{\textsf{#1}}
\newcommand{\class}[1]{\textsf{#1}}
\newcommand{\method}[1]{\textsf{#1}}
\newcommand{\prb}[1]{\textsc{{\small#1}}}
\newcommand{\smallcaption}[1]{\caption{\scriptsize{#1}}}

% symbols
\newcommand{\NP}{$\mathcal{N}\mathcal{P}$}
\newcommand{\auth}{\smile}
\newcommand{\coauth}{\frown}
\newcommand{\mb}[1]{\mathbf{#1}}
\newcommand{\orp}{\; | \;}
\newcommand{\AND}{\wedge}

% notes
\newcommand{\vertical}[1]{\begin{sideways}#1\end{sideways}}
\newcommand{\TODO}[1]{\todo[size=\small, inline]{#1}}
\newcommand{\tinytodo}[1]{\todo[size=\tiny, inline]{#1}}
\newcommand{\note}[1]{\textcolor{orange}{\textbf{#1}}}

% abbreviations
\newcommand{\pairs}[1]{\textstyle{#1 \choose 2}}
\newcommand{\set}[1]{ \{ #1 \} }
\newcommand{\fig}[1]{Fig.~\ref{#1}}
%\newcommand{\ie}{i.e.\ }
%\newcommand{\eg}{e.g.\ }
%\newcommand{\etal}{et\! al.\! }

\newcommand{\ie}{i.\,e.,\xspace}
\newcommand{\eg}{e.\,g.,\xspace}
\newcommand{\etal}{et al.\xspace}
\newcommand{\Wlog}{w.\,l.\,o.\,g.\ }
\newcommand{\wrt}{w.\,r.\,t.\xspace}

% other
\newcommand{\margindef}[1]{\marginpar{\textsf{{\scriptsize #1}}} } % margin definition in small caps

\newcommand{\defblock}[2]{\begin{definition} \margindef{\\ #1}#2 \end{definition}} % definition block with margin definition

\makeatletter
\makeatother

% ------------------- My Environments ---------------------

\newenvironment{citemize}{
\begin{itemize}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}{\end{itemize}
}

\newenvironment{fitemize}{
\renewcommand{\labelitemi}{\small$\circ$}
\begin{itemize}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}{\end{itemize}
}

\newenvironment{termdef}[2][default]
{\margindef{\\ #2} Def.: \textbf{#2} \\}
{}

\newenvironment{noteblock}{
\color{orange} }
{}

%------ This set of macros generates the daytime and puts it to the footline
\newcount\shortyear\newcount\shorthour\newcount\shortminute
\shorthour=\time\divide\shorthour by 60\shortyear=\shorthour
-\shortyear

\def\zeit{\number\shorthour:\ifnum\shortminute<10 0\number\shortminute
\else\number\shortminute\fi}

\def\rightmark{{\small \today, \zeit{}}}
%\def\rightmark{}    %<-- Uncomment this line to remove the daytime!
%------

%------------ My Theorems --------------------

\theoremstyle{slplain}

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}{Def.}

% My Packages

\usepackage{fullpage} % smaller page margins

\makeatother

\begin{document}

\title{Title}

\author{Author}
\maketitle
\begin{abstract}

\end{abstract}
\tableofcontents{}

\pagebreak{}
\end{document}

• \tableofcontents works just fine in KOMA's article class, so there must be something else wrong. Can you trim the LyX file down to the minimum showing the problem, and include either the .lyx file (it is just plain text, as you'll see if you open it in a text editor) or the exported LaTeX source? – Torbjørn T. Sep 6 '13 at 18:03
• @TorbjørnT. I have added the exported LaTeX source. – clstaudt Sep 11 '13 at 11:47
• Works just fine here, compiled with pdfLaTeX or LuaLaTeX. So the corresponding LyX file gives that error? Don't know what could cause that. If you open the .tex file in e.g. TeXworks and compile with pdfLaTeX (choose it from the drop down on the top left, and click the green arrow), does it work? – Torbjørn T. Sep 11 '13 at 12:23
• Right, so it's \algocf@original@chapter that is undefined, not \tableofcontents. I don't know exactly why it occurs, probably from an algorithm-related package. I have TeX Live 2013, so perhaps updating to MacTeX 2013 would solve the problem. Note also the warning, that there is no theoremstyle called slplain, so I guess \theoremstyle{slplain} wont have any effect. – Torbjørn T. Sep 11 '13 at 13:50
• This appears to happen because algorithm2e expects \chapter to be available, see tex.stackexchange.com/questions/14938/… (and latex-community.org/forum/viewtopic.php?f=44&t=14049). As the error didn't occur for me I would guess that this has been fixed in the package recently. You could try \let\chapter\section before \usepackage{algorithm2e}, if you haven't already upgraded MacTeX. – Torbjørn T. Sep 15 '13 at 8:46