# Converting legacy amstex picture with \LPic to latex

I am converting legacy amstex code to latex. I am stuck on vector pictures in the document.

In the "main" document, there is code like this:

\centerline{\input fig11.tex}


In the fig11.tex file, there is code, that looks like this:

%%AmSTeX
\LPic 11.8 5.0 fig11.psp
{}{}{
\atxy 20 5 \BText{some description}
%%.....more similar \atxy commands...%%
}


and fig11.psp looks like this (with far more lines of the "same thing"):

81 LBegin
/p0 { 120 5 } def
/p1 { 140 5 } def
/p2 { 70 10 } def
LNarrow
p0 p1 2 LTextloc
p2 p3 3 LTextloc
p3 p4 4 LTextloc
p5 LDot
p6 LDot
p14 p9 LLine
p14 p10 LLine
p15 p11 LLine
p15 p12 LLine
p23 p24 LVector
p26 p25 LVector
LEnd


(It is not a legal postscript.)

Now I don't have a clue how to convert those to something LaTeX will like (it doesn't know the \LPic command, lpic.sty seems like something a bit different and I can't force it to work anyway)

edit:

oh god. It's probably this frankly bizzare thing:

...I am not sure at all what to do with it.

-
This seems a mixture of TeX boxes and PostScript specials; lhead.tex contains several PostScript definitions that might be extracted to convert that .psp into a legal PostScript input; the TeX macros allow for putting boxes at given coordinates over the picture. –  egreg Jun 10 '12 at 9:22
@egreg : yeah, I am looking how to convert those .psp files to legal PostScript files at the moment. –  Karel Bílek Jun 10 '12 at 9:24
Well. What seems to work is just copying the code from the specials (I never knew LaTeX has something like that) on top of the postscripts. That makes them valid PostScript files. –  Karel Bílek Jun 10 '12 at 9:32
Maybe the part from \def\LPic onward can be used as is, by changing \special{psfile=#3} into \includegraphics{#3} –  egreg Jun 10 '12 at 9:43

What seems to be enough at the moment:

1. first, copying the postscript special changes from lhead to all the almost-postscript .psp files
2. add first line to all the .psp files with just %!
3. Adding boundingbox to the ps files with psfixbb
4. converting the .psp files to .pdfs (since I want to use pdflatex in the first place and I don't need to edit the files anymore)
5. deleting the special changes from the lhead file, leaving the rest as-is. (with changing \special{psfile=#3} into \includegraphics{#3}), result is here
6. removing the .psp filenames and replacing them with .pdfs in the fig.tex files
-
Nice to know. Maybe you can add the reduced lhead.tex and a short example of a PS file? –  egreg Jun 10 '12 at 9:50
Wait a minute, I still have some problem with includegraphics. Also, it is not very probable someone else will have this problem, what I am trying to edit was frankly bizzare in the first place –  Karel Bílek Jun 10 '12 at 9:54
Indeed, I've never seen those things. But having here a working procedure is surely good. –  egreg Jun 10 '12 at 10:02
nope... it's still not enough, the postscripts lack "BoundingBox", so they are not converted/imported to latex correctly –  Karel Bílek Jun 10 '12 at 10:07
Maybe you can feed them to ps2eps –  egreg Jun 10 '12 at 10:14