Jesteś w: Start / Przedsięwzięcia/Projects / TeX Pearls / 2009 Pearls / arthur-reutenauer / bachotex2009-arthur-reutenauer-pearl1.tex

bachotex2009-arthur-reutenauer-pearl1.tex

TeX document icon bachotex2009-arthur-reutenauer-pearl1.tex — TeX document, 1 KB

Zawartość pliku

%%% UTF-8 support detection

% When you need to detect if you are running an extension of TeX that supports
% UTF-8 input, you can use an extensive approach by making the list of engines
% that could be concerned, and check for particular control sequences like
% \XeTeXversion for XeTeX, or \directlua for \LuaTeX.  But you can also simply
% check for UTF-8 directly, by counting the bytes:

% Take Τ, the letter Tau from the Greek alphabet, not the Latin one that looks
% like it. In UTF-8, its encoding form uses two bytes, which means it is read as
% two characters by 8-bit TeX engines, but only one by UTF-8 engines.  Hence, the
% following lines detect UTF-8 engines:

\def\testengine#1#2!{\def\secondarg{#2}}

% That's Tau (as in Τaco or ΤΕΧ),
\testengine Τ!\relax

UTF-8
\ifx\secondarg\empty
	is % We're UTF-8
\else
	not % We're 8-bit
\fi
supported.

\end