[TxMt] Latex to CSS (pygments ?)
Charilaos Skiadas
skiadas at hanover.edu
Sun Feb 4 21:10:05 UTC 2007
On Feb 4, 2007, at 3:57 PM, Alexander Ross wrote:
> Alain,
>
> You need to set up your path. See my previous email.
>
> - Alex
>>
>> Pygments is install this code work :
>>
>> import codecs
>> from pygments import highlight
>> from pygments.lexers import TexLexer
>> from pygments.formatters import HtmlFormatter>>> from
>> pygments.formatters import HtmlFormatter
>> from pygments.lexers import TexLexer
>> from pygments.formatters import HtmlFormatter
>> fileObj = codecs.open("/Users/ego/Desktop/sign-diagram.tex", "r" ,
>> "utf8")
>> code = fileObj.read()
>> filecontent = highlight(u, TexLexer(), HtmlFormatter())
>> unicodefilecontent = unicode(filecontent)
>> out = file( "/Users/ego/Desktop/sign-diagram.html", "w")
>> out.write(unicodefilecontent)
>> out.close()
>>
>> when i run python !
As Alex said, you need to work a bit with your path settings because
you have two pythons installed, and only one of them has Pygments.
And it is not the one that your computer can find without
the .bash_profile file. Or change the first line in the script to
point directly to the correct python executable. So probably
something like:
#!/Library/Frameworks/Python.framework/Versions/Current/bin/python
instead of the current:
#!/usr/bin/env python
And also, the above code does not run properly in fact even if you
have Pygments, because the "u" in the filecontent=... line should
have been a "code" ;).
>> Alain
Haris
More information about the textmate
mailing list