TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using a custom class for my thesis.

It is causing errors whenever I try to make a chapter (the class is based on report). I have tracked down that this piece is the one causing the error:

    \vspace*{50 pt}%
    {\setlength{\parindent}{0pt} \raggedright \normalfont
        \ifnum \value{secnumdepth}>1
            \if@mainmatter\thechapter\ %
        #1\par\nobreak\vspace{40 pt}}}

Could you please take a look and tell what could be causing the problems? I wouldn't mind minor corrections on this piece.

The exact error message is:

! Undefined control sequence.
\@makechapterhead ...ecnumdepth}>1 \if@mainmatter
\thechapter \ \fi #1\par \...
l.52 \chapter{Problēmas formulējums}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This is not the first time I try to use the class and it has always caused these problems on some of the installations.

I am using TexMaker and MikTex 2.9. I use PDFLaTeX for compiling. I tried updating packages and it didn't help. Maybe there is some certain package that I should work on harder?

share|improve this question

closed as too localized by Speravir, Jubobs, Stefan Kottwitz May 6 '13 at 23:08

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Welcome to TeX.sx! Is it a class or a package? I mean, do you use it as argument to \documentclass or to \usepackage? If it's a class based on report, then it uses \if@mainmatter that's inexistent in that class; if it's a package, then use the book class as the main one. – egreg May 6 '13 at 22:22
It is included with \documentclass{ludis}. You can see the whole class file here if you'd like to - github.com/emilssolmanis/kursa-darbs/blob/master/ludis.cls – Juris May 6 '13 at 22:26
Actually, \documentclass{ludis} \title{My title} \begin{document} \chapter{foo} \end{document} compiles like a charm, here (I used the very class file you link to). Perhaps you should post a minimal working example (MWE) that illustrates your problem. – Jubobs May 6 '13 at 22:32
@Jubobs In the file you link, lines 66 and 68 are commented out; line 66 corresponds to your fifth line, while line 68 has disappeared. Copy again the file from the source. – egreg May 6 '13 at 22:36
@Juris \f@mainmatter was never in report (it is in book class) – David Carlisle May 6 '13 at 22:57