I want to create a package and use it.

\ProvidesPackage{test}[just a test]

 Lorem Ipsum


the file is named test.sty. In my main.tex, I use \usepackage{test} to reference the package.

As soon as I build the file with MikTex / TeXworks, I get the following error:

! Missing number, treated as zero.
<to be read again> 


If I press continue, I also get the following errors:

Missing number, treated as zero. []
Missing = inserted for \ifnum. []
Missing number, treated as zero. []
LaTeX Error: Missing \begin{document}. []

My main.tex file looks like this:


What did I do wrong?

  • ProvidesPackage expects a date in the optional parameter
    – Bordaigorl
    Commented Dec 1, 2016 at 14:07
  • 2
    You should use the format \ProvidesPackage{<name>}[yyyy/mm/dd package <name>]
    – Bordaigorl
    Commented Dec 1, 2016 at 14:08

1 Answer 1


Trying to write your own package/class is a great way to learn LaTeX in more depth. However there is some black magic involved and you need to read the documentation to avoid common pitfalls. In your specific case, you are not following the expected format for the arguments of \ProvidesPackage. How do we know the correct format? You can run the command

texdoc clsguide

to get the standard guide for writing packages and classes. In section 3.1 you'll find:

The first thing a class or package file does is identify itself. Package files do this as follows:

\ProvidesPackage{⟨package⟩}[⟨date⟩ ⟨other information⟩]

For example:

\ProvidesPackage{latexsym}[1994/06/01 Standard LaTeX package]

You could have spotted the mistake in your MWE by reading carefully the log: it says it is expecting a number but found a j. The only j in your code is the one in the optional argument of \ProvidesPackage, [just a test].

You must log in to answer this question.

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