## LaTeX forum ⇒ TeXShop ⇒ TeXShop problems with Forward Search (in Typesetting)

Information and discussion about TeXShop, an integrated LaTeX environment for Mac OS X
nfarnoud
Posts: 5
Joined: Thu Jan 29, 2009 9:47 pm

### TeXShop problems with Forward Search (in Typesetting)

Hi
I use TeXShop 2.18 to write LaTex on my mac system. But I have the following issue in typesetting and am clueless how to solve it!

I have no problem in searching from "preview" to the "source" ( : hold down the command key while clicking at a spot in the Preview window. The source window will become active and the corresponding TeX input commands will be highlighted in yellow). But I can NOT always do the opposite. The issue is that my main source file has a lot of \input sub-sections. If I command+click on a text which is in the "main" text of the original "source file" I CAN see it in the preview (corresponding spot will be circled in red in the preview). But if I select a text that is in one of the sub-section input source files, nothing is selected in the preview! (just rarely some random location in the preview would be selected)

This is a major problem since my document is very large and therefore almost all of my text is in sub-section input files.
I greatly appreciate your help on this!

Typesetting Default Command: LaTex
Typesetting Default Script: Tex+Ghostscript
Sync Method: Sync Tex

Regards,
n.farnoud

Tags:

jjbw
Posts: 2
Joined: Wed Aug 28, 2013 2:31 pm
Did you ever solve this, nfarnoud? I have exactly the same issue currently with a large thesis document, using TexShop 3.23 in Mountain Lion. Would love to hear how to fix it!

jjbw
Posts: 2
Joined: Wed Aug 28, 2013 2:31 pm
In case others have this problem as well: I found the answer in the (excellent) "TexShop Tips and Tricks" document which you can access through the help menu. Saved!

Pasting the text below:

2.4 Working with a Large Document
It is often handy to break a large document into more manageable subordinate parts and then create a “root” file which contains the preamble and \include commands to bring all the parts together for typesetting.
To have TEXShop “know” which file to typeset when working on a subordinate file put the line
`% !TEX root = path/to/rootfile.tex`

at the top of your subordinate file; path/to/rootfile.tex is the relative or absolute path to the root file for this document. Once this is done TEXShop will typeset the root file if you press Type- set → Typeset (Cmd-T) even though you are editing a subordinate file and properly synchronize between the Source and pdf. E.g., if the root file is called mygreatbook.tex and the chapter files, chapter1.tex, etc., are in a chapters sub-folder below the root file then place the line
`% !TEX root = ../mygreatbook.tex`

at the top of each of the chapter files. The ../ means go up one folder level to find the root file.