On Wed, Nov 12, 2008 at 4:10 PM, Denilson Barbosa <denilson.barbosa@gmail.com> wrote:
hi there,

I've made this feature request for improving the latex bundle and got
a reply that maybe the user discussion list would be more appropriate.
So here it is:

pstricks remains extremely useful and pdflatex seems to be the future
of LaTeX, although it does not support pstricks directly.

There is a simple and elegant way of having then coexist, which is to
use the pst-pdf package, which defines a new environment to wrap
pstricks figures. However, this now requires that we compile the ps
and pdf parts separately as follows:

   latex <file.tex>
   dvips -Ppdf -o <file-pics.ps> <file.dvi>
   ps2pdf -dAutoRotatePages=/None <file-pics.ps> <file-pics.pdf>
   pdflatex <file.tex>

This is properly documented in
http://tug.org/PSTricks/main.cgi?file=pdf/pdfoutput

The LaTeX bundle should be extended with a new test to see if the
pst-pdf package is loaded and perform the steps above, removing the
.ps file after the last step.

Has anyone been able to extend the latex bundle with a way to handle pst-pdf?

I am curious to know how many people such an extension would benefit.  I think one of the nice things about the Bundle as it stands now is that it does the things that the majority of people want pretty well.  And... it is extensible enough for cases like this to be handled elegantly by the user.

For example:  These lines could be  re-written placed in a script file in your home directory somewhere:
   latex <file.tex>
   dvips -Ppdf -o <file-pics.ps> <file.dvi>
   ps2pdf -dAutoRotatePages=/None <file-pics.ps> <file-pics.pdf>
   pdflatex <file.tex>

The lines above would need to be re-written to use the TM_FILENAME environment variable as follows:

#!/bin/bash

filebase=`basename -s .tex ${TM_FILENAME}
latex ${TM_FILENAME}
dvips- -Ppdf -o $filebase-pics.ps $filebase.dvi
ps2pdf -dAutoRotatePages=/None $filebase-pics.ps $filebase-pics.pdf
pdflatex ${TM_FILENAME}
rm $filebase-pics.ps


Now, at the top of your latex file you can put the line:

%!TEX TS-program = /path/to/my/script 

From now on the LaTeX bundle will use your script to typeset your file.  Because the script is written using TM_FILENAME it will work for any files you want to do this with.

If this is a common case, then I think it would be good to add to the Bundle directly but if this is something only used by 1 or 2 people then I think the solution above is the way to go.

Brad




 

Thanks

Denilson

_______________________________________________
textmate mailing list
textmate@lists.macromates.com
http://lists.macromates.com/listinfo/textmate



--
Brad Miller
Assistant Professor, Computer Science
Luther College