How can I produce the output of a carriage return in a \message?
You don't say, but \reserved@a
suggests that you are using latex in which case
\message{ab^^Jcde}
works although it is better to use latex constructs such as \typeout
or \PackageInfo
In plain TeX the above \message
will work if you set
\newlinechar=`\^^J
The \message
primitive expands input in the same way as \edef
and needs something which produces a 'raw' new line to get the desired effect. On the other hand, \\
is a command to produce a line break in typesetting, so fails here (it is also not expandable, hence the odd error). You therefore need to insert a character equal to \newlinechar
. In the LaTeX format this is ^^J
:
\message{a^^JB}
\stop
In formats where this is not set (such as plain), you'll also need to cover that
\begingroup
\newlinechar=`^^J %
\message{a^^JB}
\endgroup
\end