latex3/svn-mirror — Issue #48: Interface for \endlinechar, \newlinechar
Author: blefloch
Created: 2011-10-22 12:54:16+00:00
State: open

An interface for `\tex_endlinechar:D` and `\tex_newlinechar:D` is needed when manipulating `xparse` verbatim arguments with more than one line. Typically, one has to do

\RequirePackage{xparse}
\ExplSyntaxOn
\DeclareDocumentCommand{\foo}{+v}
{
\tl_rescan:nn
{
\int_set:Nn \tex_newlinechar:D {13} % convert the input ^^M to new lines.
\int_set:Nn \tex_endlinechar:D {13} % convert the new lines into ^^M when reading.
}
{#1}
}
\ExplSyntaxOff
\foo+Some normal text.

More of it.+

Without the settings to `\tex_newlinechar:D` and `\tex_endlinechar:D`, the text after the first `^^M` is lost, since `\scantokens` is seen as a single-liner, and catcode `5` characters tell TeX to gobble anything that follows in the line.