Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Kabi, this is all possible, but for now you have to do it all yourself by modifying sws2tex.py. I have done this myself at times.

As you noted, removing the "attachfile" is very simple. I usually also do

shutil.copyfile(temp_dir + os.sep + output_filename + ".tex", output_filename + ".tex")

so I have the original TeX source to look at (or modify).

The easiest way to remove the syntax highlighting is to comment out all the stuff about colorizing, like so (I also do this):

#try:
#    from pygments import highlight
#    from pygments.lexers import PythonLexer, TexLexer, HtmlLexer
#    from pygments.formatters import LatexFormatter
<snip>
#except ImportError:
#    print "Warning: Unable to load module pygments"
#    print "Warning: Syntax highlighting will be disabled"
#
#    def colorize(s, **kwds):
#        return "\\begin{Verbatim}[commandchars=@\\[\\]]\n" + s + "\n\\end{Verbatim}\n"

def colorize(s, **kwds):
    return "\\begin{Verbatim}\n" + s + "\n\\end{Verbatim}\n"

Or you can do your own colorizing. It's also possible to remove this from the place where the stuff happens in the methods for cells.


It's great to hear you use this, by the way; sws2tex is not part of Sage yet, but the hope is that it would eventually be ready for inclusion, and comments like this for options are great to hear.

Kabi, this is all possible, but for now you have to do it all yourself by modifying sws2tex.py. I have done this myself at times.

As you noted, removing the "attachfile" is very simple. I usually also do

shutil.copyfile(temp_dir + os.sep + output_filename + ".tex", output_filename + ".tex")

so I have the original TeX source to look at (or modify).

The easiest way to remove the syntax highlighting is to comment out all the stuff about colorizing, like so (I also do this):

#try:
#    from pygments import highlight
#    from pygments.lexers import PythonLexer, TexLexer, HtmlLexer
#    from pygments.formatters import LatexFormatter
<snip>
#except ImportError:
#    print "Warning: Unable to load module pygments"
#    print "Warning: Syntax highlighting will be disabled"
#
#    def colorize(s, **kwds):
#        return "\\begin{Verbatim}[commandchars=@\\[\\]]\n" + s + "\n\\end{Verbatim}\n"

def colorize(s, **kwds):
    return "\\begin{Verbatim}\n" + s + "\n\\end{Verbatim}\n"

Or you can do your own colorizing. It's also possible to remove this from the place where the stuff happens in the methods for cells.


It's great to hear you use this, by the way; sws2tex is not part of Sage yet, but the hope is that it would eventually be ready for inclusion, and comments like this for options are great to hear.