2

Is it possible to get the file creation date of an external file, using XeLaTex? I want to include it as the caption of a figure, referring to the file in the figure.

\documentclass[11pt]{article}
\usepackage{graphicx}

\begin{document}
\begin{figure*}[ht]
    \includegraphics{test.pdf}
    \caption{Illustration made on 04.07.2015}\label{test}
\end{figure*}

\end{document}
Runar
  • 6,082
  • You know that \label should be after \caption? ;-) Are you using Linux, perhaps it's possible with a shell-escape –  Nov 15 '15 at 10:50
  • I'm on OS X. Thanks for the heads-up on the label, I just wrote the script from the top of my head. – Runar Nov 15 '15 at 10:55

1 Answers1

2

You can try the getfiledate package and its \getfiledate command -- backdraw: You have to use specifiy the filename twice this way and it's using a minipage

\documentclass[11pt]{article}
\usepackage{graphicx}

\usepackage{getfiledate}
\begin{document}
\begin{figure*}[ht]
    \includegraphics[scale=0.5]{schroedinger}
    \caption{Illustration made on \getfiledate[putprefix=false,separator={},head=0pt,foot=0pt]{schroedinger.pdf}}
    \label{test}
    \caption{Illustration made on \getfiledate{schroedinger.pdf}}\label{erwin}
\end{figure*}

\end{document}

Here's an other way with filemod package, but it's not working with xelatex :-(

\documentclass[11pt]{article}
\usepackage{graphicx}

\usepackage{filemod}
\begin{document}
\begin{figure*}[ht]
    \includegraphics[scale=0.5]{schroedinger}
    \caption{Illustration made on \filemodprintdate{schroedinger.pdf}}
\end{figure*}

\end{document}

enter image description here

  • I'll to try to update with a solution which works with XeLaTeX too –  Nov 15 '15 at 11:29
  • Maybe you can look at http://tex.stackexchange.com/questions/41889/what-is-the-xetex-equivalent-of-pdfcreationdate – egreg Nov 15 '15 at 11:57