Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\includegraphics causing "treated as zero" error

1,134 views
Skip to first unread message

CoyoteBoy

unread,
Sep 3, 2007, 9:45:54 AM9/3/07
to
I'm throwing in a logo at the beginning of my document and getting
errors, but I cant see what I'm doing wrong - can anyone point me out
the fault?
______________________________
\begin{document}

\setcounter{page}{0}
\pagenumbering{empty}

\includegraphics[width=100mm,height=20mm,angle=0]{logo.pdf}

\frontmatter
\chapter{Abstract}
___________________________

[PDFLaTeX] finished with exit status 1
./thesis.tex:45:Missing number, treated as zero. \frontmatter

If I remove the includegraphics it runs through fine. Where am i going
astray?!

José Carlos Santos

unread,
Sep 3, 2007, 10:07:01 AM9/3/07
to

This has nothing to do with the \includegraphics command. You will get
the same error if you compile this file:

\documentclass{book}


\begin{document}
\setcounter{page}{0}
\pagenumbering{empty}

a
\frontmatter
\chapter{Abstract}
test
\end{document}

The problem is that you are trying to put some material *before* the
\frontmatter command. This works fine:

\documentclass{book}
\usepackage{graphicx}


\begin{document}
\setcounter{page}{0}
\pagenumbering{empty}

\frontmatter
\includegraphics{logo.pdf}
\chapter{Abstract}
test
\end{document}

Best regards,

Jose Carlos Santos

CoyoteBoy

unread,
Sep 3, 2007, 10:25:27 AM9/3/07
to


Ahhh that makes sense :) Thanks, it now works! Sometimes I think i
left my brain in bed!

Heiko Oberdiek

unread,
Sep 3, 2007, 4:41:48 PM9/3/07
to
CoyoteBoy <james....@gmail.com> wrote:

Nonsense makes more sense. ;-)

The problem is \pagenumbering{empty}, because
"empty" isn't a valid numbering style. From latex.ltx:

\def\pagenumbering#1{%
\global\c@page \@ne
\gdef\thepage{%
\csname @#1\endcsname \c@page
}%
}

\thepage becomes to \@empty\c@page. Accidently "\@empty" isn't defined
as empty macro:

\def\@empty{}

\frontmatter starts with \cleardoublepage, thus a page is output
if there is some text before. Depending on the page style \thepage
is called in the header or footer.
Thus the lonely page count register \c@page remains. TeX now
expects an assignment, but cannot find a number and throws
the error message.

Using "gobble" instead of "empty" would call \@gobble that
just eats the next argument and \c@page vanishes.
But instead of such dirty tricks there are officially documented ways
for suppressing the page number, e.g. \(this)pagestyle{empty}.

Yours sincerely
Heiko <ober...@uni-freiburg.de>

0 new messages