[Tex/LaTex] LaTeX Error-Missing Begin Document

errors

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
ishmax, welsh, loaded.
(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)
)
\Gread@gobject=\count79
))
\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
)
\inf@bad=\count80
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

Best Answer

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

The document encoding can be checked with e.g. Notepad++ (Encoding tab). Also, you may convert to UTF-8 with Notepad++ with Encoding -> Convert to UTF-8.

Related Question