From: Adam Warner
Subject: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.27.00.34.40.964984@consulting.net.nz>
Hello c.l.l. and c.t.t,

I'm trying to work out the best way to turn Lisp numerical data into
typeset quality graphs processed using TeX. This will be fully automated
from program through to TeX markup.

Two approaches seem applicable:

1. I generate markup for an external program that creates a PS/EPS file. I
then include a link to that file in the TeX output.

2. I emulate a TeX graphing language and the TeX markup is directly
included in the TeX output.

I'm looking for information on the best packages for either approach. Any
TeX graphing language will have to be AMS-LaTeX compatible.

I envisage needing the ability to draw numbered and titled axes and line
plots. I'm after your advice because I don't want to overlook the best
approach. This Lisp library to gnuplot seems valuable:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/clocc/clocc/src/cllib/gnuplot.lisp

Using this code would also require me to GPL the distributed program. And
that would require other people to GPL their documents (i.e. code)
distributed in this Lisp document format (think of the implications if you
had to GPL any TeX markup you distribute).*

Regards,
Adam

* Because the document format is Lisp code and would link to a GPLed
program through function calls any third party document code would
arguably have to be distributed under the GPL. In the code=data world of
Lisp the GPL gains extraordinary breadth.

From: Nils Goesche
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <87vg3o124b.fsf@darkstar.cartan>
"Adam Warner" <······@consulting.net.nz> writes:

> Because the document format is Lisp code and would link to a
> GPLed program through function calls any third party document
> code would arguably have to be distributed under the GPL. In
> the code=data world of Lisp the GPL gains extraordinary
> breadth.

That's why people have invented the ``LLGPL'':

  http://opensource.franz.com/preamble.html

Regards,
-- 
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0
From: Adam Warner
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.27.05.59.59.71239@consulting.net.nz>
I wrote in part earlier today:

> 1. I generate markup for an external program that creates a PS/EPS file.
> I then include a link to that file in the TeX output.
> 
> 2. I emulate a TeX graphing language and the TeX markup is directly
> included in the TeX output.
> 
> I'm looking for information on the best packages for either approach.

After further research it appears that producing graphs via gnuplot is
clearly the best way to proceed. LaTeX and Postscript are two of the
native output formats. David Kotz's 1991 "LaTeX and the GNUPLOT Plotting
Program" provides a number of quality examples using LaTeX output.

Regards,
Adam
From: Brian Elmegaard
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <wkk7k3owav.fsf@mail.afm.dtu.dk>
"Adam Warner" <······@consulting.net.nz> writes:

> 1. I generate markup for an external program that creates a PS/EPS file. I
> then include a link to that file in the TeX output.

Consider metapost for this.


-- 
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
From: Adam Warner
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.28.08.31.21.663006@consulting.net.nz>
Hi Brian Elmegaard,

> "Adam Warner" <······@consulting.net.nz> writes:
> 
>> 1. I generate markup for an external program that creates a PS/EPS
>> file. I then include a link to that file in the TeX output.
> 
> Consider metapost for this.

Thanks for the tip! I missed this approach. The paper "Drawing Graphs with
MetaPost" is directly applicable:
http://cm.bell-labs.com/who/hobby/mppubs.html

gnuplot can also output metapost:
ftp://ftp.ucc.ie/pub/gnuplot/ANNOUNCEMENT

o new drivers for BeOS, metapost, MacOS X Server

So now I have to decide whether to generate gnuplot input or directly
generate metapost input files.

Regards,
Adam
From: Brian Elmegaard
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <wkwuo2or2t.fsf@mail.afm.dtu.dk>
"Adam Warner" <······@consulting.net.nz> writes:

> So now I have to decide whether to generate gnuplot input or directly
> generate metapost input files.

I would indeed be interested in the metapost approach. If interested,
I can send you some example mpgraph files.  

-- 
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
From: Adam Warner
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.28.10.01.26.554347@consulting.net.nz>
Hi Brian Elmegaard,

> "Adam Warner" <······@consulting.net.nz> writes:
> 
>> So now I have to decide whether to generate gnuplot input or directly
>> generate metapost input files.
> 
> I would indeed be interested in the metapost approach. If interested, I
> can send you some example mpgraph files.

Please go ahead and send the examples. I'm warming to the direct MetaPost
approach. It's certainly an incredibly powerful graphics language and
incorporates wonderful curve fitting techniques.

I'm going to have to confirm that these graphics will integrate with
TeX4ht.

Regards,
Adam
From: Brian Elmegaard
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <wkof9eooj5.fsf@mail.afm.dtu.dk>
"Adam Warner" <······@consulting.net.nz> writes:

> Please go ahead and send the examples. 

Grab them from 
http://sunsite.dk/dk-tug/mp_be.html
The source of the one on page 15 is on 
http://sunsite.dk/dk-tug/ifgt5.mp

Let me know if you need anything else. 

