23

Is there any command or package to insert the version of LaTeX used to create a document? I am looking for a header or footer in the first page that says something like compiled with pdfTeX 3.1415926-1.40.11-2.2 (TeX Live 2010).

David Carlisle
  • 757,742
YuppieNetworking
  • 5,919
  • 7
  • 36
  • 40
  • 2
    I wonder if there's a way to do this but print the version number of a particular package used. Presumably not, since not every package defines such a primitive... – Seamus Oct 25 '10 at 12:47
  • 3
    @Seamus: Check source2e.pdf for the implementation of \ProvidesPackage and you will see that there is a global name for the package with the version in it. So as long as the package authors use that declaration you can find it in \csname ver@<package>.sty\endcsname. Ask your own question, though; this is a separate issue. – Matthew Leingang Oct 25 '10 at 13:04
  • 1
    I think that would be an excellent question. I will leave Seamus the honor of asking it. It would be great to have a (draft) section in your document with this information. – YuppieNetworking Oct 25 '10 at 14:17

2 Answers2

26

There is \pdftexbanner primitive which will give you that message (works for both pdftex and luatex), but xetex don't seem to have a similar banner primitive.

6

Not as specific as you want, but Pdftex has the primitive \pdftexversion, which is 100x the version number.

You can make a shell script that creates a file based on the first line of the output of tex -v (or whatever), that is \input by the Latex program. Cf. the answers to the question Passing parameters to a document for pointers on how to do this.

Charles Stewart
  • 21,014
  • 5
  • 65
  • 121
  • \pdftexversion does not work: it gives me "You can't use \pdftexversion in vertical mode." and if I precede it with \leavevmode it gives me "You can't use \pdftexversion in horizontal mode." – Peter Flynn Sep 24 '20 at 21:15