Paolo_Grigis <pgrigis@astro.phys.ethz.ch> writes:
> Gernot Hassenpflug wrote:
>> Hello all,
>>
>> I have used IDL to output EPS figures with whatever fonts IDL has
>> built-in. Now I would like to use IDL to output EPS fragments (in
>> vector format) with markers for the text information, and .tex files
>> containing the text corresponding to the markers, with both files to
>> be later interpreted by LaTeX with an \input statement. With matlab,
>> which I do not currently have a licence to, this was possible using
>> the user-contributed laprint program.
>>
>> With such a splitting of the tasks, it is easy to adjust text size and
>> font to what is required in the LaTeX document.
>>
>> Is there any way to do such a task in IDL (I have 6.2 and 6.3 licences
>> at my workplace).
>>
>> Alternatively, if there is a way to use Computer Modern fonts with
>> IDL, I could try to use those in the EPS file directly (then output in
>> binary format is fine too).
/../
> I've done so in a few occasion, and it worked out fine.
> Here's an example with IDL, LaTeX and unix commands, which
> I put together with some help from this newsgroup a while ago:
Many thanks! That is great news, my search of this group had turned up
only mention of LaTeX package psfrag in 1997...
> IDL commands to generate a figure with b and t as text markers:
>
> N=1000
>
> x=findgen(N)/(N-1)*10-5
>
> mu=0.
> sigma=1.
>
> y=total(exp(-(x-mu)^2/(2*sigma^2)),/cumulative)*(x[1]-x[0])
>
> set_plot,'PS'
> device,filename='fig1.eps',/encapsulated,xsize=12.,ysize=8.
> !p.font=0
I'll try this at work in the morning, for use. Is the setting of font
to 0 one of the critical tricks?
> plot,x,y,yrange=[0.,3.],thick=4,/xstyle,xrange=[-5,5],xtitle ='x',ytitle='y'
> oplot,!X.crange,sqrt(2*!Pi)*sigma*[1,1],linestyle=2
>
> xyouts,0.,1.,'t',/data
> xyouts,-3,2.65,'b'
> device,/close
> set_plot,'X'
OK, understood.
> ;END IDL
>
> LaTeX file:
>
> \documentclass{article}
> \usepackage{geometry}
> \usepackage{graphicx}
> \usepackage{psfrag}
> \pagestyle{empty}
> \geometry{paperwidth=12.1cm,paperheight=8.1cm,margin=0pt}
Excellent! So the below could be put into a separate .tex file and
\input into the main document as I am used to doing under Matlab with
the laprint program.
> \begin{document}
> \psfrag{t}[l][][1.35]{$\displaystyle y=\int_{-\infty}^x
> e^{-\left(\frac{t-\mu}{\sqrt{2}\sigma}\right)^2}\,\mathrm{d} t$}
> \psfrag{x}[c][][1.75]{$x$}
> \psfrag{y}[c][][1.75]{$y$}
> \psfrag{b}[c][][1.35]{$\displaystyle y=\sqrt{2\pi}\sigma$}
> \includegraphics[width=11.9cm,height=7.9cm]{fig1.eps}
> \end{document}
Understood.
> %end latex
>
>
> Linux command to TEX and transform into eps:
>
> latex doc.tex
> dvips -o fignew.ps doc.dvi
Yes, OK.
> ps2epsi fignew.ps fignew.epsi
> perl -ne 'print unless /^%%BeginPreview/../^%%EndPreview/' < fignew.epsi > fignew.eps
> rm fignew.epsi
Ah, this part is new to me. Any idea what this is repairing, since
you've already specified emcapsulated PS in your IDL program. (I
understand the perl part after that to remove the preview TIFF image.)
> Now you should have an eps file with equations rather than "t" and "b" labels...
>
> Hope this helps,
> Paolo Grigis
Fantastic! I'll let you know how this goes.
Best regards,
Gernot
--
Gernot Hassenpflug, NICT, Tokyo
|