On 1 lis, 13:49, Wilfried_Huss <h...@finanz.math.tugraz.at> wrote:
> On 29 Okt., 12:44, "ma...@mendelu.cz" <ma...@mendelu.cz> wrote:
>
> > Hello all, the conversion into PDF has been discussed several times
> > here.
>
> > One option is to print into a PDF file. This is another possibility:
>
> > I wrote for myself a simple converter from Sage worksheets to PDF via
> > PDF LaTeX
>
> Great, this is exactly what I need.
>
> > You can see the outputs in the bulletted list 
> > athttp://user.mendelu.cz/marik/sage/
> > , for examplehttp://user.mendelu.cz/marik/sage/dr.pdf
>
> > The initial version of the script is 
> > athttp://user.mendelu.cz/marik/sage/sage2tex
> > and is neither cleanly written nor clever too much, but still "better
> > than get a wire into your eye" - as we say in Czech :)
>
> > For whom is this topic worth
>
> > Feel free to use it or modify as you need.
>
> I have modified the skript a little bit.


Great, I have seen that you improved it a lot! Thanks.

I have two another improvements (and changed the script at
http://user.mendelu.cz/marik/sage/sage2tex )

First:

The following lines can be used to process tables created by
html.table command, see the file http://user.mendelu.cz/marik/sage/integral.pdf

    obsah=string.replace(obsah,"<table class=\"table_form\">","{\
\offinterlineskip\\halign{\\vrule \\vrule width 0 pt height 14pt depth
5pt # &&\\vrule  # \\cr\\noalign{\\hrule}")

    obsah=string.replace(obsah,"<tbody>","%")
    obsah=string.replace(obsah,"</tbody>","%")
    obsah=string.replace(obsah,"</table>","\\noalign{\\hrule}}}")
    obsah=string.replace(obsah,"<tr>","\\global\\def\\optcr{\\vskip 2
pt\\hrule}")
    obsah=string.replace(obsah,"<tr class =\"row-a\">","\\global\\let\
\optcr\\relax{}")
    obsah=string.replace(obsah,"<tr class =\"row-b\">","\\global\\let\
\optcr\\relax{}")
    obsah=string.replace(obsah,"</tr>","\\cr\\noalign{\\hrule\
\optcr}")
    obsah=string.replace(obsah,"<th>","\\quad\\textbf{")
    obsah=string.replace(obsah,"</th>","} & ")
    obsah=string.replace(obsah,"<td>","\\quad ")
    obsah=string.replace(obsah,"</td>"," & ")


Second:  TeX does not understand \textcolor[HTML]{ff0000}{stuff}. So
these lines convert into \textcolor[HTML]{FF0000}{stuff} (replacement
for previous version of this regexp substitution)

    regular=re.compile(r"<span style=\"color: #(.*?);\">")
    obsah=regular.sub(lambda x: "\\textcolor[HTML]{"+x.group(1).upper()
+"}{",obsah)



> You can find the new version of the script at:
>    http://www.math.tugraz.at/~huss/sage/sws2tex.py
>
> And here are example outputs:
>    http://www.math.tugraz.at/~huss/sage/sage_tutorium.pdf
>    http://www.math.tugraz.at/~huss/sage/sws2pdf_test.pdf
>
> Would you agree to release your initial script under the GPL or an
> other Sage compatible
> licence? I hope this can be improved to a point where it could be
> included into Sage, for
> this it needs a proper licence.

I am O.K. with any free licence, GNU GPL,  Creative Commons or any
other.

In fact, the script was so simple that I was not thinking about any
licence.

I have no skills in programing in Python or any other object oriented
langugae and you cannot expect, that I can help to improve it into a
form which could be used for sufficiently big set of sage worksheets,
including complicated html, 3D graphics, included external pictures
and some other things.

Would you like to work a bit deeper on conversion between Sage and
TeX? If yes, then everything is up to you and from my point of view it
is sufficient to state somewhere, that the initial version was based
on the work of Robert Marik.

Thank you very much
Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to