Thursday, May 29, 2008

pdftotext

recently i needed to rip the text out of a pdf file so i could read it on my pda. (it doesn't have a pdf reader right now, and even if i got one it would take forever to render all the images.) here's a command that works pretty well, even preserving the layout with pretty good accuracy: pdftotext -layout -enc ASCII7 -nopgbrk file.pdf file.txt

Thursday, May 22, 2008

gmplayer with .m3u

i found a good way to use gmplayer with .m3u files from my streaming music server (using ampache). i made a little bash script: #!/bin/bash # cache up to 16MB, so it won't get cut off if paused # since the cache is so big, only cache 1% before starting #echo Opening "$1" # for firefox #gmplayer -cache 16384 -cache-min 1 -playlist $@ # for opera (it makes filenames like "playlist (3).m3u", and it waits for this script to finish) gmplayer -cache 16384 -cache-min 1 -playlist "$1" & then i set up my browser to run this with the downloaded .m3u as the argument.

plplot

i just tried out plplot, in my eternal saga to find a good publication-quality 3d plotting package for python. looks pretty good and the interface isn't too bad. it looks like it will only spit out hardcopies; i can't find an interactive mode. fine for publication, a little inconvenient for debugging/prototyping. also, the only really standard vector formats are b+w and color postscript. but i could ps2pdf with no problems and tremendously improved compression. i tried the /usr/share/plplot/examples/python/xw08.py example from the admittedly old 5.5.2 for a surface contour. i did need to put in plinit() after the import plplot line for it to work. i also used plscolbg(255,255,255) to make a white background, with decent results.

Thursday, May 8, 2008

rubber and sam2p

i'm always on the lookout for packages that combine my two loves: python and tex. looks like rubber will allow me to drive latex from python (even though it was made to have a cli). i'm not sure if it's still maintained, but it has a great way to add functionality based on modules. i've also just tried out sam2p for converting rasters to eps and pdf. it does indeed result in _much_ smaller files than imagemagick's convert, especially for eps. i did have to download, build, and install tif22pnm for sam2p to work with pngs. the link was buried in a huge readme, which was less than convenient, but it works now. EDIT: this might be a smaller, simpler alternative to rubber. might be pre-alpha, though. here's another one that is small and simple and probably will work.
and plastex converts latex to html.

Thursday, May 1, 2008

installing tex packages

it had been a while since i'd installed latex packages, but it was easy once i remembered how. just put the stuff in a searched directory (such as /usr/share/texmf/tex/latex/) and run mktexlsr. some packages come as .dtx files; run tex (not latex) on these first to generate the files you need.