5

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?

  • 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. – David Carlisle Jan 11 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 – David Carlisle Jan 11 at 11:24
  • With Miktex the --ini switch should imho work too. – Ulrike Fischer Jan 11 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 at 11:44
  • 2
    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 at 10:14
6

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.

  • 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 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 – David Carlisle Jan 11 at 11:47
  • Thanks again. You say ,,virtex was just tex with a format with no defs`` --- so it isn't anymore? Why is that? – chsk Jan 11 at 12:27
  • 1
    @AndréC yes if hello.tex contains \font\z=cmr10 \z zzz \end thenthat command would produce a dvi file with zzz typeset. – David Carlisle Jan 11 at 16:25
  • 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.