TeXShop's magic comments
Le vendredi 20 mai 2011 à 22:55 - Lien permanent
I once wrote a note on how to set the character encoding of a file in TeXShop, using a “magic comment”. As the information on the topic of TeXshop's magic comments is very scarce on the web, here is a compilation of the magic comments I know of.
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 = UTF-8 Unicode %!TEX encoding = IsoLatin
Set the engine (command to be run with the Typeset command, ⌘T):
%!TEX TS-program = context
Set the name of the “main”/“root” file, the one on which to call the typesetting command:
%!TEX root = main_file_of_my_phd.tex
Set the language to be used by the spell-checker:
%!TEX spellcheck = de-DE
When using source/PDF synchronization with multiple files, TeXShop is able to spot
\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 = chapter1.tex %!TEX projectfile = chapter2.tex
Main source: TeXShop version history.