7

I'm using LaTeX for my day-to-day needs, but in order to avoid cargo-cult document creation, I'm trying to gain a better understanding of the TeX engine itself. As part of this I'm experimenting with TeX (i.e. tex, and as opposed to LaTeX).

Now tex actually loads plain TeX. That's fine, but sometimes I find myself wondering if a command (I'm using the term in a loose sense here) is a primitive or a macro defined by plain TeX, so what I'd like to know is whether there is a way to run TeX that does not load plain.fmt.

Having found this question I assumed that this could be done by using virtex rather than tex, but in my MiKTeX installation virtex also loads plain.fmt:

$ virtex
This is TeX, Version 3.14159265 (MiKTeX 2.9.7250 64-bit)
**\relax

*\show\fmtname
> \fmtname=macro:
->plain.
<*> \show\fmtname

? x
No pages of output.
Transcript written on texput.log.
$ 

So, am I doing something wrong (misunderstanding the exact purpose of virtex, perhaps), or is this a bug in MiKTeX? And what can I do to tinker around with ,,primitive`` TeX, rather than (or in addition to) plain TeX?

7
  • in texlive you can use tex --ini to start up initex with no format preloaded, you could then use that as is or \dump a "empty" format to use with a normal tex (but I dont l know how miktex is configured) texlive doesn't distribute virtex anymore either. Jan 11, 2020 at 11:21
  • you almost always want some format even if it is just a custom one you made that doesn't define any commands, at least setting catcodes so you can use { and } and setting an output routine and some non zero page size will make experiments a lot less painfull Jan 11, 2020 at 11:24
  • With Miktex the --ini switch should imho work too. Jan 11, 2020 at 11:25
  • Thanks. Yes, tex --ini works in MiKTeX, as does initex. I was under the (perhaps mistaken) impression that INITEX was only for creating format dumps and could not be used to produce documents at all.
    – chsk
    Jan 11, 2020 at 11:44
  • 3
    You can discriminate between a primitive and a defined control sequence by doing \show\cs; in case of a primitive, TeX would answer with \cs=\cs. Note that plain TeX redefines no primitive (this is not the case of LaTeX).
    – egreg
    Jan 12, 2020 at 10:14

1 Answer 1

7

virtex isn't distributed with texlive either, you can use the --ini option to start up tex in initex mode for such experiments. This is texlive 2019 but I understand miktex would be the same

$ tex --ini
This is TeX, Version 3.14159265 (TeX Live 2019) (INITEX)
**\relax

*\show\fmtname
> \fmtname=undefined.
<*> \show\fmtname

? 

*\showthe\hsize
> 0.0pt.
<*> \showthe\hsize

? 

*a

*\end
[0]
Output written on texput.dvi (1 page, 128 bytes).
Transcript written on texput.log.

You could either always use initex or use it once to \dump a custom virtex format and then use

tex \&myvirtex

to use that format with a normal tex run.

11
  • Excellent, thanks. What's virtexfor, then? Does it differ from tex at all? (In either TeX Live or MiKTeX; I'm assuming that the two do not differ in these regards for now.)
    – chsk
    Jan 11, 2020 at 11:40
  • virtex was just tex with a format with no defs so it exactly as I show above, if you renamed the file to virtex.fmt and made a symbolic link (or copy) of tex executable to an executable called virtex in the same folder then virtex would work as described in the older documents Jan 11, 2020 at 11:47
  • 1
    @chsk you'd have to ask the miktex and texlive people, but note in the beginning you could not have a command like latex the feature of being able to make the format default from the program name was added later, similarly there were no options like --ini or -fmt so you had to have initex latex.tex to make latex.fmt and then tex &latex to use latex, so the command line options and default format selection has changed. Given a 40 year time span these things happen:-) Jan 11, 2020 at 12:31
  • 1
    @AndréC yes if hello.tex contains \font\z=cmr10 \z zzz \end thenthat command would produce a dvi file with zzz typeset. Jan 11, 2020 at 16:25
  • 1
    @AndréC related tex.stackexchange.com/questions/388352/core-tex-hello-world
    – touhami
    Jan 11, 2020 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .