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

Christopher W Ryan cryan at binghamton.edu
Fri Feb 3 19:06:04 CET 2017


Thank you everyone for your help, which solved my problem.

--Chris Ryan

On Tue, Jan 31, 2017 at 5:39 PM, David Carlisle <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>
> wrote:
> > I'm resurrecting a thread from back in October (month 10--two
> digits--this
> > is of consequence).  My challenge was 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
> > `NaloxoneUseEMS-timeseriesplot-2017-1-31' not found.
> >
> >
> > 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>
> > 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/
> > More links: http://tug.org/begin.html
> >
> > Automated subscription management: http://tug.org/mailman/
> listinfo/texhax
> > Human mailing list managers: postmaster at tug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20170203/85afe5f5/attachment.html>


More information about the texhax mailing list