Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
The error is caused by that rectangle drawing, since uncommenting it removes the errors. –  Jukka Dahlbom Jan 11 '13 at 8:45
add comment

2 Answers

up vote 9 down vote accepted

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.

share|improve this answer
1  
+1 for knowing about all aspects of TeX, short of TikZ. And for didactic skills. –  Jake Jan 11 '13 at 9:26
add comment

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.

share|improve this answer
2  
+1 for knowing something about tikz:-) –  David Carlisle Jan 11 '13 at 9:15
    
Great answer, thank you. I will however accept Davids answer because it answers the broader question of what causes this type of error message. –  Jukka Dahlbom Jan 11 '13 at 9:31
1  
I wish I could accept 2 answers ;) –  Jukka Dahlbom Jan 11 '13 at 9:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.