7

I tried adding my preamble to a new class file called labs.cls, in the same directory as my lab1.tex file. I then changed the preamble of my tex file to \documentclass{labs}. When I try to compile the tex file, I get this error:

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9)
entering extended mode
(F:\Coding\phy-182\formal_lab_reports\1_formal_lab\lab1.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
 lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
ishmax, welsh, loaded.
(F:\Coding\phy-182\formal_lab_reports\1_formal_lab\labs.cls
Document Class: labs 2014-03-16 Formal lab style for Miami University
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size10.clo"))
(C:\Users\Nate\AppData\Roaming\MiKTeX\2.9\tex\latex\fancyhdr\fancyhdr.sty)
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\mh\mathtools.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\tools\calc.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\mh\mhsetup.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"
For additional information on amsmath, use the `?' option.
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amstext.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty")))
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\was\gensymb.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\geometry\geometry.sty"
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ifpdf.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\oberdiek\ifvtex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\generic\ifxetex\ifxetex.sty")
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\geometry\geometry.cfg")))
! Missing = inserted for \ifnum.
<to be read again>
                   -
l.2

?

this is my class file:

\ProvidesClass{labs}[2014-03-16 Formal lab style for University]
\NeedsTeXFormat{LaTeX2e}

\LoadClass[letterpaper]{article}
\RequirePackage{fancyhdr}
\RequirePackage{mathtools}
\RequirePackage{gensymb}
\RequirePackage[margin=1in]{geometry}
\fontsize{12}{14}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\linespread{2}
\AtBeginDocument{\thispagestyle{empty}}
\lhead{Nathan Mara}

Is there something that I'm doing wrong in this class file?

I get the same error with even this tex file:

\documentclass{labs}

\begin{document}

\end{document}
1
  • Welcome to TeX.SX! The date in the argument to \ProvidesClass must be 2014/03/16 (slashes, not hyphens).
    – egreg
    Mar 19, 2014 at 21:52

1 Answer 1

8

The commands \ProvidesClass, \ProvidesPackage and \ProvidesFile have a mandatory argument (the file name, without extension for the first two commands, because .cls and .sty are implied) and an optional argument stating the version of the file. The optional argument should be of the form

<date> <info>

The <info> part is not required; if present it should be separated from the date by a space.

So, for instance, one can simply do

\ProvidesClass{foo}

which however is not good programming style: a date should always be provided. Hence either

\ProvidesClass{foo}[2014/03/19]

or

\ProvidesClass{foo}[2014/03/19 Some information]

Note that the format of the date is like shown, with slashes and not hyphens:

YYYY/MM/DD

that is, four digits for the year, two digits for the month and two digits for the day. Any other input will cause the \ifnum error.

1

You must log in to answer this question.

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