17

I have the following (minimal) document class:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{minimal-article}[2013/01/11 Test class, extends article]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions

% Load parent class with preset options
\LoadClass[a4paper,titlepage]{article}

\RequirePackage{tikz}

\renewcommand\maketitle{%
 \begin{titlepage}%
  \begin{tikzpicture}[remember picture, overlay]%
  \typeout{Drawing a rectangle?} %
   \fill [fill=red] at (current page.south west) rectangle (current page.south east);%
  \typeout{Background rectangle built.}%
  \end{tikzpicture}%
 \end{titlepage}%
 }
 \AtBeginDocument{
  \maketitle
 }

 \endinput

When using this from the minimal document file:

\documentclass[11pt]{minimal-article}

\begin{document}
 \tableofcontents
\section{Foo!}
\end{document}

I get a strange error message:

Drawing a rectangle?
! Use of \@next doesn't match its definition.
\maketitle ...ng a rectangle?} \fill [fill=red] at
                                               (current page.south west)...
l.3 \begin{document}

As far as I can guess, it has to be some local environment problem, since yesterday the non-minimal version of that same class worked just fine, and now everything fails with that cryptic message.

Any ideas what would case this?

1
  • The error is caused by that rectangle drawing, since uncommenting it removes the errors. Jan 11, 2013 at 8:45

2 Answers 2

13

Jake has already shown the Tikz syntax error that caused the problem but to answer the question about what the error message means (as opposed to how to avoid getting it:-) This is a primitive TeX error caused when you use a "delimited argument". Consider

\documentclass{article}


\def\aaa * #1 *{\typeout{argument is #1}}

\aaa * hello *

\aaa !* goodbye *

\stop

The macro \aaa instead of taking arguments in the usual way \aaa 1 or \aaa{123} takes its argument delimited by two token sequences *_ and _* (using _ as a visible space) note any sequence of tokens may be used between the parameter markers #1, #2, ...

So in the first case

argument is hello

is echoed to the terminal, but in the second case \aaa requires a * as the following token and it is not there, so you get the error message in the subject line:

! Use of \aaa doesn't match its definition.
l.8 \aaa !
          * goodbye *
? x
No pages of output.

While the\def form and delimited arguments are not supported at the top level in LaTeX, it is quite common to use them internally for all sorts of parsing tasks clearly TikZ but also standard latex optional and picture mode arguments using [ ] and ( ) use this kind of definition internally.

1
  • 1
    +1 for knowing about all aspects of TeX, short of TikZ. And for didactic skills.
    – Jake
    Jan 11, 2013 at 9:26
14

You've got a spurious at in your TikZ code. at is only used to place nodes, not as a path command. If you use

\fill [fill=red] (current page.north east) rectangle (current page.south west);%

instead (note I also changed the coordinates), everything works.

1
  • Great answer, thank you. I will however accept Davids answer because it answers the broader question of what causes this type of error message. Jan 11, 2013 at 9:31

You must log in to answer this question.

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