# How to access version numbers directly from within a tex file?

Is it possible (i.e. is there any command) to access the version numbers of LaTeX/XeTeX directly from within a tex file?


• Which version do you want? That's the engine banner plus other 'stuff'. Apr 30 '18 at 15:45
• Something like XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/Debian). I just need the numbers for future reference to know what version I used to make the document. Apr 30 '18 at 15:51
• Will it be sufficient to know just the engine number and not the versions of the used packages (can be updated independently I think). It still gives a hint though. Apr 30 '18 at 16:01
• Yep, I guess this would be enough. Apr 30 '18 at 16:04

XeTeX supports the primitives \XeTeXversion and \XeTeXrevision to get the used version of XeTeX. XeTeX also implemnts the eTeX extensions, so the \eTeXversion and \eTeXrevision primitives are available too to get the eTeX version.

These are the middle parts of the version printed in the banner, for example if you have XeTeX 3.14159265-2.6-0.99992 (TeX Live 2015/Debian), you can use

\documentclass{scrartcl}
\begin{document}
\the\eTeXversion\eTeXrevision-\the\XeTeXversion\XeTeXrevision
\end{document}


to get

2.6-0.99992


This should be enough to identify the engine. The 3.14159265 only says which TeX version your XeTeX is based on.

You also ask for the "LaTeX" version. The version of the LaTeX format is available as \fmtversion, but this is not what is shown when you call latex --version, because this command shows the version of the TeX engine used by latex, normally pdfTeX. If you document uses pdfLaTeX and you want to get the version, you can use primitives similar to the XeTeX ones:

\documentclass{scrartcl}
\begin{document}
\the\eTeXversion\eTeXrevision-\the\pdftexversion.\pdftexrevision
\end{document}


Result:

2.6-140.19


But pdfTeX also allows you to access the full banner:

\documentclass{article}
\begin{document}
\pdftexbanner
\end{document}


On my system for example this gives

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0