[luatex] behavior of \write in LuaTeX differs from the one of PdfTeX/XeTeX

jfbu jfbu at free.fr
Tue Mar 24 19:36:38 CET 2015


Hi,

this is presumably related to 

% http://tracker.luatex.org/view.php?id=733

% http://tex.stackexchange.com/questions/65151/scantokens-in-luatex

% http://tug.org/pipermail/lualatex-dev/2011-November/001376.html

which address the behavior of \scantokens

While investigating the issue I ended up with this,
which might very well have been discussed here or is
already on the tracker.

If I assign catcode 12 to the CTRL-M character, and then
\write ^^M to an external file:

with pdftex/xetex we get ^^M (three characters) in the file
with LuaTeX we get a single CTRL-M (ascii code 13) in the file

as a result, the \input then behaves differently

see MWE below

%----START
% author: jfbu

% Mardi 24 mars 2015 a 19:25:11

\catcode 13 12 %
\newwrite\out %
\immediate\openout\out=\jobname.out %
\immediate\write\out {a^^Mbcdef}%
\immediate\closeout\out %
\catcode 13 5 %

% luatex writes to the file CTRL-M
% pdftex/xetex write the three characters ^^M

% as a result the input now behaves differently

% luatex will see two lines, hence prints a<space>bcdef<space>+++
% pdftex/xetex see only one line with catcode 5 token and thus ignore bcdef
% and print a<space>+++
\input \jobname.out +++
\bye
%----STOP

This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014) (preloaded format=xetex 2014.7.10)  24 MAR 2015 19:25

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded format=pdfetex 2015.1.21)  24 MAR 2015 19:35

This is LuaTeX, Version beta-0.79.1 (TeX Live 2014) (rev 4971)  (format=luatex 2014.7.10)  24 MAR 2015 19:36

Regards

Jean-Francois




More information about the luatex mailing list