mailing-list for TeXmacs Users

Text archives Help


Re: math writing in eps figure


Chronological Thread 
  • From: "Juan Pablo Romero" <address@hidden>
  • To: address@hidden
  • Subject: Re: math writing in eps figure
  • Date: Fri, 20 Jun 2003 14:41:48 +0000

Hi

I've made a little ruby script based on fig2ps. It converts sketch files to eps and uses psfrag. It could be
easily modified to handle another source format.

It works like this:

you provide your sketch file, say "image.sk" and a tex file containing the sustitutions, say "image.tex"

for example ("image.tex"):
--------------------------
\centering
\setlength{\fboxsep}{0.1\fboxsep}
\psfrag{1}{$1=p_2(\frac{\zeta _3}{\sqrt[3]{3}})$}
\psfrag{2}{$2=p_2(\zeta _3)$}
\psfrag{d}{$\frac{1}{\sqrt[3]{3}} \zeta _3$}
\psfrag{D}{$D$}
\includegraphics{image}
--------------------------

Then to generate "image.eps" just call the script

$ ./sk2psfrag.rb image.sk

The only problem is that "image.eps" has the wrong bounding box (I haven't found the apropiated option to dvips (besides -E), or perhaps is dvips's fault), so you'll have to manually adjust the bounding box in the eps).

Regards


Juan Pablo

PS save the text as sk2psfrag.rb and chmod 755

------------cut here---------------

#!/bin/env ruby

def principal(base)
<<CADENA
\\documentclass{article}
\\usepackage{graphics, amsmath, amsfonts, amssymb, color, psfrag, bbm}
\\setlength{\\oddsidemargin}{0cm}
\\setlength{\\evensidemargin}{0cm}
\\setlength{\\textwidth}{10cm}


\\begin{document}
\\pagestyle{empty}

\\begin{figure}
\\include{#{base}}
\\end{figure}

\\end{document}
CADENA
end

def procesa(filesk)
p filesk
base = filesk.split(".")[0]
tmpdir = base + ".tmpdir"
`mkdir #{tmpdir}`
`sk2ps #{filesk} #{tmpdir}/#{base}.eps`
`ln -s ../#{base}.tex #{tmpdir}`
File.open(tmpdir+"/main.tex", "w") do |file|
file.print principal base
end
`cd #{tmpdir}; latex --interaction batchmode main`
`cd #{tmpdir}; dvips -E -o main.ps main.dvi`
`cp -f #{tmpdir}/main.ps #{base}.eps`
`rm -rf #{tmpdir}`
end

ARGV.each {|f| procesa f}


------------cut here---------------

_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: http://messenger.microsoft.com/es




Archive powered by MHonArc 2.6.19.

Top of page