# [luatex] read and write streams

Hans Hagen pragma at wxs.nl
Fri Nov 20 09:32:12 CET 2015

On 11/19/2015 11:31 PM, jfbu wrote:
>
> Le 19 nov. 2015 à 20:10, Markus Kohm <komascript at gmx.info> a écrit :
>
>> Am Donnerstag, 19. November 2015, 18:48:53 schrieb jfbu:
>>> to be
>>> robust with respect to future enlargement of output streams for this task ?
>>
>> \newrite\terminal
>> \immediate\write\terminal{Test}
>>
>> As long, as you do not open the new write, it will write to terminal and log
>> file. BTW: For LaTeX you should simply use \typeout. So for generic code you
>> may use something like:
>>
>> \begingroup\expandafter\expandafter\expandafter\endgroup
>> \expandafter\ifx\csname typeout\endcsname\relax
>>   \newwrite\@typeout
>>   \def\typeout{\immediate\write\@typeout}
>> \fi
>
> Hi,
>
> I looked for rationale for doing a \newwrite rather
> than direct \write128, and the only one I see is for
> the package to provide the user an option to have
> the concerned messages sent to a separate file
> if need be
>
> This could be useful as things written to the log
> seems to get hardwrapped every 79 characters
> (with pdftex, and it seems to be 80 characters
> with luatex). Whereas they are not hardwrapped
> when "\write" to another file.
>
> I used \message initially but found it had
> somewhat unpredictable behavior with respect
> to making new lines in the log, and I didn't
> want to set \newlinechar. This is why I went
> for \write16, but the hard-wrapping somewhat
> annoys me.
>
> I am sure the 80 characters vs 79 characters
> must have been discussed on this list before,

yes and we don't care too much about it because it's already quite
tricky to include utf in the equation (multi byte chars) - one can argue
than a newline char is either of not in the limit

the same for logging. luatex is mostly compatible but we don't bother

we might at some point even drop the wrap

Hans

-----------------------------------------------------------------
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
-----------------------------------------------------------------