# Why does TeX Live's pdfTeX's %& parsing override the executable name?

In testing my answer to this question, I initially wrote the file

%& eplain
% code to answer question here
\bye

and compiled with pdftex e. Much to my surprise, the penultimate line of output was

Output written on e.dvi (1 page, 352 bytes).

If I change the first line to \input eplain or add the command line argument -output-format=pdf, then I get a pdf.

This same behavior can be observed by by starting a LaTeX file with %& latex and compiling with either pdflatex or pdftex so it's unrelated to eplain.

-
You are doing two different things. Using \input simply loads the relevant .tex file, whereas first-line parsing switches engine alias. Remember that almost all of the *tex execuatables are aliases for pdfTeX with the appropriate format. So the first line you are using effectively switch the command line to eplain. –  Joseph Wright Oct 15 '10 at 7:23
@Joseph Wright: I think your description is backward. The name of the executable is used as the name of the format. I didn't realize that there were different .fmt files for latex and pdflatex though. It doesn't really seem necessary to have them since one can choose the output format independently of the format file. –  TH. Oct 15 '10 at 12:43