Changes

Jump to navigation Jump to search
873 bytes removed ,  18:40, 20 August 2012
Moved 'detecting UTF-8' to Encodings and Regimes
== Links ==
* other [[:Category:Lua|Lua topics]]
* The [[Lua|The Lua ]] in LuaTeX]]
* [[Programming in LuaTeX]]
* [http://luatex.org/ LuaTeX homepage]
* [http://lua-users.org/wiki/LuaDirectory Lua-Users Wiki] (Tutorials etc.)
* [http://www.luatex.de/ Patrick’s German LuaTeX Blog]
 
== Some tricks ==
 
=== Testing for UTF-8-aware TeX ===
 
<i>(By [[User:Taco|Taco]]); this hint should be place to a better location on the wiki</i>
 
For luatex, one may test if <code>\directlua</code> is defined.
 
The next weird macro definition should work for testing xetex/luatex, because only xetex and luatex accept 5- and 6-byte caret notation (hex 22 == double quote):
<texcode>
\def\"{0}\expandafter\def\csname^^^^^00022\endcsname{1}
\ifnum\"=0 \message{tex82}\else\message{newstuff}\fi
</texcode>
 
But that is not quite the same as testing for native UTF-8. Better is a trick like this:
 
<texcode>
\def\test#1#2!{\def\secondarg{#2}}
\test χ!\relax % That's Chi, a 2-byte utf-8 sequence
\ifx\secondarg\empty \message{newstuff}\else \message{tex82}\fi
</texcode>
 
ConTeXt offers <code>\beginNEWTEX ... \endNEWTEX</code> to test if one is using LuaTeX or XeTeX.
== Fonts ==

Navigation menu