Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When I compile my document with latex on the terminal, there is no problems. Everything is fine. However, When I try it via Emacs (Cntrl C-C, which makes a call to Latex) I get the folowing error saying:

Missing \begin{document}

I'm a little confused. What happens?

Here is an example:

\documentclass[onecolumn,amsmath,amssymb,aps,pra,floatfix,]{revtex4-1}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{float}
\usepackage[tight,footnotesize]{subfigure}
\usepackage{color}
\begin{document}
\title{Title}
% \author{Totoro}
\date{\today}
\maketitle

\section{Introduction}

We consider the simplified equation of motion.

\end{document}

Here how it looks like: enter image description here

As I said, compiling the document with latex from a terminal works fine. Normally, I use Emacs for editing and compiling. So this strange behavior is extremly inconvient!

share|improve this question
What route are you using from the command line? And what is the key binding '\C-c\C-c' set to? Is it running the same command your calling from the command line? – A.Ellett Jan 13 at 5:03
2  
If, when you write your document, you use multiple files, it could be the case that you're trying to compile from a file which is not the master file. – A.Ellett Jan 13 at 7:24
We really need a minimal (not) working example here. On a well-formed document, what you describe should work. – Tyler Jan 13 at 13:14
Your MWE works for me both on the command line and when called from emacs. I'd have to say that problem probably has something to do with the way you've configured emacs (custimizations etc.). You might have some stray mark in your file that you didn't copy into the above MWE that is getting in the way. Sorry I can't help you more. – A.Ellett Jan 13 at 18:09
Re @A.Ellett: You can add some lines at the end of the (La)TeX file to tell it where the master is. It is 4 lines: %%% Local variables://%%% mode: latex//%%% TeX-master: masterfile//%%% End: (the "//" represent newlines). For the masterfile, it says t instead of its name. – vonbrand Jan 19 at 1:58
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.