## LaTeX forum ⇒ TeXworks ⇒ what's the meaning of % !TEX?

Information and discussion about TeXworks, an integrated LaTeX environment for several platforms
yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

### what's the meaning of % !TEX?

`% !TEX TS-program = pdflatex% !TEX encoding = UTF-8 Unicode`

These are the first two lines of "template article.tex". I know they are comments. Can someone explain them?

LaTeXguide.org • LaTeX-Cookbook.net

Stefan Kottwitz
Posts: 9880
Joined: Mon Mar 10, 2008 9:44 pm

### what's the meaning of % !TEX?

Hi yaozhao,

welcome to the forum!

That's "meta data" compiler information. It's no TeX and no LaTeX instruction. From LaTeX's point of view, it's just a comment, since it starts with %. There are LaTeX editors that support compiler information in documents, provided within comments, such as here.

Here, it's information for the TeXshop editor (TS) on Mac PCs or Macbooks. The first line means, that the pdfLaTeX compiler shall be used, and the second lines determines that utf8 unicode should be used, for the TeX compiler.

Other editors (and compilers) would ignore those lines. And it's pretty default anyway.

Sometimes a template author wants to define the way the template is used/compiled, as here. Like preventing accidental use of XeLaTeX or LuaLaTeX or a non-standard encoding. These two lines say something like "use default common settings".

Stefan

yaozhao
Posts: 57
Joined: Sat Oct 27, 2018 10:38 pm

### what's the meaning of % !TEX?

Hi Stefan,

Thank you for your reply. In the template article, I notice that some comments starting from %, while other comments starting from %%%.

Can you explain the difference?

Johannes_B
Site Moderator
Posts: 4183
Joined: Thu Nov 01, 2012 4:08 pm

### what's the meaning of % !TEX?

There is no difference. One percent sign starts a comment.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Stefan Kottwitz
Posts: 9880
Joined: Mon Mar 10, 2008 9:44 pm

### what's the meaning of % !TEX?

Johannes is right! Just by the way, some people use more %%%%% signs just to mark comments better visible or to highlight information in the code or "borders", such as

```\frontmatter
some code
some text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%     here the front matter ends     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mainmatter
\section{One}```

After a single % that starts a comment, it doesn't matter. And some LaTeX editors highlight comments in a different way.

Stefan