# [OS X TeX] Encoding Directive

Herbert Schulz herbs at wideopenwest.com
Mon May 21 08:14:15 EDT 2018

> On May 21, 2018, at 6:51 AM, Néstor E. Aguilera <nestoreaguilera at gmail.com> wrote:
>
>
>
>> On 19 May 2018, at 14:06, Herbert Schulz <herbs at wideopenwest.com> wrote:
>>
>> Howdy,
>>
>> Many Editors that folks use as a front end for TeX processing have a directive (a command that is used by the Editor itself rather than by TeX when typesetting a document) to let the Editor know' the encoding of the input source file. E.g., TeXShop uses
>>
>> % !TEX encoding = ...
>>
>> (where ... is from a list of encodings understood by TeXShop). While other Editors use directives that are placed at the end of the file, after the \bye' or \end{document}' line. Finally there are Editors that use heuristics to try to determine the encoding of a given files with easy access to be able to reload the file with a different encoding if the choice is incorrect.
>>
>> I know that there are other Editors that use the
>>
>> % !TEX encoding = ...
>>
>> style directive (with different list than TeXShop(?)). Since I use TeXShop for almost all my Editing needs right now I'm wondering if others on the list would let me know other Editors that use this type of directive; e.g., I know TeXworks does.
>>
>> Good Luck,
>>
>> Herb Schulz
>> (herbs at wideopenwest dot com)
>
> I was hoping someone else with more knowledge would answer.
>
> I don't really understand the question:
>
> - I have worked very little and a long time ago with Emacs, where you may declare at the beginning the file encoding, but I am sure you knew this. I don't know whether vi or other Unix editors have a similar declaration, and I don't know why TeXShop doesn't adhere to this convention.
>
> - I know TeXworks, TeXStudio and similar software based on TeXShop use the "% !TeX..." convention, but I thought the were meant for the tex compiler rather than the text file.
>
> TeXStudio "magic comments" are described in the manual <http://texstudio.sourceforge.net/manual/current/usermanual_en.html#SECTION_TEXCOM>. I don't know whether the are the same as TeXShop's.
>
> - I work mostly with BBEdit + Sneep's scripts for TeX. I do it to have just one text editor for tex, python, html, etc. BBEdit's manual shows several ways of telling what the file encoding is, including the Emacs directives and heuristics. For html files it also follows the "encoding=" or "<meta charset=>" directive, but I don't know whether it follows the "\usepackage[...]{inputenc}" directive in tex files. Also, I don't know what it does in case of conflict (say a conflicting emac's directive vs. actual encoding found by heuristics).
>
> Regards,
>
> Néstor

Howdy,

Thank you for the information. I certainly didn't know that TeXStudio accepts the % !TEX encoding = ' type directive. I didn't spend much time searching the manual but a list of encoding names used with that directive by TeXStudio would be useful.

From what I understand (not much!) TeXStudio is derived from TeXmaker. Does that mean the TeXmaker also accepts that directive?

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)