Richard heck wrote:
Paul A. Rubin wrote:
Before putting an enhancement suggestion into bugzilla, I need to
check my understanding on something. Let's say that a user inserts a
LaTeX macro into ERT that contains a relative path to an external
file. LyX fails to recognize it as a file and therefore does not copy
the source file to the temp directory or modify the path to it. Am I
right that defining a file format and if necessary a copier for it
will not help, because LyX will still not recognize that the ERT code
is a file that needs copying?
Yes, I think you are correct. EXCEPT that I think it is possible to
define some kind of filter that would process the LaTeX file. You could
do this by changing the latex command itself to invoke your script,
which would the invoke platex, or whatever.
Thanks for the response, Richard. This was actually motivated by a
question on the user list, and in that user's particular case there's no
preprocessing involved -- all that's needed (but missing) is for LyX to
copy a source file to the temp directory and then mangle the name in the
ERT to match (the sort of thing done automatically, and correctly, when
I put \includegraphics{...} in ERT).
In my personal use (to date), this has only come up with
\includegraphics, and LyX (now) handles it. (I vaguely recall putting
that in as an enhancement request many versions ago.) The user was
plotting something from a data table (the external file) using the
plotting commands in TiKZ. Since I use TiKZ for other things, it's
possible that somewhere down the road I'll want to use it for plotting
as well, hence my curiosity.
Hypothetically, LyX could scan ERT for anything that looked like a file
name/path, search the file system for a matching file, and if found do
the copy/mangle stuff automatically. That's probably a bigger PITA than
it's worth, plus it would not distinguish the occasional reference to a
file path as a literal. What I had in mind instead was proposing an
LFUN that would let a user mark a string in ERT as a file to be
copied/mangled (and maybe supply an extension if it's one of those weird
things where LaTeX or some LaTeX package insists on assuming an
extension) (and maybe an associated LyX file type if there's a
converter/copier/fluffer that needs to be invoked). Before I stuff it
into bugzilla as an enhancement suggestion, any opinions?
Cheers,
Paul