[luatex] lua-inputenc

Ulrike Fischer news2 at nililand.de
Mon Feb 16 14:53:16 CET 2009


Am Mon, 16 Feb 2009 14:13:29 +0100 schrieb Elie Roux:

>> You could try to write some code so that luatex understands emacs 
>> comments about the coding:
>>
>> % -*-coding: utf-8 -*-
>>
>> And some code that add such a line to every file luatex writes. 
>>
>> Then luatex could use the coding of the comment, and some default 
>> coding from lua-inputenc for all files without such a line. 
> 
> Basically there are two solutions: making LuaTeX write in latin1 (or 
> LICR maybe, it would be the most logical),

No, LICR is not the most logical. Normal LaTeX doesn't use LICR as a 
special "writing" encoding. LaTeX simply expands some commands 
completely, partly or none at all when writing. Try the following 
and then compare the results in the .toc:

\documentclass[11pt]{article}
\usepackage[ansinew]{inputenc}
\begin{document}
\newcommand\test{a}
\tableofcontents
\catcode`\ü=12
\section{\test ä ü \protect\test \string ä}
\end{document}

You can't know which result a user will want. So you can't enforce 
the LICR-representation. 


> or guessing (with your solution for example) the encoding of the
> file, and the convert from utf8 to latin1 and then to utf8
> again...

Why guessing? And why should convert luatex from utf8 to latin1 and 
back? If luatex opens a file it can check if the file contains a 
line about the encoding and then apply this encoding. 


 > I still think the first solution is the best, as the behaviour is much 
> more similar to the old TeX.

Above you are complaining that too much converting is involved and 
now you doing unnessary converting yourself. In your scenario you 
are converting the internal utf8 to latin1 to write the aux, and you 
are converting the content of the aux again to utf8 to handle it 
during compilation. In my scenario you only write a comment to the 
aux so that luatex knows that it is already an utf8-file and can be 
handle directly -- no input converting and no output converting 
needed. 

But if you really want to get aux-files in latin1: You don't need 
luatex to be able to write directly in latin1. You only need to be 
able to convert an utf8-file in e.g. latin1. You could do it after 
you closed the file. 

-- 
Ulrike Fischer 



More information about the luatex mailing list