I've used TeX quite a bit before but am getting back into it at the moment.

I want to print a document details page with info such as:

Compiled on:
Compiled by:
OS version:
LaTeX version:

Obviously the first two are easy (\today and \author). Are there similar commands for the others? Or is there a package available which could manage this?

  • Welcome to TeX.SX. Note that you don't have to sign with your name since it automatically appears in the lower right corner of your post. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). – Claudio Fiandrino Oct 19 '12 at 15:04
  • 7
    LaTeX has no notion about what operating system it runs on; however you can use the ifplatform package to set different phrases depending on the operating system. The version of LaTeX is just a date that you can get with \fmtversion, for instance \LaTeX{} version: \LaTeXe~\fmtversion – egreg Oct 19 '12 at 15:12

If you are willing to use a shell-escape (i.e. compile with 'latex --shell-escape'), you can probably use 'uname' on Unix-like platforms and on Cygwin...



% redefine \author as \maketitle clears \@author...

    \immediate\write18{\unexpanded{foo=`uname -a` && echo "\\verb+${foo}+" > tmp.tex}}%
    \input{tmp}\immediate\write18{rm tmp.tex}%

\title{This is a Document}
\author{John Smith}


Compiled on: \today

Compiled by: \ShowAuthor

OS version: \ShowOsVersion

\LaTeX{} version: \LaTeXe~\fmtversion


If you want something similar on Windows, I think you could use something along the lines of...

\immediate\write18{systeminfo | findstr /B /C:"OS Name" /C:"OS Version" > tmp.tex}

and maybe restructure slightly - for instance, you'll need to remove the "OS Version:" from the main text because this 'systeminfo' command outputs more than just the version number - for me it outputs

OS Name:                   Microsoft Windows 7 Professional
OS Version:                6.1.7601 Service Pack 1 Build 7601
  • I'm getting this error: line 1: Text line contains an invalid character line 1: You can't use `macro parameter character #' in horizontal mode erb+Linux vaio 3.0.0-16-generic-pae # – Sigur Oct 19 '12 at 23:21

A starting point. The following example extracts information that is available at TeX macro level (code parts are taken from hyperref):



  \hologo{\fmtname} \textless\fmtversion\textgreater
        \divide\count@ by 100 %
        \multiply\count@ by 100 %
        \advance\count@ by \luatexversion
              \divide\count@ 100 %
              \space v\the\count@
              \multiply\count@ -100 %
        \ifnum\pdftexversion<100 %
          \ifnum\pdftexversion<130 %


  Compiled by: & \InfoTeX \\
  \hologo{LaTeX} version: & \InfoLaTeX \\


A script could gather the other data (OS, ...) and write definitions in a .tex file that can be read by the TeX run.



A workable approach (at least once your document has grown in scale beyond a single source file) is to use a shell script or batch file to discover and write the information you desire into a file named something like sysinfo.tex. You then reference that in your main document.

I've used this technique mostly for documents that are already heavily machine generated where I also include revision information for the generating program as well as information from the version control system, but there's no reason it can't be done for more ordinary documents.

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.