I tried \crlf{} and that worked too (the “{}” because I do not know what comes after even if I think any whitespace is eaten and to influence any catcode trickery, just feels it is more robust than a space).
Hans, an additional question about lmtx’s XML interface. As I want the TeX special characters to be able to be part of a label, I replace all of them. That works. But what if I would like a way to introduce TeX commands again by using some other UTF8 character, would there be a character that curvies the pass through lmtx, can be used in a lua table so that I can (in a preferred order) get unescaped characters passed that flow?
E.g. code a \ as some weird UTF8 character in the XML file, and in that table I use
local rep = lpeg.replacer {
{ '\n', '\\crlf{}' },
{ '{', '{\\textbraceleft}' },
{ '}', '{\\textbraceright}' },
{ '#', '{\\texthash}' },
{ '$', '{\\textdollar}' },
{ '&', '{\\textampersand}' },
{ '%', '{\\textpercent}' },
{ '\\','{\\textbackslash}' },
{ '|', '{\\textbar}' },
{ '_', '{\\textunderscore}' },
{ '~', '{\\textasciitilde}' },
{ '^', '{\\textasciicircum}' },
{ '"', "\"&ditto&\"" },
}
code it back to a \ ? E.g. something like