0

I'm getting the following error message and have no clue why:

! TeX capacity exceeded, sorry [parameter stack size=10000].
\@fileswithoptions #1->
                       \@ifnextchar [{\@fileswith@ptions #1}{\@fileswith@pti...
l.2 \usepackage{
                pgfplots}
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.


Here is how much of TeX's memory you used:
 5 strings out of 493029
 170 string characters out of 6136233
 119745 words of memory out of 5000000
 3641 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191

The strange thing is, that this happens even with this piece of code:

\documentclass[article]
\usepackage{pgfplots}

\begin{document}
\end{document}

Any ideas? Thanks in advance!

3
  • 4
    The document class should be typeset with curly braces \documentclass{article}
    – Troy
    Commented Apr 16, 2017 at 11:38
  • Oh...guess this was a noob question. Thank you very much!
    – Jakob W.
    Commented Apr 16, 2017 at 11:42
  • Welcome to LaTeX! Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. I also suggest you browse around the most voted questions to find "newbie" material
    – Moriambar
    Commented Apr 16, 2017 at 11:43

1 Answer 1

6

As noted in comments the error is a simple typo, using [] instead of {} but I thought I'd mention why you get the error you get (and why it is hard to give good error messages in a macro language like TeX).

The intended usage was

\documentclass{article}

with the mistaken input being

\documentclass[article]

It would have been nice to have flagged that as some kind of "wrong bracket" syntax error, but LaTeX does not know at this point that there is an error.

Like all macro arguments the class name does not have to be in explicit braces, the following works without error

\newcommand\zzz{article}
\documentclass[article]
\zzz
\usepackage{pgfplots}

\begin{document}
\end{document}

Here

 \documentclass[article]\zzz

is the same as

 \documentclass[article]{\zzz}

and \zzz is expanded to article so it is the same as

 \documentclass[article]{article}

so it runs as intended, with just a warning at the end that [article] is an unused option:

LaTeX Warning: Unused global option(s):
    [article].

Your case is similar, except that instead of

   \documentclass[article]{\zzz}

you have (effectively)

   \documentclass[article]{\usepackage}

so TeX expands \usepackage hoping to find a filename to pass to \documentclass and dies in some horrible unintended expansion, actually it ends up in an infinite loop until it fills up an internal macro parameter handling stack.

the best hint is the linebreak in the error message

l.2 \usepackage{
                pgfplots}

which tells you that TeX has read \usepackage but not its argument (because (just) \usepackage has been taken as the argument to \documentclass).

You must log in to answer this question.

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