Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using SVG in preparing LaTeX documents

10 views
Skip to first unread message

smithco

unread,
Aug 28, 2006, 7:15:28 AM8/28/06
to
Hello all!

I've been running into an increasingly ugly point in my writing
process. It is simply that there is no easy way to take an SVG image
and include it in a LaTeX document. This is becoming a larger issue as
more tools are only using SVG for a vector format (e.g. desktop tools
like Inkscape and web-based tools like Gliffy). Moreover, there does
not appear to be a good, *free* editor that can read EPS files. Lots
export EPS files, but seemingly none read them.

It is possible to open up Inkscape and manually open an SVG file and
export as an EPS, but this is tedious for lots of images and requires
re-exporting every time a change is made. And if Inkscape isn't the
tool that created the SVG file, then I'm opening and closing Inkscape
just to do a conversion.

I've tried searching around, but I can't find a good solution. I can,
however see a few solutions, and I'd love to know if such tools exist
or are being worked on.

Ideal solution: A LaTeX package & DVI driver that can natively handle
SVG files.

Tolerable solution: A scriptable tool (i.e. a command-line tool) that
can reliably convert from SVG to EPS or PDF.

Less-than-tolerable solution: I grumble and spend a few weekends
figuring out how to write this myself.

Help?

Ralf Stubner

unread,
Aug 28, 2006, 8:08:08 AM8/28/06
to
"smithco" <smi...@gmail.com> writes:

> It is possible to open up Inkscape and manually open an SVG file and
> export as an EPS, but this is tedious for lots of images and requires
> re-exporting every time a change is made.

According to <URL:http://www.inkscape.org/doc/inkscape-man.html>
exporting to EPS can be done with the command line.

cheerio
ralf

smithco

unread,
Aug 28, 2006, 8:28:13 AM8/28/06
to
Thanks for that info. The Inkscape documentation that comes from the
Help menu quite inconveniently fails to include anything regarding
command line usage.

It's also an example of bad design that I'll have to remember. The
in-program documentation must indicate if it is incomplete and where to
find the complete documentation. From the perspective of a user who
just downloaded the program, the command-line parameters are hidden
features. Time to send an irate, but helpful and polite, email to the
Inkscape people.

George N. White III

unread,
Aug 28, 2006, 9:06:09 AM8/28/06
to
On Mon, 28 Aug 2006, smithco wrote:

> I've been running into an increasingly ugly point in my writing
> process. It is simply that there is no easy way to take an SVG image
> and include it in a LaTeX document. This is becoming a larger issue as
> more tools are only using SVG for a vector format (e.g. desktop tools
> like Inkscape and web-based tools like Gliffy). Moreover, there does
> not appear to be a good, *free* editor that can read EPS files. Lots
> export EPS files, but seemingly none read them.

What fonts do you use? Most SVG tools use "system" fonts, while most
LaTeX documents use fonts available only thru TeX. I've been using
inkscape, but for math annotations I convert the fonts to outline paths
so I don't have to deal with font problems. Actually, I have had font
problems because some Win32 systems have a font called Helvetica while
others use aliases to Arial, so inkscape SVG can look different on
different systems.

Inkscape can save to PDF with any non-base fonts embedded. I've never
tried giffy. Have you tried pstoedit and skencil's skconvert?

> It is possible to open up Inkscape and manually open an SVG file and
> export as an EPS, but this is tedious for lots of images and requires
> re-exporting every time a change is made. And if Inkscape isn't the
> tool that created the SVG file, then I'm opening and closing Inkscape
> just to do a conversion.
>
> I've tried searching around, but I can't find a good solution. I can,
> however see a few solutions, and I'd love to know if such tools exist
> or are being worked on.

It is still early days for SVG. It is hard to build tools until you have
a few robust implementations. My impression is that while the core of SVG
follows Adobe Illustrator/PDF, there are some ambiguities with certain
"enhancements". Inkscape, for example, had problems with filled
arrowheads on stroked lines: what color do you use for the filled
arrowheads? Given arbitrary SVG, you can't predict how such ambigities
are handled, so it will be difficult to have general SVG to whatever
tools.

> Ideal solution: A LaTeX package & DVI driver that can natively handle
> SVG files.

The trouble with relying on dvi is that such tools will only be on
interest to the tiny TeX community. In my opinion it is preferable to
work to ensure that general purpose tools support maths requirements
(mostly fonts) than to work on tools that will only interest a small
community. There are many people who would never consider using TeX, but
who would make better use of maths notation if their tools worked
reliably.

> Tolerable solution: A scriptable tool (i.e. a command-line tool) that
> can reliably convert from SVG to EPS or PDF.

This is also a solution that will be of interest to a much wider community
than TeX users, but the general community will want the tools to use
system fonts, while TeX users will want support for cm, lm , etc. There
is progress on making math fonts that can be installed as system fonts and
a tex system (xetex) that can use system fonts. Early versions of Adobe
Acrobat had some problems with math fonts (due to glyphs encoded as
control characters, etc.), so there it is important that TeX users
encourage the developers of SVG tools to fix bugs that get in the way of
maths applications.

> Less-than-tolerable solution: I grumble and spend a few weekends
> figuring out how to write this myself.

In principle, the existing metapost and pdf import tools could be extended
to support some subset of SVG, but metapost is intended to handle fonts in
a way that is consistent with TeX, while SVG tools use system fonts.
Maybe xetex would be a more suitable engine for direct SVG import. I
think there is a lot of work needed to make xetex more robust, getting
inkscape working with math fonts, etc.

--
George N. White III <aa...@chebucto.ns.ca>

smithco

unread,
Aug 28, 2006, 4:32:32 PM8/28/06
to
I hadn't realised that there was such a plethora of issues with the
compatibility between SVG and LaTeX. So far, the above solution to use
the Inkscape command line options is working, but this is only on two
figures and I suspect that the text has been turned into vectors - I'll
have to verify that. However, there's a ton of good info in your post
that will help pinpoint the problem when I run into the a conversion
that doesn't work well.

And since you asked, Gliffy (gliffy.com) is a web-based tool for
creating diagrams. I like it because it very simple, light-weight,
allows for colaboration and particularly good for making flow-charts.

Dirk Krause

unread,
Aug 31, 2006, 4:33:34 AM8/31/06
to
"smithco" <smi...@gmail.com> wrote in news:1156763728.294195.152600@
75g2000cwc.googlegroups.com:

...


> Tolerable solution: A scriptable tool (i.e. a command-line tool) that
> can reliably convert from SVG to EPS or PDF.

...

Hello,
may be Jan Koehnlein's SVGtoPDF.java program is of interest
to you, see
http://www.tu-harburg.de/parallel/koehnlein/privat/SVGtoPDF.java
Hope this helps.
Regards,

Dirk


--
Dirk Krause
Please do not respond to the e-mail address shown in the newsreader.
Use the web form below instead. Thanks.
http://www.fh-schmalkalden.de/url.php?/page/1026/select_wert/3023

0 new messages