108

Is there a LaTeX command for printing the versions of the currently installed packages? I need to know the installed version of the pgfplots package.

  • 7
    with vanilla TeXLive distro, On command line/Terminal invoking tlmgr info pgfplots gives the version of pgfplots installed. – texenthusiast Apr 4 '14 at 14:56
91

Add \listfiles to your preamble and then look at the .log file. This will tell you the current version of all the packages loaded.

  • 27
    Package versions are announced in the .log file even without \listfiles. – Andrey Vihrov Mar 13 '11 at 12:28
  • 11
    @Andrey: makes them easier to find, thought :-) – Joseph Wright Mar 13 '11 at 12:30
  • 6
    It might be interesting to write a command line tool to check that. – ℝaphink Sep 16 '11 at 8:54
  • 3
    @ℝaphink I have attempted, but the fact that TeX hard-wraps the output makes it very difficult. – Sean Allred Oct 24 '15 at 16:30
  • @SeanAllred You can increase max_print_line in texmf.cnf to have it (practically) not wrap; see this question. – ShreevatsaR May 5 '17 at 6:06
54

If you need to know this 'programmatically', then you can use the LaTeX kernel function \@ifpackagelater to test by date:

\@ifpackagelater{<package>}{2011/03/13}
  {%
    % Do something for the newer version
  }
  {%
    % Do something different for the older version
  }%

The information is stored inside a special macro, so if you just want to 'take a peek' you can use that. Taking pgfplots as an example

\expandafter\show\csname ver@pgfplots.sty\endcsname

Notice here that this needs the full file name we are interested in, so works for any file that contains suitable information (i.e. form \ProvidesPackage, \ProvidesClass or \ProvidesFile).

  • you can load the name into a macro by \edef\foo{\csname ver@pgfplots.sty\endcsname} – wasteofspace Mar 13 '11 at 12:48
  • 1
    @anon: It's already in a macro, just one with an awkward name :-) – Joseph Wright Mar 13 '11 at 12:51
  • @Andrey: Done, clearly I hope. – Joseph Wright Mar 13 '11 at 13:02
  • @JosephWright Is it correct that your code 'taking a peek' will only show this information in the .log but not in the pdf? And the package has to be loaded by usepackage.... I get > \ver@pgfplots.sty=macro: ->2016/08/10 v1.14 Data Visualization (1.14). <recently read> \ver@pgfplots.sty – LukasCB May 9 '17 at 21:30
1

To find a package version, you can just open the package source file on your file system and look the version directly by yourself with some text editor as Sublime Text.

Here are the paths and references for the latex paths on Linux and Windows for the biblatex package:

  1. Miktex (Windows) D:\Programs\Mikyex\latex\texmfs\install\tex\latex\biblatex-abnt\bbx\abnt.bbx

    ...
    \ProvidesFile{abnt.bbx}%
    [2017/07/28\space v3.1\space ABNT BibLaTeX citation style]%
    ...
    
  2. TeX Live (Linux) /usr/share/texlive/texmf-dist/tex/latex/biblatex-abnt/abnt.bbx

    ...
    \ProvidesFile{abnt.bbx}%
    [2017/11/09\space v3.2\space ABNT BibLaTeX citation style]%
    ...
    
  • 1
    note you should check the files using the paths reported by tex in the log not "reference" paths as above. The most common issues for which people need to check versions is where they have multiple tex installations and tex is not using the package they think it is using (eg miktex user and admin installs, or linux tex and a vanilla texlive from tug etc) So the important question is not do you have the latest version of the package installed, it is is your tex using that version. – David Carlisle Apr 27 at 20:15

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.