Can I use enctex with XeLaTeX? I want use it as it's a requirement for encxvlna (package that inserts non-breaking space into Czech documents).

All documents howto use it describe just pdflatex configuration.

  • A binary like pdftex is specially compiled in order to be configured for usage of encTeX. This is not the case for XeTeX or LuaTeX, mainly because they use much larger character tables than encTeX knows. As far as I know, encTeX reads UTF-8 byte by byte, so it only emulates Unicode input. See section 2 in the documentation of encTeX. – egreg Nov 17 '15 at 13:09

The impossibility of using encTeX with XeTeX and LuaTeX results from sections 2 and 3 of the manual.

The encTeX extensions is only able to emulate UTF-8 input, while still reading a file one byte at a time. It does so when reading the bytes, so for example something like

\mubyte \foo ABCD\endmubyte

can be declared, which changes ABCD into \foo before macro expansion takes place. Sequences are recognized until there's a match with one that's defined.

This means that the level encTeX operates at comes after multibyte conversion into a single Unicode entity has taken place with XeLaTeX and LuaLaTeX. For instance, if the input file is UTF-8 encoded, the multibyte sequence ^^c3^^a1 (I'm using the usual TeX representation) is transformed into the entity U+00E1 (that is, LATIN SMALL LETTER A WITH ACUTE) before tokenization is performed and category codes are assigned. Since encTeX still works with xord and xchr arrays with 256 slots, it cannot understand such extended entities.

Maybe this problem can be solved, but, as things stand, XeTeX and LuaTeX cannot be compiled to accept the -enc option for enabling usage of encTeX.

  • The conversion from UTF8 codes to control sequences or single char-tokens is only one application of encTeX and this is irrelevant in LuaTeX or XeTeX. But conversion from arbitrary else strings to control sequences or single char-tokens should be usable but not implemented. Because it is not so simple to implement it and it is not necessarily needed. LuaTeX has its own concept for doing this: process_input_buffer callback. – wipet Feb 5 at 10:22

OK, while I'm not sure, whether I can use enctex with XeLaTeX (probably not), I found xevlna – XeTeX / XeLaTeX package with similar functionality as encxvlna for TeX / LaTeX.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.