[tex-eplain] Can't use nor define my own "newlinechar"
Laurence.Finston at gmx.net
Laurence.Finston at gmx.net
Thu Oct 12 22:35:18 CEST 2023
J is the tenth letter in the alphabet and Control-J, or ^^J in TeX, is a way of representing the non-printing ASCII characters, which refer to commands for teletype machines; a device no home should be without. ASCII 10 is the newline command (or character). You can confirm this in emacs by typing ?[Cntrl-J], which will put a newline in your buffer. Then type C-xe, or whatever key sequence is bound to the function eval-last-sexp and you will see this in the mini-buffer: 10 (#o12, #xa, ?\C-j)
Capital Omega is character 10 in Computer Modern Roman. If you use a sequence defined to mean "character 10", it will cause character 10 in the current font to be typeset.
> I'd really like to make \nl the newline character
\def\nl{\hfil\break} does what I think you want.
As far as I know, the newline character is only for output with \write and \message. I believe the character that tells
TeX that a line of the input has ended is 13 [RETURN] but TeX reencodes every character it reads so it is independent
of ASCII, EBCDIC or any other encoding. I think _The TeXbook_ explains this. Otherwise, it's in _TeX: The Program_.
> The thing is, the *eplain* documentation says this is ALREADY defined as ^^J, but it's not. And using \show reveals it has some sort of circular definition to itself! (Maybe I don't understand the terminal output in this case.)
It shows that \newlinechar is a primitive.
> Gesendet: Donnerstag, 12. Oktober 2023 um 21:39 Uhr
> Von: terry.s at Safe-mail.net
> An: tex-eplain at tug.org
> Betreff: Re: [tex-eplain] Can't use nor define my own "newlinechar"
>
> I knew that ... I KNOW that! How did I get so far down the rabbit hole I forgot?
>
> Oh yeah ... when I define it with \newlinechar=`^^J, typing: ^^J prints the Greek Omega! (That happens if I do no definition at all, too.) And of course, if you leave off the backtick you get "Missing number, treated as zero".
>
> I wonder if this because math fonts are loaded? (Not hand-loaded, but the document has formulas and I use $s to print some characters.) But then TeX *always* loads Computer Modern Math with Computer Modern by default, doesn't it?
>
> I was trying all sorts of other ways to define it, like \def (obviously just creates a shortcut), \let and so on. Never gonna work!
> I'd really like to make \nl the newline character ... what I should do (and should have though of) was to look at OpTeX source and see how Petr Oslak defines it. Don't know why I didn't think of that!
>
> The thing is, the *eplain* documentation says this is ALREADY defined as ^^J, but it's not. And using \show reveals it has some sort of circular definition to itself! (Maybe I don't understand the terminal output in this case.)
>
>
> -------- Original Message --------
> From: Laurence.Finston at gmx.net
> Apparently from: tex-eplain-bounces+terry.s=safe-mail.net at tug.org
> To: tex-eplain TUG <tex-eplain at tug.org>
> Subject: Re: [tex-eplain] Can't use nor define my own "newlinechar"
> Date: Thu, 12 Oct 2023 20:07:41 +0200
>
> > That's not how it works. You type ^^J in your document, not \newlinechar. I only ever use this in \write commands,
> > or \message, which is like writing to standard output:
> >
> > \newlinechar=`^^J
> > \newwrite\abc
> > \openout\abc=abc.tex
> > \write\abc{abc^^Jdef}
> > \closeout\abc
> > \bye
> >
> > This is what's written to abc.tex:
> > abc
> > def
> >
> >
> > > Gesendet: Donnerstag, 12. Oktober 2023 um 19:42 Uhr
> > > Von: terry.s at Safe-mail.net
> > > An: tex-eplain at tug.org
> > > Betreff: [tex-eplain] Can't use nor define my own "newlinechar"
> > >
> > > Hello,
> > >
> > > I'm trying to use \newlinechar, a documented feature of eplain. It produces the error "Missing number, treated as zero". I also loaded epsf and colordvi because they are loaded in a file in Laurence Finston's GNU 3DLDF (glyph_test.tex), and he's able to define it himself. I'm on TeX Live 2022. However, that made no difference (so they're commented here). Also, commenting eplain and using TeX by itself makes no difference.
> > >
> > > (I realize I can use \obeylines\break but I'd like to avoid the typing!)
> > >
> > > If I attempt to define it like Laurence as the error is the same (when I try to use it; merely defining it gives no error): \newlinechar=`^^J
> > >
> > > Attached is a minimal example; you can comment and uncomment various packages and my own definition.
> > >
>
More information about the tex-eplain
mailing list.