2

I'm trying to use the getfiledate package from CTAN to get, as sugested, the last file modification date.

I've imported correctly the package and tested with another file, named table/classe.tex and works perfectly.

When tested accord as following I get an error

\getfiledate{tables/classification_Full.tex}

PS: When the file does not exist the error is shown correctly as expected.

  • 1
    A warm welcome to TeX.SE! A little more information might help other people figure out how to help you. Most likely a link to whatever external-files and a minimum working example of some kind would assist. – A Feldman Apr 12 '16 at 20:01
2

The issue happens when the file name is being printed.

The simplest workaround, if you have no special need such as macros in the file name, is

\getfiledate{\detokenize{tables/classification_Full.tex}}

Otherwise, the string has to be made in a different fashion:

\begin{filecontents*}{clifte_test.tex}
Hello
\end{filecontents*}

\documentclass{article}
\usepackage{getfiledate}

\makeatletter
\def\gfd@prefix@a#1{%
  \ifcsempty{gfd@marker}{}{\gfd@marker@a}%
  \begingroup\edef\x{\endgroup
    \unexpanded{\gfd@prefix\space\textcolor{\gfd@filenamecolor}}%
    {\noexpand\ttfamily\noexpand\detokenize{#1}}%
    \unexpanded{\space\gfd@postfix\space}%
  }\x
}
\makeatother

\begin{document}

\getfiledate{clifte_test.tex}

\newcommand{\MYPREFIX}{clifte}% just to see macros can be used
\getfiledate{\MYPREFIX_test.tex}

\end{document}

I added \noexpand\ttfamily so the file name is printed in monospaced font (which is not the case in the original definition). Remove the two tokens if you don't want monospaced font; however, if you do, remember to do \usepackage[T1]{fontenc} or the underscore would not be printed (a dot would appear instead). The same if you use the shorter workaround (and no macros in the file name).

enter image description here

| improve this answer | |
  • Curious package. Tons of options to change colors, add frames and you can even add a heart before the time, but nothing to safely print a file name. – Ulrike Fischer Apr 13 '16 at 9:11

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.