I am a newbie when it comes to LaTex and I was trying to modify a template in ShareLaTeX. As soon as I opened it, I got the following error (before compilation):

Emergency stop.

<*> preamble.tex

*** (job aborted, no legal \end found)

Here is how much of TeX's memory you used:
 19261 strings out of 492990
 348512 string characters out of 6132621
 430327 words of memory out of 5000000
 22497 multiletter control sequences out of 15000+600000
 4709 words of font info for 16 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 62i,0n,56p,439b,287s stack positions out of 
!  ==> Fatal error occurred, no output PDF file produced!

Here is the code for preamble.tex for the ShareLaTeX project:


% Language, Encoding and Fonts
% http://en.wikibooks.org/wiki/LaTeX/Internationalization
% Select encoding of your inputs. Depends on
% your operating system and its default input
% encoding. Typically, you should use
%   Linux  : utf8 (most modern Linux distributions)
%            latin1 
%   Windows: ansinew
%            latin1 (works in most cases)
%   Mac    : applemac
% Notice that you can manually change the input
% encoding of your files by selecting "save as"
% an select the desired input encoding. 
% Make latex understand and use the typographic
% rules of the language used in the document.
% Use the vector font Latin Modern which is going
% to be the default font in latex in the future.
% Choose the font encoding
% Graphics and Tables
% http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics
% http://en.wikibooks.org/wiki/LaTeX/Tables
% http://en.wikibooks.org/wiki/LaTeX/Colors
% load a colour package
\definecolor{aaublue}{RGB}{33,26,82}% dark blue
% The standard graphics inclusion package
% Set up how figure and table captions are displayed
  font=footnotesize,% set font size to footnotesize
  labelfont=bf % bold label (e.g., Figure 3.2) font
% Make the standard latex tables look so much better
% Enable the use of frames around, e.g., theorems
% The framed package is used in the example environment

% Mathematics
% http://en.wikibooks.org/wiki/LaTeX/Mathematics
% Defines new environments such as equation,
% align and split 
% Adds new math symbols
% Use theorems in your document
% The ntheorem package is also used for the example environment
% When using thmmarks, amsmath must be an option as well. Otherwise         \eqref doesn't work anymore.

% Page Layout
% http://en.wikibooks.org/wiki/LaTeX/Page_Layout
% Change margins, papersize, etc of the document
  left=28mm,% left margin on an odd page
  right=41mm,% right margin on an odd page
% Modify how \chapter, \section, etc. look
% The titlesec package is very configureable
\titleformat*{\subsubsection}        {\normalfont\normalsize\bfseries\color{aaublue}}
%\titleformat*{\paragraph}    {\normalfont\normalsize\bfseries\color{aaublue}}

% Change the headers and footers
\fancyhf{} %delete everything
\renewcommand{\headrulewidth}{0pt} %remove the horizontal line in the     header
\fancyhead[RE]{\color{aaublue}\small\nouppercase\leftmark} %even page - chapter title
\fancyhead[LO]{\color{aaublue}\small\nouppercase\rightmark} %uneven page - section title
\fancyhead[LE,RO]{\thepage} %page number on all pages
% Do not stretch the content of a page. Instead,
% insert white space at the bottom of the page
% Enable arithmetics with length. Useful when
% typesetting the layout.

% Bibliography
% http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management
% Add the \citep{key} command which display a
% reference as [author, year]
% Appearance of the bibliography

% Misc
% Add bibliography and index to the table of
% contents
% Add the command \pageref{LastPage} which refers to the
% page number of the last page
%  disable, %turn off todonotes
  colorinlistoftodos, %enable a coloured square in the list of todos
  textwidth=\marginparwidth, %set the width of the todonotes
  textsize=scriptsize, %size of the text in the todonotes
% added by KK (ShareLaTeX team)

% Hyperlinks
% http://en.wikibooks.org/wiki/LaTeX/Hyperlinks
% Enable hyperlinks and insert info into the pdf
% file. Hypperref should be loaded as one of the 
% last packages
    linkcolor=aaublue,% you should probably change this to black before printing

Please let me know how to fix it, thanks in advance!!

closed as unclear what you're asking by Kurt, Stefan Pinnow, Raaja, dexteritas, user156344 Apr 3 at 8:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX SX! Unfortunately, the link requires a login. – Bernard Aug 15 '18 at 15:43
  • Welcome to TeX.SX! The sharleatex website requires to log in. Can you try to post the code here? (Edit your question and copy & paste the code here.) – Tom Aug 15 '18 at 15:43
  • Don't use a complex template when you are newbie. Start with a simple document. And don't expect people to debug a project on another site, even more if a login is required. – Ulrike Fischer Aug 15 '18 at 15:44
  • Well the error message says the truth: the document has no legal end command, there is no \end{document} (and also no \begin{document}). You can't compile this unless you add a document body. – Ulrike Fischer Aug 15 '18 at 16:02
  • @UlrikeFischer after adding \begin{document} and \end{document} I get a "PDF Rendering Error: Something went wrong while rendering this PDF." – Shivani Aug 15 '18 at 16:09