How to produce png image with transparent background with latex.eval

275 views
Skip to first unread message

Shing Hing Man

unread,
Jan 2, 2010, 3:49:29 PM1/2/10
to sage-support
I am using Sage 4.0.2. The myImage.png produced by the following
command has a white background.

latex.eval("$\\frac{1}{2}$", {}, filename="/home/foo/myImage.png")

Is it possible to have transparent background ?

Thanks in advance for any assistance!

Shing

Jason Grout

unread,
Jan 2, 2010, 4:46:00 PM1/2/10
to sage-s...@googlegroups.com


Try something like this:

plot(x^2,(x,0,1),transparent=True)

It's an option to "show". Options to show are automatically passed from
plot commands to the function that displays it. See
http://sagemath.org/doc/reference/sage/plot/plot.html?highlight=show#sage.plot.plot.Graphics.show

Thanks,

Jason

Shing Hing Man

unread,
Jan 3, 2010, 12:30:57 PM1/3/10
to sage-support
Hi Jason,
Thanks for the reply! But I would like the png file of a latex
expression, not a plot, to have transparent background.

Shing

> plot commands to the function that displays it.  Seehttp://sagemath.org/doc/reference/sage/plot/plot.html?highlight=show#...
>
> Thanks,
>
> Jason

ma...@mendelu.cz

unread,
Jan 3, 2010, 4:36:41 PM1/3/10
to sage-support

On 3 led, 18:30, Shing Hing Man <mat...@yahoo.com> wrote:
> Hi Jason,
>   Thanks for the reply! But I would like the png file of a latex
> expression, not a plot,  to have transparent background.
>

Do you really need to produce this png by Sage? Why not direct LaTeX
and some postprocessors?
btw: for example mathtex produces transparent background (and sources
are available).

http://www.forkosh.dreamhost.com/source_mathtex.html

Robert

Reply all
Reply to author
Forward
0 new messages