# LaTeX Error-Missing Begin Document

Below is the LaTeX code for which I am getting the LaTeX error missing \begin document{}. How can I resolve this error?

 \documentclass{acm_proc_article-sp}
\usepackage{algorithmic}
\usepackage{soul}
\usepackage[english]{babel}
\usepackage{setspace}
\usepackage{psfrag}
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{amssymb,amsmath}
\usepackage{graphicx}
\usepackage{footmisc}
\usepackage{cases}
\usepackage{verbatim}
\usepackage{fancyhdr}
\usepackage{color}
\usepackage{url}
\usepackage[capitalize]{cleveref}
\usepackage{placeins}
\usepackage{subfigure}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{moreverb}
\usepackage{paralist}
\let\proof\relax
\let\endproof\relax

\def\nref#1{(\ref{#1})}
\def\figref#1{Fig.~\ref{#1}}
\def\Dirfig{./Figures/}

\begin{document}
\title{}
\maketitle
\begin{abstract}

\end{abstract}

\keywords{D, P, E}

\bibliographystyle{plain}

\bibliography{allcomm}
\end{document}


Here is what I get by using \filelist in the log file

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2013.10.13)  13 OCT 2013 07:50
entering extended mode
**e2sc.tex
(F:\phases4en\trunk\PowerAwSC13\e2sc.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, afrikaans, ancientgreek, ar
abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
lician, german, german-x-2012-05-30, greek, gujarati, hindi, hungarian, iceland
ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
german-x-2012-05-30, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
(F:\phases4en\trunk\PowerAwSC13\acm_proc_article-sp.cls
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\epsfig.sty"
Package: epsfig 1999/02/16 v1.7a (e)psfig emulation (SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.

("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty"
Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO)
)
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty"
Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
)
))
\Gin@req@height=\dimen102
\Gin@req@width=\dimen103
)
\epsfxsize=\dimen104
\epsfysize=\dimen105
)
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty"
Package: amssymb 2013/01/14 v3.01 AMS font symbols

("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\@emptytoks=\toks15
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Overwriting math alphabet \mathfrak' in version bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
))
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"
Package: amsmath 2013/01/14 v2.14 AMS math features
\@mathmargin=\skip41

For additional information on amsmath, use the ?' option.
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amstext.sty"
Package: amstext 2000/06/29 v2.01

("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks16
\ex@=\dimen106
))
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen107
)
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty"
Package: amsopn 1999/12/14 v2.01 operator names
)
LaTeX Info: Redefining \frac on input line 210.
\uproot@=\count81
\leftroot@=\count82
LaTeX Info: Redefining \overline on input line 306.
\classnum@=\count83
\DOTSCASE@=\count84
LaTeX Info: Redefining \ldots on input line 378.
LaTeX Info: Redefining \dots on input line 381.
LaTeX Info: Redefining \cdots on input line 466.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen108
LaTeX Font Info:    Redeclaring font encoding OML on input line 566.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 567.
\macc@depth=\count85
\c@MaxMatrixCols=\count86
\dotsspace@=\muskip1

-
Please edit your question and add a link to the class file you are using. With this class file, your code does return an error, but not the one you mention. –  Jubobs Oct 13 '13 at 12:10
acm.org/sigs/publications/acm_proc_article-sp.cls is the class file. I get this error while performing pdflatex in miktex. –  Vaibhav Sundriyal Oct 13 '13 at 12:13
I cannot reproduce the error you're getting. I do get an error, but the one I get is command \proof already defined, which is an easy one to fix. Please make sure the code you posted here is exactly the one you're working with. It's important that we can reproduce the error you report; otherwise, we won't be able to help you. –  Jubobs Oct 13 '13 at 12:23
Are you sure you need all those packages? Load only those that you really need; I'm referring in particular to setspace that shouldn't be used with that class, as it's intended for submissions to ACM and they will use the leading they want and to psfrag; surely epsfig is not to be loaded as it exists just for backwards compatibility with older documents. –  egreg Oct 13 '13 at 13:05
You are missing \usepackage{kitchen-sink}. Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Martin Schröder Oct 13 '13 at 20:09

Try saving the document as utf-8. Chances are it has been saved with some invisible BOM characters that confuse the parser.

-
I found this thread by googling because I have this same problem. I have spent an hour looking for an error somewhere but I can't find it and my text is spilling off a page, some text is missing. Your answer solved it. –  Graphth Nov 10 '14 at 2:53

put the \let-commands before package amsthm:

...
\let\proof\relax
\let\endproof\relax
\usepackage{amsthm}
...


However, it lokks like that you do not need the ams package. My filelist, you'll get it with \listfiles as first line. It is at the end of your logfile:

