[OS X TeX] some questions on Texshop

Herbert Schulz herbs at wideopenwest.com
Tue Dec 29 12:13:54 CET 2009

On Dec 29, 2009, at 1:05 AM, Per Ting wrote:

> I have recently started using Texshop (2.29 with TL09). I am working on a book with many chapters used with \input on the root file. I have the following problems/questions.
> 1-I use .eps, psfrag, and pstricks in my file. The preferred method should be using dvi-ps-pdf path. I have followed the instructions for using latexmk (and pst-pdfmk), copied the necessary files into the ~/Library/Texshop/bin and adde % !TEX TS-program=latexmk to my root file, but typesetting does not invoke bibtex and makeindex and goes staring to generate p.s. and pdf file. I expect first dvi file be generated then bibtex bad makeindex be run, then another round of latex and finally dvips and pstopdf. Another indication of a problem is that although after moving the files I have closed and reopened teashop, latexmk and pst-pdfmk are not in the drop down menu of the source file.


If you are using .eps, psfrag and pstricks in your file using latex->dvips->ps2pdf is definitely the way to go. You say you moved the ``necessary files to ~/Library/TeXShop/bin/'' can you tell me what files you moved there and where they came from? The necessary files in that directory should already be there and you should be moving .engine files from ~/Library/TeXShop/Engines/Inactive/Latexmk/ two directory up to ~/Library/TeXShop/Engines/. These are the engine files used by TeXShop. When you restart TeXShop they should show up in the pop-up menu in the Source and Preview toolbars. Finally, the line you want at the top of the file is

% !TEX TS-program = latexmk

with the space on either side of the `=' sign. While other spaces don't seem to matter those seem to be important.

> 2-When I run latex and bibtex and makeindex and latex again manually I get the the desired result but sync between source and pdf does not work precisely. Direct sync (from source to pdf) works OK but inverse sync is off by a couple of paragraphs or even more. Interestingly enough, if I run the sequence in Texworks and then load the source into texshp, sync works alright! Also if instead of dvi-ps-pdf path I use pdflatex and include auto-pst-pdf, sync works OK.

Make sure that you have TeXShop->Preferences->Typesetting->Sync Method set to SyncTeX. My experience is that TeXworks will get to the right paragraph (unless you use hard wrapping within paragraphs---I use soft wrapping) and that's all while TeXShop attempts to do better. Most of the time TeXShop does an amazing job of finding the right couple of words but if the words are repeated close by it sometimes is off a bit. Try clicking a word or two down.

> 3-How can I open the \inputted chapters from the root source file? On a PC with winedt I double clicked on the word \input and it opened the file in a tab. In texshop it seems that I have to use file>open... which is not as convenient and then it opens the file in a new window not in a new tab. Is there a way to change this?

There is a macro for doing that but I'm not sure if it's part of the default macros (I've been using TeXShop for 8 years and have collected many macros). Look for a macro called Open Selection. I can send it to you if you don't have it. You select the file name in the input (or include, usepackage, etc.), including the path if necessary (the macro will find the file if kpsewhich can find it in the standard places) and the macro opens the file.

> 4-To be able to use sync (or simply to run latex) from within a chapter that has been used in the root file by \input I have to set the root file for that chapter using file>set project root. This is also inconvenient since has to be done for each chapter. Is there a way to set the root file globally for a project?
> Thanks

Each of the input or included files should have a line

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

(again, with the spaces) placed at the top of the file. The `path/to/root.tex' can be an absolute or relative path; e.g., if `chap1.tex' is in the folder `subdir' just below the `mybook.tex' root file
i)mybook.tex should have the line




and ii)the chap1.tex file should have the line

% !TEX root = ../mybook.tex

and when you typeset (Cmd-T) from either mybook.tex or chap1.tex the file will properly get compiled according to the rule you've set in (e.g., latexmk) mybook.tex. Oh... once things are set up this way opening chap1.tex will automatically open and minimize (to the Dock) mybook.tex.

Hope this helps get you going.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

More information about the macostex-archives mailing list