I use gnuplottex package quite a lot to draw graphs, and my own bashful package to write include computer output in a document I write. Yet another package of this sort allows one to include metapost output within your document.
The problem is that running all these commands from within LaTeX makes the document processing very slow. I seek an enhanced version of (say) gnuplottex, which given
\begin{gnuplot}[terminal=pdf,]
gnuplot commands
\end{gnuplot}
would compute a check sum of gnuplot commands, compare it to a value from a previous run, and they differ, would run gnuplot again; otherwise, it will just use the previously generated pdf file. I imagine you would need to use an auxiliary file for that, but I am not sure I understand the tradeoffs if any: should once save in the auxiliary file a checsum, or the entire data? How does one compare it?
Presumably, the invocation syntax would be:
\IfChanged{commands}{\regenerate}{\reuse}
where \regenerate is a user macro taking a single argument, which would be passed commands as argument. Command \reuse would somehow reuse the previous run's output. I am not even sure this is the right syntax.
Yet another challenge is to design the command in such a way that the user would not have to add a label to make it distinct from other calls to it.
Clarification: One way of doing that is the following: let h be hash function which generates (say) a 32 bits number. Then you could have a command of the following sort:
\IfChanged{commands}{\regenerate}{\use}
Where:
\regenerateis a two arguments macro.\useis a single argument macro.- '
IfChangedwill compute the h(commands), and if the value has changed, it will invoke:\regenerate{commands}{h(commands)}and then\use{h(x}} - If h(commands) did not change, then it would just invoke
\use{h(x}} \regenerate{commands}{h(commands)}would do some computation, placing the output in a file namedh(commands)- The command
\use{h(x}}would include the fileh(commands)
I hope this clarifies the idea a bit. I would have to think some more about the exact design.
More on context: I have at least three applications in mind - the first is using the bashful package to show computer output on the screen, second is the use of gnuplottex to plot functions (not data), and (c) use of metapost to draw uml diagrams and other stuff.
The command would not be useful as is for running an external "make" to generate experimental data. For this one would need a command that would do the LaTeX equivalent of the following pseudo code:
If (updated(rawDataFile(s) ))
exec(Make).
Include(outputFile)
but this is less of a problem I think, since you could always run from your command line:
% make all; pdflatex main.tex
