Thank you all for attempting to enlighten me.  Even the suggestions I 
didn't follow helped me understand the alternatives.

I said:
>... will I have to figure out the syntax well enough to roll my own?

I decided to roll my own.  The reason is the attraction of making LyX work 
off the gnuplot file instead of the *.eps file, with the associated risk 
that the *.eps file will become out-of-date.

My strategy is as follows:

1. Cat the last attachment on this message and
   lib/external_templates to ~/.lyx/external_templates.
   Unfortunately, LyX only supports substitution for
   lib/external_templates, not additions to it.  That means
   I get to cat again every time I upgrade LyX (groan).

2. Put copies of the previous two attachments, eps.gnuplot and
   ascii.gnuplot into any directory that contains Gnuplot plot
   files.

3. Make each Gnuplot plot file (*.gnu) self-contained.  It should
   contain all commands and all data required to create the plot.
   LyX will be tracking the plot files.  If they only contain
   commands and the data are elsewhere, changes in data won't cause
   LyX to remake the *.eps file (or the ASCII text).  An example is
   the first attachment to this message.

While at it, I discovered a buglet in $$Sysdir/scripts/general_command_wrap
per.py.  The statement that prints the redirection message left out a 
blank before the file name:

--- general_command_wrapper.py.orig     Thu Nov 13 14:40:21 2003
+++ general_command_wrapper.py  Fri Dec  5 15:24:21 2003
@@ -13,7 +13,7 @@
        os.close(0)
        sys.stdin = open(sys.argv[1],"r")
 if sys.argv[2] != "-":
-       print "Redirecting" + sys.argv[2]
+       print "Redirecting " + sys.argv[2]
        os.close(1)
        os.close(2)
        sys.stdout = open(sys.argv[2],"w")

Some things I don't like:

1. Eps.gnuplot and ascii.gnuplot should not exist.  There ought to
   be a way to tell Gnuplot to select a terminal type from the
   command line.  I don't the way.

2. So what is the "standard" file name extension of Gnuplot command
   files?  I used *.gnu, but Richard Stallman might have other ideas
   about what that extension should be used for.

3. I only care about the LaTeX format.  I didn't test Ascii, DocBook,
   and LinuxDoc.  Should there be others?

Any comments or criticisms will be appreciated.
set xlabel "Simultaneous Copies"
set ylabel "MFlop/sec"
plot '-' title "Power 4" with linespoints, \
     '-' title "Chapman" with linespoints
1       419
4       1621
8       2871
16      4580
24      5131
32      5491
e
1       85
4       345
8       618
16      1341
24      1787
32      2235
set terminal postscript eps monochrome
set terminal dumb feed
Template Gnuplot
        GuiName "[Gnuplot: $$FName]"
        HelpText
                A Gnuplot graph file.
                File name is of the form, *.gnu.
                Copies of eps.gnuplot and ascii.gnuplot
                must exist in the same directory as
                the Gnuplot graph files.
        HelpTextEnd
        FileFilter "*.gnu"
        ViewCommand "gv $$Basename.eps"
        EditCommand "${VISUAL} $$FName"
        AutomaticProduction true
        Format LaTeX
                Product "\\includegraphics{$$Basename.eps}"
                UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - 
$$Basename.eps gnuplot eps.gnuplot $$FName"
                UpdateResult "$$Basename.eps"
                Requirement "graphicx"
        FormatEnd
        Format Ascii
                Product "$$Contents(\"$$Tempname\")"
                UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - 
$$Tempname gnuplot ascii.gnuplot $$FName"
        FormatEnd
        Format DocBook
                Product "<graphic fileref=\"$$Basename.eps\"></graphic>"
                UpdateCommand "python $$Sysdir/scripts/general_command_wrapper.py - 
$$Basename.eps gnuplot eps.gnuplot $$FName"
                UpdateResult "$$Basename.eps"
        FormatEnd
        Format LinuxDoc
                Product "[Gnuplot: $$FName]"
        FormatEnd
TemplateEnd
M/S 258-5                    |1024-bit PGP fingerprint:|[EMAIL PROTECTED]
NASA Ames Research Center    | 41 B0 89 0A  8F 94 6C 59|     (650) 604-4416
Moffett Field, CA  94035-1000| 7C 80 10 20  25 C7 2F E6|FAX: (650) 604-4377
Not an official NASA position.  You can't even be certain who sent this!

Reply via email to