Take the 2-minute tour ×

I'm wondering, why my minimal example (in file shebang.tex)

%& -job-name=test

will always (no matter if using latex, pdflatex oder xelatex) compile to shebang.dvi/pdf and not to test.dvi/pdf. Are shebang-lines deactivated?

Edit: I just found out, that it is something with encoding: Using MikTex in Windows on the file encoded in ISO-8859-15 it is working - but not with encoding UTF-8 - which I like to use.
Under Debian Linux with texlive, no matter which encoding it is not working.
Maybe one needs another symbol after the percent-symbol?
The questions seems to be somehow related to %& magic line has no effect: But there is also a difference: Running the command xelatex -parse-first-line shebang will also produce shebang.pdf. In the log file, there occur those lines

 %&-line parsing enabled.
\openout1 = `shebang.aux'.

showing the flag being recognized - but the job-name not working.

share|improve this question
No idea if this is at all relevant, but that doesn't look like a regular percent-sign to me. –  Roelof Spijker Jan 31 '12 at 9:50
@wh1t3 please check this by copy and paste into one editor of your choice: For me this is the default one... - and I think further it is not really relevant. –  Bastian Ebeling Jan 31 '12 at 9:53
Well, if I start writing an answer it looks different in the preview here. I wonder if it looks different if I just put one here: %. Edit: Yes, that looks different... Again, perhaps it's not related, I don't know how the shebang is checked, I can imagine that if it's some unicode character and not "really" a percent sign (ASCII character 37), this would cause issues... –  Roelof Spijker Jan 31 '12 at 10:00
Okay, from the link you edited into your question, it looks like it might have nothing to do with encoding, but some setting instead. Have you looked into the settings specified in that question? –  Roelof Spijker Jan 31 '12 at 10:10
where did you read that you can use other options than the format or a translate file for the use of %& ? –  Herbert Jan 31 '12 at 10:35

1 Answer 1

up vote 4 down vote accepted

The MikTeX documentation specifies the %& option can be used to add additional command line parameters. It uses miktex-pdftex though, instead of just pdftex. The pdflatex man page suggests the %& option can only be used for format files and -translate-file options.



You could of course write your own wrapper script that parses the first line and then calls pdflatex or xelatex or your engine of choice with the suggested parameters. I am guessing this is basically what miktex-pdftex does.

share|improve this answer

Your Answer


