"Undefined control sequence" at beginning of any simple document
Each LaTeX
document has basically this structure (which will not run though, since packageA
and packageB
are not valid packages (as far as I know!)
\documentclass{book} % Replace book with some other class
\usepackage{packageA} % Load package named packageA
\usepackage{packageB} % Load package named packageB
% Some other definitions to follow, i.e. user defined counters, lengths
\begin{document}
% Typesetting and other code
\end{document}
This can't be compiled with pdftex
-- Use either latex
, pdflatex
, xelatex
or lualatex
for this.
Each of the commands above are LaTeX
format additions, completely unknown to pdftex
and its variants, so pdftex
stops at \documentclass
already.
Packages always must have the ending .sty
, so e.g. hyperref.sty
, it's sufficient to use \usepackage{hyperref}
then.
It is possible to load code contained in other files than having the .sty
extension by saying \input{foo}
(foo.tex
is another ASCII - file then) basically at any position in the document, either in the preamble or in the document body.
The part including \documentclass
downto \begin{document}
is called preamble, the part between \begin{document}...\end{document}
is the document body. Typesetting is allowed in the body only. Preamble commands like \documentclass
, \usepackage
etc. mustn't be used in the body.
The above document would not do anything so far (depending on the packages of course)