Discussion:
[tex-k] Web2C: "-parse-first-line" does not work in on-line fileprompt.
Igor Liferenko
2018-09-19 08:55:03 UTC
Permalink
On page 26 of TeXbook it is said that "tex &plain story" loads the plain
format before inputting the "story" file. But terminal log says that
"tex" format is loaded:

$ tex -ini '\input plain.tex \dump' >/dev/null
$ tex \&plain story
This is TeX, Version 3.14159265 (preloaded format=tex)
(/usr/share/texlive/texmf-dist/tex/plain/knuth-lib/story.tex [1])
*

Is it possible to check what would be output by non-web2c TeX?

P.S.
The original example is garbled in mailing list archives.
This is the same example, using only ASCII:

echo -e '%&lhplain\n\xD1\x8B\\bye' >test.tex
Igor Liferenko
2018-09-19 09:22:04 UTC
Permalink
I came to the conclusion that it is impossible to make formats
work properly when using prompt to input file name. I decided
to handle this by just creating a wrapper which checks if
file exists before calling tex:

tex () {
if [ -e "$1" ]; then
command tex "$@"
else
echo ERROR: cannot open input file
return 1
fi
}

Regards,
Igor
Karl Berry
2018-09-19 22:38:02 UTC
Permalink
Igor,

This is TeX, Version 3.14159265 (preloaded format=tex)

This happens by DEK's personal request. It is a lie -- the format has
not actually been loaded when that is output, the name shown is based on
argv[0]. If you look at story.log, you will see the truth:

This is TeX, Version 3.14159265 (TeX Live 2018) (preloaded format=plain 2018.9.19) 19 SEP 2018 15:19

For this reason, for some years we omitted any "(preloaded format=...)"
from the banner. Don felt it was more important to say something that
would be correct in all default cases than to omit it. I also suggested
more correct text like "default format". Don liked the word "preloaded".
It is not my place to argue with his opinion.

Is it possible to check what would be output by non-web2c TeX?

Not by me.

This is the same example, using only ASCII:
echo -e '%&lhplain\n\xD1\x8B\\bye' >test.tex

Mixing TeX-world stuff and Unix-world stuff is always questionable. The
timing of certain actions is too finicky to be sure what will happen. I
have no intention of changing anything in this area.

FYI, apart from anything TeXish, printf is the only portable Unix
command for using \ character escapes. echo was screwed up by too many
systems over too many years for anything but plain strings.

I see no need for your wrapper. But if it makes you happy, clearly
that's fine for you. --best, karl.

Loading...