On 3/24/2015 7:36 PM, jfbu wrote:
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

if i run

\starttext

\edef\newline{\directlua{tex.write(string.char(10))}}

\newwrite\out %
\immediate\openout\out=\jobname.out %
\immediate\normalwrite\out {a\newline b}%
\immediate\normalwrite\out {c^^Md}%
\immediate\closeout\out %

\stoptext

i get

a
b
c^^Md

which looks ok to me from the perspective of luatex

(btw, in general you cannot expect luatex to behave exactly like pdftex and xetex esp when it comes to file io and logging)

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




--

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

Reply via email to