Using source <-> Preview command with project root

The official TeXShop Support Forum.

Using source <-> Preview command with project root

Postby amtravco01 » Tue Oct 19, 2010 9:33 pm

I have a root file containing headers, defines, packages etc. I have made this file the project root ("root.tex"). But I do all my actually writing in another tex file, let's call this "document.tex". When I want to switch from the preview to document.tex, I hit cmd-1 to switch. But often it switches to root.tex instead. I say "often" because the behavior is not consistent. In fact, right now it's working the way I want, but earlier it would switch to root.tex.

Also, if I close root.tex and then LaTeX document.tex, the root.tex file opens. And if I close root.tex, the preview closes with it.

Basically I would like to keep root.tex closed, and be able to switch between document.tex and the preview with cmd-1. If this isn't possible, at least I'd like to switch between document.tex and the preview with cmd-1, even if root.tex must always be open.
Posts: 1
Joined: Tue Oct 19, 2010 9:19 pm

Re: Using source <-> Preview command with project root

Postby Herbert Schulz » Tue Oct 19, 2010 10:04 pm


The problem is that the preview is the pdf of the root, not the included document.

If you have the line

% !TEX root = path/to/root.tex

(where path/to/root.tex is the absolute or relative path from document.tex to root.tex) as the first line of document.tex then you can open document.tex and root.tex will automatically open and minimize. Then, when you typeset document.tex TeXShop will know'' it's supposed to compile root.tex. If you Cmd-Click on a locations either document.tex or the preview (in a part that is coming from document.tex) you will jump to that location in document.tex. But Cmd-1 always goes from the source that was compiled to the preview of the source or visa versa. You could use Cmd-` to cycle through the windows but that may not be satisfactory.
Good Luck,
Herb Schulz
Herbert Schulz
Posts: 1489
Joined: Thu May 12, 2005 2:31 pm

Return to TeXShop (engl.)

Who is online

Users browsing this forum: RobertKnork, Tippylar, Williejet and 1 guest