3

I am confused by the output of the following code:

\documentclass{article}
\begin{document}
\begingroup
\obeylines
\typeout{abc^^Muvw}
\wlog{ijk^^Mxyz}
\endgroup
\end{document}

With PDFLaTeX or XeLaTeX, I get

abc^^Muvw
ijk^^Mxyz

But with LuaLaTeX, I get

abc
uvw
ijk
xyz

Why LuaTeX treats ^^M in \wlog differently? Is the behaviour customizable in LuaTeX?

3
  • 1
    I cannot recreate your lualatex behavior Commented Apr 19, 2022 at 3:28
  • @StevenB.Segletes Strange. I tested the code on latest MikTeX and TeXLive. Both gave the above output with LuaLaTeX.
    – L.J.R.
    Commented Apr 19, 2022 at 4:08
  • I can reproduce the OP's finding on my system (MacOS 12.3.1 "Monterey", MacTeX2022, LuaHBTeX 1.15.0, LaTeX2e <2021-11-15> patch level 1).
    – Mico
    Commented Apr 19, 2022 at 5:05

1 Answer 1

4

This is by-design: LuaTeX deliberately passes ^^M (and ^^I and ^^J) as is'. From the LuaTeX manual:

Output to the terminal uses ^^ notation for the lower control range (𝑐 < 32), with the exception of ^^I, ^^J and ^^M. These are considered ‘safe’ and therefore printed as-is. You can disable escaping with texio.setescape(false) in which case you get the normal characters on the console.

2
  • Sorry, but just adding \directlua{texio.setescape(false)} to the code doesn't produce the same log text as PDFLaTeX. Is there anything I am missing?
    – L.J.R.
    Commented Apr 19, 2022 at 7:06
  • @L.J.R. I edited my answer pretty much immediately: the adjustment is to make other low chars act like ^^M in LuaTeX, not to make ^^M act as it does in pdfTeX.
    – Joseph Wright
    Commented Apr 19, 2022 at 7:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .