Quantcast
Viewing latest article 7
Browse Latest Browse All 26

When and why should I use % !TEX TS-program and % !TEX encoding?

Occasionally, I see other people’s documents starting with two lines like that:

% !TEX TS-program = xelatex
% !TEX encoding = UTF-8 Unicode

It’s clear to me that the first line declares the engine that should be used for compilation, and the second lines states the text encoding of the input file. It’s not clear to me, however, when and why I should use such expressions.

More detailed questions on this subject matter would be:

  • How can I compile without determining which engine I want to use so that I would even need that comment?
  • Which editors/programs pick up on these directives?
  • Who introduced them?
  • Is there any “documentation” of possible values etc.? Are there more such expressions? Are they standardized in any way?
  • Can I add options to the compilation engine, e.g. pdflatex -enable-write18 or xelatex -interaction=nonstopmode?
  • What does the “TS” in TS-program stand for?
  • What additional value does the encoding line provide if I’m already using inputenc?
  • Are there any downsides to using them or reasons not to use them?

Meta: Even though it technically contains multiple questions, I’m pretty sure this question conforms with our standards as a catch-all question on a narrow topic. I guess I know some partial answers to some of my questions, but I’ll leave that up for people who have experience with these expressions. I just wanted to provide a question that allows for a maximal amount of information on this subject matter.


Viewing latest article 7
Browse Latest Browse All 26

Trending Articles