3

My understanding is that if I create a file called noName.tex with the first line

%& -jobname=myName

then when I run pdflatex on that file, the output file will be named myName.pdf rather than noName.pdf, just as if I'd typed

pdflatex -jobname=myName noName.tex

But in the following example, the first line is ignored by pdflatex, and the output is named noName.pdf.

Here is noName.tex:

%& -job-name=myName
\documentclass{minimal}
\begin{document}
Hello World
\end{document}

Could somebody advise what the correct syntax would be please? Thanks very much.

The version of pdflatex I'm using is:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2014.6.25)
  • 2
    Where exactly have you gotten the idea that this should be supported (not saying that it isn't?, I've never seen it before) – daleif Jan 24 '16 at 12:09
  • as @daleif ask what is the editor you use? This works fine for me with TeXstudio. – touhami Jan 24 '16 at 17:28
  • I saw reference to it in this thread. But elsewhere also. I'm using linux, so simply running pdflatex from the command line. TeXstudio obviously has a lot of additional wrapping. – Leo Simon Jan 24 '16 at 19:35
  • 1
    The line %& -jobname=myName is one of these so-called magic comments, which can be interpreted by some editors (TeXstudio, TeXworks). This is hence not an intrinsic feature of pdftex and compiling from the command line will thus result in those magic comments being ignored. – Henri Menke Jan 25 '16 at 12:21
  • @HenriMenke No, this is a magic line for the TeX engine and is not interpreted by editors, as far as I know. Some implementations of TeX allow -jobname there some don't: MiKTeX does, TeX Live doesn't. – egreg Jan 25 '16 at 14:52
2

The %& magic line has been supported by implementations of TeX from many years. However, the feature is implemented differently in the various TeX distributions.

Note that no editor/front-end I know of interprets such a line: this is specific for the TeX engine.

In TeX Live, the line can contain only the specification of a format to be loaded and a TCX file, see section 3.5.2.2 in the documentation of Web2c (texdoc web2c, page 11 for TeX Live 2015):

%&format -translate-file=tcxfile

Either part can be empty. Note that, in TeX Live, Knuth TeX doesn't honor this magic line.

As far as I know, other command line options such as -jobname can be specified with MiKTeX. They'll definitely not work with TeX Live.

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.