Since I spent some time figuring out how to make Emacs and TeXShopinteract the way I want, I figured I might as well post and recordwhat I've done.
I use teTeX as installed by Gerben Wierda's i-installer. For the altpdflatex process you need to have Ghostscript and dvips installed. I use 'altpdflatex' which is a shell script written by Wierda. ![TeXShop TeXShop](/uploads/1/1/8/3/118304804/691336449.png)
Texshop Tutorial
What I'm using
- TeXShop, version 2
- teTeX, as imported by Gerben Wierda's i-installer. This includesthe standard tools like gs, imagemagik, etc.
- Carbon Emacs with auctex
Goals
- Use emacs to edit, teTeX to process and TeXShop to view.
- Use a short keyboard command to typeset.
- Have the output automatically update.
- Be able to process with pdflatex or altpdflatex (the latter means latex source -> dvi -> PostScript -> pdf)
If you mean you downloaded the latest TeXShop 2.10beta8 and ``moved the Engine folder and (re)started TeXshop.' The three engine files ((xe/pdf)latexmk.engine) should be in your / Library/TeXShop/Engines/ folder. The four files, (xe/pdf)latexmkrc files and latexmk, should be placed in the /Library/TeXShop/bin/ folder. TeXShop is distributed under the GPL public license, GPLv2, and thus free. TeXShop (v 4.62) requires Mac OS X 10.12 or later TeXShop (v 4.44) requires Mac OS X 10.10 or later TeXShop (v 2.47) requires Mac OS X 10.4.3 or later RSS feed.
Crucial featurs
When TeXShop (version 2) is properly configured, it will watch a pdf file, and re-open the file if it changes. There does not appear to be any other way to automatically have TeXShop process/reprocess/update a file if it's been changed by an external program. Thus, all the commands need to be issued by Emacs and need to result in a pdf file. Again, I want as much of this to be automated as possible.
TeXShop settings
In the preferences for TeXShop, under the 'Preview' pane, check the button for 'Automatic Preview Update'. (I don't think it matters if you also check the 'Configure for External Editor' button on the Document pane.)Backend tools
![TeXShop TeXShop](/uploads/1/1/8/3/118304804/894514283.png)
Thus, if I type 'altpdflatex foo.tex' at a command line, latex is run first, then dvips is run on the dvi file, then ps2pdf is run on the PostScript file; the dvi and the PostScript files are removed. The 'altpdflatex' script should run on any unix system (it is available at CTAN).
Emacs
After all of the above, it is clear that the goalsare just to get keyboard commands for Emacs to run 'pdflatex' or'altpdflatex' on the main file. In plain emacs this is done bybinding an emacs command (I forget what it's called, something like'tex-master-document) to the command line command. In Emacs withauctex I found that the easiest way is to add a new command to the command menu, and then call this with the keyboard. The .emacs file already contains the following line:
Texshop Download
![TeXShop TeXShop](/uploads/1/1/8/3/118304804/691336449.png)
This creates a line in the 'Command' menu with an item called 'pdfLaTeX'. This menu item runs the command 'pdflatex' on the main tex file, represented by %t.
Texshop Headphone System
Thus, I want to add two lines like the above. One which runs 'altpdflatex' and one which opens the pdf file in TeXShop.
Here are the first lines I added in my .emacs file (withinthe command menu list):
Now, I want keyboard shortcuts which call the menu items 'altpdf','pdfview' and 'pdfLaTeX'. For some reason in auctex the way I figureout how to do this is to use an intermediate step of creating afunction, which is then bound to a keyboard command. For thekeyboard commands I used C-t (i.e. control-t) and M-t (i.e. meta-t,or Apple-t). This clobbers pre-existing emacs keyboard commands for'twiddle', i.e. for reversing two adjacent letters (for C-t) and forreversing two adjacent words (for M-t). I don't mind losing thesecommands; if you do then pick a different keyboard shortcut.
Here's what I added to create the keyboard shortcut M-t for'pdflatex' (these lines are not added to the command menu list, justadd them to the file after the list somewhere):
For 'altpdflatex' I created a very similar entry:
Finally, I created a (better for me) keyboard shortcut for saving afile:
Note that this keyboard shortcut only works (in my version of Emacsanyway) in major modes. Thus, for plain text files it does not work.The reasons why Emacs does this are beyond me; but things like this(so-called global settings not working in certain modes) are a featureof Emacs which I continue to find very frustrating.
You might wonder why I bothered to do this since Emacs has C-x C-s.Well, (1) I don't think something I do as often as save my tex fileshould require two keyboard commands and (2) I use the dvorak keyboard(actually a dvorak keyboard with further modifications to maketex-ing easier) and 'x' and 's' are on different hands, so 'C-x C-s'is not at all convenient for me to enter.
How I use it
- Open a tex document in emacs.
- When ready save it with M-s; tex it with M-t or C-t.
- If the pdf file is already open in TeXShop, then TeXShop will automatically update the display when the pdf file is written.
- If the pdf file is not already open in TeXShop, then I choose 'pdfview' from the Command menu. Note that I only need to use the menu once.