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?
Best Answer
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
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
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: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.