At Thu, 18 Apr 2002 15:38:53 +1000, Triet Hoai Lai wrote:
> Terry Collins <[EMAIL PROTECTED]> writes:
> > [terryc@owl 2002]$ pdftex 20020417-perm.tex
> > This is pdfTeX, Version 3.14159-13d (Web2C 7.3.1)
> > (20020417-perm.tex[/usr/share/texmf/pdftex/config/pdftex.cfg]
> > Babel <v3.6Z> and hyphenation patterns for american, french, german,
> > ngerman, i
> > talian, portuges, russian, spanish, nohyphenation, loaded.
> > ! Undefined control sequence.
> > l.4 \documentclass
> >                   [a4paper,12pt]{report}
> > ? 
> >
> > And it repeats for every latex command
> 
> pdftex is "equivalent" to tex and can only run with plain TeX.  If your
> LaTeX document doesn't include any EPS/PS, pdflatex should work.  Here is
> template so that you can run both latex and pdflatex:

well spotted. terry should be using the "pdflatex" command, not simply
"pdftex". no wonder it barfs on LaTeX macros.

> %% Preamble
> \ifx\pdfoutput\undefined                % We're not running pdftex
> \documentclass[a4paper,12pt]{report}
> \else
> \documentclass[pdftex,a4paper,12pt]{report}
> %% More options described in pdfTeX manual
> \pdfcompresslevel=9
> \pdfinfo
> { /Title (Title of Document)
>   /Author (Your Name)
>   /Subject (???)                                                      
>   /Keywords (???)
> }
> \fi
> ...
> \begin{document}

i usually end up using the hyperref package with my pdfs, in which
case it does a lot of the above for you (and a few other things like
setting the pdfpagesize, etc). its a useful package to look into if
you plan to do anything exotic with pdftex.

> ...
> %% Example of including figures: pdflatex supports PDF, PNG and JPEG graphics
> \begin{figure}
>   \centering
>   \ifx\pdfoutput\undefined
>   \includegraphics{fig.eps}
>   \else
>   \includegraphics{fig.pdf}                                             
>   \fi                                                                                
>             
> \end{figure}
> ...
> \end{documnent}

and with images, i find it much easier to leave the extension off
completely (ie: \includegraphs{fig}) and let graphics/graphicx find
the most appropriate file for the driver currently in affect. for this
to work you have to tell graphics/graphicx that you want "pdftex" (or
"dvips", etc), either by declaring it as a "global" option (as the
above preamble does), or with: \usepackage[pdftex]{graphics}.

then you just have your Makefile (or whatever) have both .eps and .pdf
versions (for example) of your images available and \includegraphics
will choose the right one.


if you want to know what formats, file extensions, etc are supported
have a look through pdftex.def for where \Gin@extensions is defined.

eg: from my version:

\ifnum\driver@release>3
  \ifnum\driver@release>5
    \def\Gin@extensions{.png,.pdf,.jpg,.mps,.tif}
    \@namedef{Gin@[email protected]}#1{{tif}{.tif}{#1}}
    \@namedef{Gin@[email protected]}#1{{jpg}{.jpg}{#1}}
  \else
    \def\Gin@extensions{.png,.pdf,.jpg,.mps}
    \@namedef{Gin@[email protected]}#1{{jpg}{.jpg}{#1}}
  \fi
\else
  \def\Gin@extensions{.png,.pdf,.mps}
\fi

which looks like it supports (in preference) png, pdf, jpg, mps and
tif - depending on the backend driver version.

(by reading comments earlier in the file, you'll see that .mps is
"metapost output", which can be input directly and converted from the
simple postscript metapost produces to pdf automatically. a damn fine
way of programmatically producing both .eps and .pdf, imo)


\include{random plug for documentation fest coming up in june (15th?)}

-- 
 - Gus
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to