SVG & LaTeX

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

SVG & LaTeX

Postby Emu* » Fri Apr 03, 2009 2:01 pm UTC

I've recently become a LaTeX convert, via LyX (pretty much the Dreamweaver of TeX). I have a Final Year BSc Project to finish writing up, and need a way of including diagrams, UML etc.

I have moderate Inkscape skills, but can't quite work out what I should actually be doing to achieve the desired result of an SVG as a figure.

Windows XP
LyX 1.5.7
MiKTeX 2.7
Inkscape 0.4.6

(I also have an eee running Ubuntu 8.04LTS and the repo versions of LyX and Inkscape installed, but I don't fancy working on a 7" screen)

edit:
Thread is in this forum because I don't know where else might contain TeX users!

I may need some help getting references to websites working with JabRef 2.4.1/BiBTeX and LyX later, books/papers only so far.
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

User avatar
taby
Posts: 154
Joined: Thu Nov 01, 2007 8:39 pm UTC
Location: Canada

Re: SVG & LaTeX

Postby taby » Fri Apr 03, 2009 5:04 pm UTC

It seems that SVG is a no-go in LaTeX:
http://www.latex-community.org/forum/vi ... 32&p=15861

The recommended method of attack is to save the drawing in either PDF or EPS format. I myself use EPS for all diagrams and plots, whether they be vector or bitmap.

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: SVG & LaTeX

Postby Emu* » Fri Apr 03, 2009 6:48 pm UTC

Hokay... One extra inbetween step, but I guess it'll work!

Have you used BiBTeX much?
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

User avatar
taby
Posts: 154
Joined: Thu Nov 01, 2007 8:39 pm UTC
Location: Canada

Re: SVG & LaTeX

Postby taby » Fri Apr 03, 2009 8:59 pm UTC

No, sorry. I just use the built-in "thebibliography" section, though I really should use BiBTeX... My own way of writing down a reference seem to change from paper to paper, and I assume that BiBTeX would get rid of that problem.

User avatar
sparkyb
Posts: 1091
Joined: Thu Sep 06, 2007 7:30 pm UTC
Location: Camberville proper!
Contact:

Re: SVG & LaTeX

Postby sparkyb » Fri Apr 03, 2009 9:49 pm UTC

Yeah, back when I used to use LyX I'd just export all my figures to .eps. Which leads to a funny story. I was taking a class where most of our assignments we did in Matlab. I was writing up my assignment in LyX, including figures that were EPS exports of images and graphs from from Matlab. Most of them were bitmap images because it was a computer vision class and we were mostly doing image manipulation. However, one was a 3D plot. Apparently instead of generating an image of the plot in an EPS file, Matlab output this plot as the PostScript code to calculate and draw the graph. And because I was using LaTeX and saving it out as either a .ps or .pdf that was preserved all the way though, even to the print (since PostScript is the language of printers). So in the middle of printing the 12 pages of my assignment the printer just stops for about an hour while it had to calculate the image of the graph in 3D itself.

mrkite
Posts: 336
Joined: Tue Sep 04, 2007 8:48 pm UTC

Re: SVG & LaTeX

Postby mrkite » Mon Apr 06, 2009 7:03 am UTC

I use PDF via Inkscape's Cairo PDF 1.4 exporter. (Built into the linux version, dunno about windows).

User avatar
b.i.o
Green is the loneliest number
Posts: 2519
Joined: Fri Jul 27, 2007 4:38 pm UTC
Location: Hong Kong

Re: SVG & LaTeX

Postby b.i.o » Tue Apr 07, 2009 2:52 am UTC

sparkyb wrote:However, one was a 3D plot. Apparently instead of generating an image of the plot in an EPS file, Matlab output this plot as the PostScript code to calculate and draw the graph. And because I was using LaTeX and saving it out as either a .ps or .pdf that was preserved all the way though, even to the print (since PostScript is the language of printers). So in the middle of printing the 12 pages of my assignment the printer just stops for about an hour while it had to calculate the image of the graph in 3D itself.

Makes sense. That's the only way to get a vector image of the graph. If you want a raster image, export to a raster filetype or rasterize the image before you print it.

laclaro
Posts: 1
Joined: Sat Nov 19, 2011 3:16 pm UTC

Re: SVG & LaTeX

Postby laclaro » Sun Nov 20, 2011 10:11 am UTC

Hi,

This thread is quite old, but not completely solved anyway. With the new inkscape-versions you can easily define a command \includesvg{file} to include a SVG-vector-images in LaTeX files.

Because this is a new account I cannot post any links, but you can easily google "SVG+laclaro" and will find the blog entry I wrote about this.
There's also a manual on ctan. Google "SVG+latex+pdf" for this.

Have a nice time and lot's of fun with this method.
Regards

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: SVG & LaTeX

Postby Emu* » Tue Nov 29, 2011 4:00 pm UTC

I can't remember how I got around the original cause of this tread, but recently I started designing a bike frame and found the PStricks package a great option, especially as I needed to define tubes in terms of angles and relative positions.
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: SVG & LaTeX

Postby EvanED » Tue Nov 29, 2011 4:50 pm UTC

The other thing to look at is PGF/Tikz (manual) which is a monster package but really awesome.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 5 guests