Latex magic comments
It can be a real pain to open files with various character encodings inside TeXShop. Indeed, you basically have to change TeXShop’s settings each time.
Hopefully, I recently came across a little-documented feature that allows you to specify the encoding on a per-file basis: you simply add a metadata (a special TeX comment) at the top of the file to set the encoding, and TeXShop will load and save it accordingly. Use:
for ISO-8859-1 (Latin 1), or:
for UTF-8. Be sure to type exactly that, as TeXShop is case-sensitively picky!
Note: magic comments (or magic markers) alter TeXShop’s default behavior on a per-file basis. These are basically regular TeX comments, but they start with %!, thus they are interpreted by TeXShop if they appear at the top of a file.
Set the character encoding:
%!TEX encoding = IsoLatin
Set the engine (command to be run with the Typeset command, ⌘T):
Set the name of the “main”/“root” file, the one on which to call the typesetting command:
Set the language to be used by the spell-checker:
When using source/PDF synchronization with multiple files, TeXShop is able to spot \include and \input commands in the main file. However this does not work with ConTeXt, so the following command allows one to explicitly reference an included file vis-à-vis TeXShop. Therefore it may be used several times:
%!TEX projectfile = chapter2.tex