1

Interesting point is that until yesterday I ran this code easily without getting any error but suddenly it keep sending the error of missing begin document. I see some similar question and it was suggested to copy the file as some special format and I don't know how to do that. My file has multiple chapters and I type other part of my works in 5 other latex file. Would you please help me with that? thanks Here is my code:

\documentclass[pdftex,12pt]{report}
% all required packages
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}

\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[document]{ragged2e}


\renewcommand{\chaptermark}[1]{%
           \markboth{#1}{\thechapter\ #1}}
\renewcommand{\sectionmark}[1]{%
            \markright{\thesection\ #1}}


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\pagestyle{fancy}
\setcounter{page}{1}
\pagenumbering{roman}
\cleardoublepage
\pagestyle{fancy}
\setcounter{page}{1}
\pagenumbering{arabic}
    \chapter{Introduction}
    \input{A-Introduction/Introduction}
    \chapter{Preliminaries and Notions}
    \input{B-Preliminaries/Preliminaries}
    \chapter{Backbone Colouring}
    \input{C-Studysofar/Studysofar.tex}
    \chapter{Algorithm for Finding Backbone}
    \input{D-Mine/Mine.tex}
    \chapter{Conclusion}
    \input{E-Conclusion/Conclusion.tex}

\doublespacing
\listoffigures
\addcontentsline{toc}{chapter}{Table of Figures}
\end{document}

and here is the error that I got, I copy and paste the part of it:

   ! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 +
% Copyright (c) 2012
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no + in font nullfont!
Overfull \hbox (20.0pt too wide) in paragraph at lines 1--5
[]
[]
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\report.cls"
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size12.clo"
File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
  • 2
    Please reduce your code to a minimal example that reproduces the problem. That will make it easier for others to help you. – Ian Thompson Jun 12 '15 at 15:32
  • 1
    Ok, you can see the error follow this proccess: make a copy of your file, and add the code little by little (running the code) until appears some error. – juanuni Jun 12 '15 at 15:33
  • 2
    You have posted your (far too long) example twice and not posted the error message. after "and here is the error that I got, I copy and paste the part of it:" – David Carlisle Jun 12 '15 at 15:40
  • 1
    What does this mean: "Actually when I run each of these 5 files separately everything is fine."? Do the \input-ed files work on their own? If so, you probably can't simply \input them.... – jon Jun 12 '15 at 15:47
  • 1
    The error message clearly shows the problem you have a stray + before the copyright comment – David Carlisle Jun 12 '15 at 15:53
9

You have a + on line one of your file which is not in a comment so TeX tries to typeset it before the \documentclass (and before \begin{document}). Hence the error message.

| improve this answer | |
  • An accidental click. Not sure how that happened. I'll remove it when I can. – Ian Thompson Jun 12 '15 at 16:45
  • @IanThompson If David edits this, you'll be able to reverse the damage :) Perhaps a MWE could be added that shows the obvious problem and produces the same error. – Sean Allred Jun 12 '15 at 17:16
  • @IanThompson :-) – David Carlisle Jun 12 '15 at 19:22
  • @DavidCarlisle --- I blame these GUI driven websites. If only everything worked using emacs shortcuts... – Ian Thompson Jun 12 '15 at 19:29
  • @IanThompson bring back w3-mode .. – David Carlisle Jun 12 '15 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.