> I'm warming to the direct MetaPost
> approach. It's certainly an incredibly powerful graphics language and
> incorporates wonderful curve fitting techniques.

Absolutely, and it is the only format usable with both pdflatex and latex.

> I'm going to have to confirm that these graphics will integrate with
> TeX4ht.

Maybe you will need to run them through tex and dvips first for this,
in order to include fonts.

I posted an elisp defun last week doing this.

-- 
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
From: Adam Warner
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.28.12.41.26.645816@consulting.net.nz>
Hi Brian Elmegaard,

> Grab them from 
> http://sunsite.dk/dk-tug/mp_be.html
> The source of the one on page 15 is on 
> http://sunsite.dk/dk-tug/ifgt5.mp
> 
> Let me know if you need anything else. 

Many thanks Brian. And thanks for the tips.

Regards,
Adam
From: Pratibha
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <18e1cdb3.0210291906.6f1e6d5b@posting.google.com>
> Consider metapost for this.

Now if only the language were Lisp instead of METAPOST.
    Lisp --> PostScript
instead of
    Lisp --> METAPOST --> PostScript

Can the METAPOST world do text rotated at any angle?
For example, for labelling vertical axes, vertical grid
lines, data points, etc.  I guess the general question is,
does METAPOST - or in what way if any does METAPOST -
prevent you from accessing the full power of PostScript.
What if you want PostScript text rather than TeX text?

PostScript can do rotated text, but I wonder whether
METAPOST insists on the TeX model for text which cannot.
At least not cleanly, from my recollection.  I remember
having to resort to kludges involving \special from
within (La)TeX to "subvert" TeX and get directly at
PostScript's ability to transform (and specifically
rotate) the coordinate system.

> It's certainly an incredibly powerful graphics language and
> incorporates wonderful curve fitting techniques.

Is there no Lisp library directly implementing such
"powerful graphics" and "wonderful curve fitting"
so that we could be zero or one step rather than two steps
removed from the end page descroption language of PostScript?

Is it Lisp's destiny to always be the glue or the
generator rather than the final or at least
next-to-final description language?
Never the best actress, always the supporting role?
From: Matthew Danish
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <20021030035737.P384@lain.res.cmu.edu>
CL-PDF: generate PDF files from Common Lisp

<http://ww.telent.net/cliki/CL-PDF>

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."
From: Håkon Alstadheim
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <m03cqo823r.fsf@alstadhome.dyndns.org>
Matthew Danish <·······@andrew.cmu.edu> writes:

> CL-PDF: generate PDF files from Common Lisp
>
> <http://ww.telent.net/cliki/CL-PDF>

When I follow the link from there to the cl-pdf homepage at 
<http://www.fractalconcept.com/asp/html/cl-pdf.html> I get:


<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</H1>
403 Forbidden
</BODY>
</HTML>


I'd like to find out why, but that belongs to some other newsgroup I
guess.

-- 
H�kon Alstadheim, hjemmepappa.
From: Marc Battyani
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <870FD35BE2D7E50C.1028B94174AEE783.5CC0B254BA85E5B5@lp.airnews.net>
"H�kon Alstadheim" <······@online.no> wrote
> Matthew Danish <·······@andrew.cmu.edu> writes:
>
> > CL-PDF: generate PDF files from Common Lisp
> >
> > <http://ww.telent.net/cliki/CL-PDF>
>
> When I follow the link from there to the cl-pdf homepage at
> <http://www.fractalconcept.com/asp/html/cl-pdf.html> I get:
>
>
> <HTML>
> <HEAD><TITLE>An Error Occurred</TITLE></HEAD>
> <BODY>
> <H1>An Error Occurred</H1>
> 403 Forbidden
> </BODY>
> </HTML>

Sorry for that, but I was at the ILC and my server was down...
Should be ok now.

Marc
From: Brian Elmegaard
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <wku1j475n4.fsf@mail.afm.dtu.dk>
··········@yahoo.com (Pratibha) writes:

> Can the METAPOST world do text rotated at any angle?

Yes to all of this.

> For example, for labelling vertical axes, vertical grid
> lines, data points, etc.  I guess the general question is,
> does METAPOST - or in what way if any does METAPOST -
> prevent you from accessing the full power of PostScript.

It doesn't but it uses a simple subset of postscript as output. 


> What if you want PostScript text rather than TeX text?

TeX-output /is/ postscript (or pdf if you compile with pdflatex).

> PostScript can do rotated text, but I wonder whether
> METAPOST insists on the TeX model for text which cannot.

It does and does not. Check the manual and the mpgraph.pdf to be found
on CTAN.

This is how to do it.
  label.rt(btex Times etex rotated 46 withcolor red, origin);
  label.top(btex \textsf{helvet} etex rotated 99 withcolor blue, origin);
  label.lft(btex \texttt{courier} etex rotated 176 withcolor green, origin);


> PostScript's ability to transform (and specifically
> rotate) the coordinate system.

