LaTeX: Document Details
In which I perfect a macro for listing document details in LaTeX.
The Problem
I've been using $latex LaTeX$ to typeset my MRI Glossary (see previous PhD post). I really wanted an Appendix which listed system info and $latex LaTeX$ version.*
*Wordpress.com supports native $latex LaTeX$ - which is awesome
Solution
After much googling I couldn't figure out how to do this so I asked the kind folks at tex.stackexchange.com and Heiko Oberdiek & Ivan Griffin responded with two macros which I've now combined as follows†: usepackage{hologo} usepackage{ifluatex} usepackage{ifxetex} usepackage{ifvtex}
makeatletter
newcommand{ShowOsVersion}{% immediatewrite18{systeminfo | findstr /B /C:"OS Version" > OSv.tex}% input{OSv}immediatewrite18{rm OSv.tex}% }
newcommand{ShowOsName}{% immediatewrite18{systeminfo | findstr /B /C:"OS Name"> OSn.tex}% input{OSn}immediatewrite18{rm OSn.tex}% }
newcommand*{InfoLaTeX}{% hologo{fmtname} textlessfmtversiontextgreater } newcommand*{InfoTeX}{% ifxetex hologo{XeTeX}-% theXeTeXversionXeTeXrevision else ifluatex hologo{LuaTeX}-% begingroup count@=luatexversion dividecount@ by 100 % edefx{thecount@}% count@=-xrelax multiplycount@ by 100 % advancecount@ by luatexversion x.thecount@.luatexrevision endgroup else @ifundefined{pdftexversion}{% ifvtex hologo{VTeX}% @ifundefined{VTeXversion}{% }{% begingroup count@VTeXversion dividecount@ 100 % space vthecount@ multiplycount@ -100 % advancecount@VTeXversion .two@digitscount@ endgroup }% else hologo{TeX}% fi }{% hologo{pdfTeX}-% ifnumpdftexversion thepdftexversion.pdftexrevision else ifnumpdftexversion expandafter@carthepdftexversion@empty@nil.% expandafter@cdrthepdftexversion@empty@nil pdftexrevision else expandafter@carthepdftexversion@empty@nil.% expandafter@cdrthepdftexversion@empty@nil.% pdftexrevision fi fi }% fi fi }
I then call this at the end of my document with:
appendix chapter{Document Details}
Compiled by: InfoTeX hologo{LaTeX} version: InfoLaTeX ShowOsName ShowOsVersion
end{document}
This produces the following output:
Compiled by: pdf $latex TeX$-1.40.13 $latex LaTeX$ version: $latex LaTeX$2e OS Name: Microsoft Windows 7 Professional OS Version: 6.1.7601 Service Pack 1 Build 7601
†This requires you to use the -shell-escape option when compiling
Tom Out!
P.S. http://tex.stackexchange.com/questions/78334/print-system-information-in-latex-doc