# [texhax] include a pdf graphics file whose name includes a varying date

Mike Marchywka marchywka at hotmail.com
Thu Feb 2 11:43:51 CET 2017

fwiw, as a point of discussion ( I still do not know what all tex has for scripting )
assuming hotmail does not mangle it, here is a script that generates a date in a standard
format and is then modified using tools that work with anything ( 'dohs users can get cygwin ).
Any generated literal can now be shared as a string without having to worry if different apps make
different names sometimes due to various quirks in defaults or other issues.
Once you have a code generator for tex, making code snippets for R or whatever is quite
easy. The code generator script can run and test the apps too ( I use an example I found on stack
exchange to validate bibtex entries).

$cat testscript testdate() { cat - << ---- \documentclass{article} \begin{document} \begin{verbatim}$1
\end{verbatim}
\end{document}
----

}

testdate date  -R | sed -e 's/ /_/g'

$./testscript > xxx.tex$ pdflatex xxx.tex

________________________________________
From: texhax <texhax-bounces at tug.org> on behalf of Ulrike Fischer <news3 at nililand.de>
Sent: Thursday, February 2, 2017 3:51 AM
To: texhax at tug.org
Subject: Re: [texhax] include a pdf graphics file whose name includes a varying date

Am Wed, 1 Feb 2017 08:19:13 -0500 schrieb William Adams:

> While David's solution (of course) works, I'm pretty sure that if you
> consult the documentation for the package datenumber there will be an
> option to enable padding with a leading zero (though it's odd to me that
> apparently this is turned one for days?

The documentation doesn't have such an option, but shows an example
which uses exaclty Davids code:

\thedateyear/%
\ifnum\value{datemonth}<10 0\fi
\thedatemonth/%
\ifnum\value{dateday}<10 0\fi
\thedateday%

But I don't quite see why one need a package for this.

\the\year-\ifnum\month<10 0\fi\the\month-\ifnum\day<10 0\fi\the\day

works fine.

--
Ulrike Fischer
http://www.troubleshooting-tex.de/

_______________________________________________
TeX FAQ: http://www.tex.ac.uk/faq
Mailing list archives: http://tug.org/pipermail/texhax/