*File List*
acm_proc_article-sp.cls 2009/04/22 - V3.2SP - based on esub2acm.sty <23 Apri
l 96>
epsfig.sty 1999/02/16 v1.7a (e)psfig emulation (SPQR)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
amssymb.sty 2013/01/14 v3.01 AMS font symbols
amsfonts.sty 2013/01/14 v3.01 Basic AMSFonts support
amsmath.sty 2013/01/14 v2.14 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
latexsym.sty 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
t1aer.fd 1997/11/16 Font definitions for T1/aer.
algorithmic.sty 2009/08/24 v0.1 Document Style algorithmic'
ifthen.sty 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
soul.sty 2003/11/17 v2.4 letterspacing/underlining (mf)
babel.sty 2013/05/16 v3.9f The Babel package
english.ldf 2012/08/20 v3.3p English support from the babel system
setspace.sty 2011/12/19 v6.7a set line spacing
psfrag.sty 1998/04/11 v3.04 PSfrag (MCG)
footmisc.sty 2011/06/06 v5.5b a miscellany of footnote facilities
cases.sty 2002/05/02 ver 2.5
verbatim.sty 2003/08/22 v1.5q LaTeX2e package for verbatim enhancements
fancyhdr.sty
color.sty 2005/11/14 v1.0j Standard LaTeX Color (DPC)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
cleveref.sty 2013/03/22 v0.18.9 Intelligent cross-referencing
placeins.sty 2005/04/18 v 2.2
subfigure.sty 2002/03/15 v2.1.5 subfigure package
subfigure.cfg
multirow.sty
makecell.sty 2009/08/03 V0.1e Managing of Tab Column Heads and Cells
array.sty 2008/09/09 v2.4c Tabular extension package (FMi)
amsthm.sty 2004/08/06 v2.20
moreverb.sty 2008/06/03 v2.3a more' verbatim facilities
paralist.sty 2013/06/09 v2.4 Extended list environments
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
umsa.fd 2013/01/14 v3.01 AMS symbols A
umsb.fd 2013/01/14 v3.01 AMS symbols B
ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
***********

-
But... the class file defines a proof environment. If the OP does what you suggest, s/he won't have access to it anymore. S/he'd better save that proof environment as acmproof or something before overwriting it... –  Jubobs Oct 13 '13 at 12:20
@Herbert- Does not work. I did not have the algorithmic package and after downloading it(cbrc.jp/~tominaga/translations/gsl/gsl-1.6/algorithmic.sty) , I have been getting this error. The code was working just fine on my previous machine. –  Vaibhav Sundriyal Oct 13 '13 at 12:20
I downloaded the class file, moved the two \let before àmsthm and everything was fine for me. No Error –  Herbert Oct 13 '13 at 12:26
@Herbert- Which latex editor are you using? I am using Winedt and Miktex in Windows 7 environment. –  Vaibhav Sundriyal Oct 13 '13 at 12:28
the editor is not important! I have TeXLibe2013 on Linux. I'll add the file list to my answer. –  Herbert Oct 13 '13 at 12:31

You should have class package : acm_proc_article-sp and you should type your code like this :

% THIS IS SIGPROC-SP.TEX - VERSION 3.1
% WORKS WITH V3.2SP OF ACM_PROC_ARTICLE-SP.CLS
% APRIL 2009
%
% It is an example file showing how to use the 'acm_proc_article-sp.cls' V3.2SP
% LaTeX2e document class file for Conference Proceedings submissions.
% ----------------------------------------------------------------------------------------------------------------
% This .tex file (and associated .cls V3.2SP) *DOES NOT* produce:
%       1) The Permission Statement
%       2) The Conference (location) Info information
%       3) The Copyright Line with ACM data
%       4) Page numbering
% ---------------------------------------------------------------------------------------------------------------
% It is an example which *does* use the .bib file (from which the .bbl file
% is produced).
% REMEMBER HOWEVER: After having produced the .bbl file,
% and prior to final submission,
% you need to 'insert'  your .bbl file into your source .tex file so as to provide
% ONE 'self-contained' source file.
%
% Questions regarding SIGS should be sent to
%
% Questions/suggestions regarding the guidelines, .tex and .cls files, etc. to
% Gerald Murray ---> murray@hq.acm.org
%
% For tracking purposes - this is V3.1SP - APRIL 2009

\documentclass{acm_proc_article-sp}

\begin{document}

\title{A Sample {\ttlit ACM} SIG Proceedings Paper in LaTeX}
\subtitle{[Extended Abstract]}

\numberofauthors{4}
\author{
\alignauthor
Author One\titlenote{Now on postdoctoral fellow at ABC University}\\
\email{author.one@emails.com}
\alignauthor
Author Two\\
\email{author.two@emails.com}
\and % go to new row
\alignauthor
Author Three\\
\email{author.three@emails.com}
\alignauthor
Author Four\\
\email{author.four@emails.com}
}

\date{20 April 2013}

\maketitle
\begin{abstract}
Abstract text. Abstract text. Abstract text. Abstract text. Abstract text. Abstract text. Abstract text.
\end{abstract}

\category{H.4}{Information Systems Applications}{Miscellaneous}
%A category including the fourth, optional field follows...
\category{D.2.8}{Software Engineering}{Metrics}[complexity measures, performance measures]

\terms{Theory}

\keywords{ACM proceedings, \LaTeX, text tagging} % NOT required for Proceedings

\section{Introduction}
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.

Citation of Einstein paper~\cite{Einstein}.

\section{Results and Discussions}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\bibliographystyle{abbrv}
\bibliography{sample}

%\balancecolumns

\end{document}