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





    \keywords{D, P, E}



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
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.
("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)
("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)
("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
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

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
("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d
("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.
LaTeX Info: Redefining \overline on input line 306.
LaTeX Info: Redefining \ldots on input line 378.
LaTeX Info: Redefining \dots on input line 381.
LaTeX Info: Redefining \cdots on input line 466.
LaTeX Font Info:    Redeclaring font encoding OML on input line 566.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 567.
  • 2
    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.
    – jub0bs
    Commented Oct 13, 2013 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. Commented Oct 13, 2013 at 12:13
  • 1
    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.
    – jub0bs
    Commented Oct 13, 2013 at 12:23
  • 2
    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
    Commented Oct 13, 2013 at 13:05
  • 2
    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}. Commented Oct 13, 2013 at 20:09

7 Answers 7


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.

  • 5
    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.
    – GeoffDS
    Commented Nov 10, 2014 at 2:53
  • You can eliminate BOM characters with sed -i "s/\xEF\xBB\xBF//" <filename> or by running :set nobomb in vim. Save with :wq.
    – mazunki
    Commented Oct 22, 2019 at 16:15

I had the same error and simply had to "Trash Aux Files". Saving under a new name and in particular saving under a new name with UTF-8 encoding also worked, but I guess those solutions only distract from what the real issue was in my case.


put the \let-commands before package 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)
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
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
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
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...
    – jub0bs
    Commented Oct 13, 2013 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. Commented Oct 13, 2013 at 12:20
  • I downloaded the class file, moved the two \let before àmsthm` and everything was fine for me. No Error
    – user2478
    Commented Oct 13, 2013 at 12:26
  • @Herbert- Which latex editor are you using? I am using Winedt and Miktex in Windows 7 environment. Commented Oct 13, 2013 at 12:28
  • the editor is not important! I have TeXLibe2013 on Linux. I'll add the file list to my answer.
    – user2478
    Commented Oct 13, 2013 at 12:31

I was using LyX and that kind of error message appeared. The reason was that there was a special character (umlaut) in the path of the .lyx file. Renaming the relevant directory helped.


In my case, the problem was solved by avoiding any empty space in the main file title. It is not a real solution, but it helps.

  • 1
    Welcome to TeX.SX! That should be better a comment, I guess ...
    – Mensch
    Commented Mar 3, 2020 at 9:47

In my case, this error was caused by the incompatibility of the class (osajnl.cls) with the newer version of MiKTeX compiler. After downloading the upgraded version of the class, the MiKTeX compiling went smoothly.


In my case the error was caused by a spurious empty line after \setbeamertemplate{...}:



% ...



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .