Take the 2-minute tour ×
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.

I am a newbie at LaTeX/TeXlipse/TeXShop.

I am currently writing a LaTeX document using TeXlipse plugin in Ubuntu. Due to hardware issues on the Ubuntu machine I need to port the .tex files to TeXShop on a Mac OS X. Since I was using TeXlipse, it had created all the .tex files in a project format. My entry point is document.tex

\begin{document}

%include other pages
\input{./title.tex}
%\input{./certificate.tex}

\input{./abstract.tex}
\input{./acknow.tex}
\pagenumbering{roman} %numbering before main content starts
\tableofcontents
\listoffigures

\newpage
\pagenumbering{arabic} %reset numbering to normal for the main content

\input{./introduction.tex}
\input{./systemarchitecture.tex}
\input{./implementation.tex}
\input{./experimentresults.tex}
\input{./conclusion.tex}
\input{./ref.tex}

\end{document}

When I try to preview this document.tex file I am able to see the corresponding PDF file. But any changes made to the introduction.tex file are not visible. I am not sure if this is because TeXShop does not support this kind of a project structure, or do I have to include all of the data into a single .tex file?

The error I see in the console is as follows:

/introduction.tex:3: LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...       

Since introduction.tex is not another document but the part of a bigger document should I include \begin{document} in every .tex file?

share|improve this question
    
Welcome to TeX.SE. You need a \documentclass statement and your preamble (ie, the \usepackage{} statements before \begin{document}. When you say "changes made to the introduction.tex file are not visible" are you saying that when you recompile document.tex that changes from introduction.tex are not visible? If you do not want to compile introduciton.tex by itself then you don't need the \documentclass, premable, and \begin{document}, \end{document} in introduction.tex. –  Peter Grill Apr 4 '12 at 14:54
    
You should also have a look at [the standalone package]() –  Peter Grill Apr 4 '12 at 15:05
    
@Peter Grill Oops looks like it was a beginner's error, I was compiling the introduction.tex instead of compiling document.tex , I have added the statements you mentioned earlier and it seems to be running fine now. Thank you –  bhavs Apr 4 '12 at 15:06
add comment

1 Answer

In TeXShop, you can add the information of the main file (the one you're actually "compiling") using the pre-processor command:

% !TEX root = mainfile.tex

(substitute "mainfile" for whatever you're calling yours). You can also add directory indications (e.g., ./mainfile.tex).

You should use this pre-processor command in all of your "child" documents (i.e., those which you call with \include or \input from your main file).

In the TeXShop menu, go to Macros->Root->Root, to create the command.

share|improve this answer
add comment

Your Answer

 
discard

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

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