5

Problem:

I try to include the following packages in my .tex file:

\usepackage{graphicx}
\usepackage{pdfpages}

For this I get the following errors:

thesis.tex (line 186)
Undefined control sequence (\mainmatterSU ...)

I Google a bit and find this: https://en.wikibooks.org/wiki/LaTeX/Errors_and_Warnings#Undefined_control_sequence

Which tells me that it might be a typo, but then I open up the .cls file and check there, which gives me:

% MAINMATTER
\newcommand{\mainmatterSU}{

\begingroup
\cleardoublepage
\edef\x{\endgroup
\noexpand\mainmatter
\setcounter{page}{\the\value{page}}%
}%
\x

\cleardoublepage

\fancypagestyle{plain}
{
    \fancyhead{}
    \fancyfoot[LE,RO]{{\fontfamily{verdana}\selectfont\thepage}}
}   % re-define plain page

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{{\fontfamily{verdana}\selectfont\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}

So I'm going a bit insane over here because I don't see the miss-spelling or what I could have done wrong by just including a package.

Removing those two packages will remove the errors.

Any help is appreciated!

6
  • 1
    The error message you show is not from tex and does not show which command is not defined. Please edit the question to add the exact error from the log file, from ! to ? Sep 2, 2014 at 17:57
  • @DavidCarlisle I'm using Texpad for OS X and I can't seem to locate ! to ?, which you are referring to. Could I kindly ask for some assistance?
    – kexxcream
    Sep 2, 2014 at 18:07
  • If your main file is zzz.tex then latex will have left a zzz.log file which will contain the error message all tex errors start with ! and end with ? (in interactive mode you can type a response to the ? but the ? is printed anyway even if your editor runs tex in batch mode) Sep 2, 2014 at 18:09
  • @DavidCarlisle Thank you for the explanation. But no log file exist in the same folder as the .tex file after compilation. I have uploaded the entire package here: distans.hkr.se/fam/latexmall3.0.zip - try adding the above mentioned packages to the file thesis.tex and you will see the errors.
    – kexxcream
    Sep 2, 2014 at 18:17
  • I'm not fetching the zip file but edef\x{\endgroup \noexpand\mainmatter \setcounter{page}{\the\value{page}}% }% is not a safe use of \edef (especiiiially of calc package is being used Sep 2, 2014 at 18:24

1 Answer 1

6

The error message is

./thesis.tex:186: Undefined control sequence.
\@calc@post@scan ...st@scan \else \def \calc@next
                                                 {\calc@error #1}\fi \fi \f...
l.186 \mainmatter

so the undefined command is \calc@next

as I guessed in initial comment, the \edef usage is incorrect and \setcounter is not safe in that context, although the error is usually not detected if calc is not loaded. put \noexpand before \setcounter

1
  • Thanks, this solved it perfectly. Highly appreciate your time and commitment to solve this issue!
    – kexxcream
    Sep 2, 2014 at 19:00

You must log in to answer this question.

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