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

Wed Feb 1 16:15:16 CET 2017

If there're robust date classes / packagees, it shouldn't matter which /
where and they all ought to synch up.

Agree, if one can have a single point of control, that's potentially
better, but it's often easier to use a native tool in a given operation
than reaching outside of it, grabbing some external value and then
continuing.

William

On Wed, Feb 1, 2017 at 10:10 AM, Mike Marchywka <marchywka at hotmail.com>
wrote:

>
>
> I'm still curious about the tex scripting options but would just point out
> that when apps have to
> talk to each other, it may be better to generate things like file names in
> one location and then share
> them. Which leads me to my next comment that instead of learning all the
> app specific text processing
> tools, you have sed and awk etc available for every application. You can
> write bash scripts to
> generate shared variables and then have R or tex find them or even write
> bash scripts
> that generate R and tex code. So far I've had good luck with this approach
> and used
> variants for a java based server that needed to make use of R for some (
> slow  ) queries.
>
> You have no idea when you may have to add time zones or even go to
> millisecond times
> for example with dates. Changing this once is a lot easier than hunting
> down all the clients.
>
> Thoughts?
>
> ________________________________________
> From: texhax <texhax-bounces at tug.org> on behalf of William Adams <
> Sent: Wednesday, February 1, 2017 8:19 AM
> To: Christopher W Ryan
> Cc: TeXHaX List
> Subject: Re: [texhax] include a pdf graphics file whose name includes a
> varying date
>
> 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? Or have you never had to do a
> report during the first nine days of a month?)
>
> William
>
> On Tue, Jan 31, 2017 at 5:39 PM, David Carlisle <d.p.carlisle at gmail.com<
> mailto:d.p.carlisle at gmail.com>> wrote:
> \ifnum\thedatemonth<10 0\fi\thedatemonth
>
> David
>
> On 31 January 2017 at 22:33, Christopher W Ryan <cryan at binghamton.edu
> <mailto:cryan at binghamton.edu>> wrote:
> > I'm resurrecting a thread from back in October (month 10--two
> digits--this
> >
> > I am using R and Sweave and MikTeX on Windows 7.  I use this workflow
> > to generate a recurring report quarterly. Same report, just new data.
> >
> > The R code generates a graph, saving it as a pdf file, the filename
> > including the system date., like this:
> >
> > <timeseriesplot, results=hide, echo=FALSE>>=
> > # make the major graph
> > pdf(file=paste("
> > NaloxoneUseEMS-timeseriesplot-", Sys.Date(), ".pdf",
> > sep=""), height=8, width=12)
> > ## bunch of R code in here to create a graph
> > dev.off()
> > @
> >
> >
> >   Each time I run the report, the name of the saved pdf file changes, to
> > match the system date. I want to include the
> > most current graph in my pdf output.
> >
> > William Adams kindly provided this excellent solution:
> >
> > \documentclass{article}
> >
> > \usepackage{datenumber}
> >
> > \begin{document}
> >
> > NaloxoneUseEMS-timeseriesplot-\thedateyear-\thedatemonth-\thedateday
> >
> > \end{document}
> >
> >
> > Which worked very well for a while.  But now that it is January (month
> 1, or
> > 01, and there is the crux of the problem) it no longer does.  Here is
> part
> > of the latex error message that provides a clue:
> >
> >
> > ERROR: LaTeX Error: File ERROR: LaTeX Error: File ERROR: LaTeX Error:
> File
> >
> >
> > So it appears that the Latex package datenumber is searching for the
> > graphics file called
> >
> >
> > NaloxoneUseEMS-timeseriesplot-2017-1-31.pdf (which of course does not
> exist)
> >
> >
> >
> > whereas my R code is creating the graphics file called
> >
> >
> > NaloxoneUseEMS-timeseriesplot-2017-01-31.pdf (which was successfully
> created
> > and is sitting in the proper directory.)
> >
> >
> > Can I make datenumber use 2 digits for \thedatemonth?
> >
> >
> > Thanks.
> >
> >
> > --Chris Ryan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Oct 14, 2016 at 3:15 PM, Christopher W Ryan <
> cryan at binghamton.edu<mailto:cryan at binghamton.edu>>
> > wrote:
> >>
> >> William--
> >>
> >> Fantastic! Thanks!
> >>
> >> --Chris
> >>
> >> On Fri, Oct 14, 2016 at 2:43 PM, William Adams <will.adams at frycomm.com<
> >> wrote:
> >> > \documentclass{article}
> >> >
> >> > \usepackage{datenumber}
> >> >
> >> > \begin{document}
> >> >
> >> > NaloxoneUseEMS-timeseriesplot-\thedateyear-\thedatemonth-\thedateday
> >> >
> >> > \end{document}
> >
> >
> >
> > _______________________________________________
> > TeX FAQ: http://www.tex.ac.uk/faq
> > Mailing list archives: http://tug.org/pipermail/texhax/
> >
> > Automated subscription management: http://tug.org/mailman/
> listinfo/texhax
> > Human mailing list managers: postmaster at tug.org<mailto:post
> master at tug.org>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20170201/27606a98/attachment-0001.html>
`