You can do it several ways, if I understand correctly. Your approach
is one option, but there are pstricks and the rotating package for
this.

> Is there no Lisp library directly implementing such
> "powerful graphics" and "wonderful curve fitting"
> so that we could be zero or one step rather than two steps
> removed from the end page descroption language of PostScript?

Well, the simplicity of metapost and the number of abailable packages
in my view provides such a "powerful" application, that the work to
put in order to skip the metapost stage would be a complete
reimplementation in lisp. Emacs already comes with a metapost-mode,
and the whole process may be automized in emacs, so why try to skip
the step. 

> Never the best actress, always the supporting role?

The manager, perhaps?
No reason to reinvent the wheel.

cheers,
-- 
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
From: Hannah Schroeter
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <apoq06$fkq$2@c3po.schlund.de>
Hello!

Brian Elmegaard  <·····@rk-speed-rugby.dk> wrote:
>[...]

>> What if you want PostScript text rather than TeX text?

>TeX-output /is/ postscript (or pdf if you compile with pdflatex).

Last time I checked, TeX still output dvi.

>[...]

Kind regards,

Hannah.
From: Brian Elmegaard
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <wkn0ovj6hh.fsf@mail.afm.dtu.dk>
······@schlund.de (Hannah Schroeter) writes:

> Last time I checked, TeX still output dvi.

:-)

In metapost, TeX label are output as postscript.

-- 
Brian (remove the sport for mail)
http://www.et.dtu.dk/staff/be
From: Ed L Cashin
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <8765ussyer.fsf@cs.uga.edu>
Brian Elmegaard <·····@rk-speed-rugby.dk> writes:

> ······@schlund.de (Hannah Schroeter) writes:
> 
> > Last time I checked, TeX still output dvi.
> 
> :-)
> 
> In metapost, TeX label are output as postscript.

pdftex and pdflatex are tex variants authored by Han The Thanh.  They
produce dvi or pdf output directly.

Hans Hagen has created some macros that allow you to use the output
files from metapost in your pdftex-generated pdf files.

-- 
--Ed L Cashin            |   PGP public key:
  ·······@uga.edu        |   http://noserose.net/e/pgp/
From: Thomas F. Burdick
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <xcvof9bn7wo.fsf@famine.OCF.Berkeley.EDU>
··········@yahoo.com (Pratibha) writes:

> > Consider metapost for this.
> 
> Now if only the language were Lisp instead of METAPOST.
>     Lisp --> PostScript
> instead of
>     Lisp --> METAPOST --> PostScript

You're missing this path:

      Lisp --> METAPOST --> PDF

Which is the major reason to avoid directly generating PS.  It's a
lovely language, and it's so easy to build Lisp abstractions that
produce it, but it's be largely displaced by PDF.  Not completely, but
largely.

> Is it Lisp's destiny to always be the glue or the
> generator rather than the final or at least
> next-to-final description language?
> Never the best actress, always the supporting role?

Of course not, don't be stupid.  However, when integrating with TeX,
it makes the most sense to integrate as closely as possible.

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Adam Warner
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <pan.2002.10.30.08.07.27.720626@consulting.net.nz>
Hi Pratibha,

> Is there no Lisp library directly implementing such "powerful graphics"
> and "wonderful curve fitting" so that we could be zero or one step
> rather than two steps removed from the end page descroption language of
> PostScript?
> 
> Is it Lisp's destiny to always be the glue or the generator rather than
> the final or at least next-to-final description language? Never the best
> actress, always the supporting role?

I have discovered that a Postscript Level 1 complier for Common Lisp was
released into the public domain 18 years ago:

http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/io/plisp/0.html

Regards,
Adam
From: Marc Battyani
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <190C2B53A6775582.4FA7EB2FA8C08434.866392DC0241DC8B@lp.airnews.net>
"Pratibha" <··········@yahoo.com> wrote in
> Now if only the language were Lisp instead of METAPOST.
>     Lisp --> PostScript
...
> Is it Lisp's destiny to always be the glue or the
> generator rather than the final or at least
> next-to-final description language?
> Never the best actress, always the supporting role?

I use cl-pdf for this. I generate pdf charts/drawings and I include them in
pdfLaTeX.
cl-pdf is at www.fractalconcept.com/asp/html/cl-pdf.html

Marc
From: bend0r
Subject: Re: Generating graphs in Lisp to include in (La)TeX
Date: 
Message-ID: <apq5b0$50b$1@oyez.ccc.nottingham.ac.uk>
> I'm trying to work out the best way to turn Lisp numerical data into
> typeset quality graphs processed using TeX. This will be fully automated
> from program through to TeX markup.

Take a look at Plot-2D library for Garnet:

http://www.cs.nott.ac.uk/~rvb/lisp/plot-2d/

Make your plot and then just export the window into a PostScript file using
Garnet  make-ps function.

regards!

roman