[OS X TeX] SVG to LaTeX?

Ross Moore ross at ics.mq.edu.au
Wed Jun 28 01:43:20 CEST 2006

Hi Maarten, Alain, and others.

On 26/06/2006, at 10:04 PM, Maarten Sneep wrote:

> On 26-jun-2006, at 13:24, Alain Schremmer wrote:
>> Ross Moore wrote:
>>> Note that {filecontents} and \write18 give a way
>>> to transfer all of your graphics of whatever format
>>> (binary or otherwise) within a LaTeX document.
>>> You first convert them to a text-only archival encoding,
>>> such as .uu or .hqx .
     ... or base64

>>> Use \write18 to execute a command to unpack the archive.
>>> Then just use \includegraphics normally, with the filenames
>>> that exist for the unpacked archive.
>>> Of course graphics sent this way are not editable,
>>> as they would be if in SVG format.
>> Now let me see if I got this right: This an alternative to the  
>> above that is more compact but at the cost of the graphics not  
>> being editable which wouldn't be acceptable for a GPL.

This is a way of sending everything within one .tex  file,
using a text-encoding, rather than a binary or archival format.
There are circumstances where this might be preferable to
downloading and unpacking an archive, to get all the pieces.

In practice, you would best follow the {filecontents} environment
with a command that tests for the existence of one of the unpacked
files; if not found, then use a \write18 command to do the required
unpacking and/or de-compressing.

I don't see the problem with GPL. In my understanding,
you only need to provide permission to edit the graphics;
e.g. using tools that are freely available, such as GIMP.
Thus .png and .jpg are quite acceptable formats to use,
as would be .pbm, .ppm and some others (less useful though,
as fewer tools and browsers can work with these).

The .gif  format is encumbered, not by the format itself
but by the algorithm that is usually used to compress
your bitmap image into (and out of) that format.
In effect the encumbrance affects the tools that are used
to edit the graphics, but not the graphics themselves.

There's no problem with .ps or .eps graphics.
These can be edited within any text-editor.
But you better know the PostScript programming language
pretty well if you are going to do anything more than
very simple things!

Similarly with .pdf --- except that this can be much harder,
because it requires keeping track of byte-offsets,
and there are usually compressed streams.

> I may be missing something, but I thought that a filecontents  
> environment is extracted the first time a latex job runs.

Yes it is --- unless the extracted file exists already.

> After that the svg files are available for normal editing. Putting  
> the svg files back into the tex source after editing is tedious, I  
> agree.

By putting the editable .svg file into a {filecontents}
then you can edit it in-place, within the LaTeX source.
To use the changes, you will need to remove any copies
that were extracted on a previous LaTeX run.

> OTOH, normally graphics files are just send along in an archive,  
> but here you could use svg instead of pdf, and have a correct  
> translation done just before inclusion (a Makefile, or explicitly  
> in the latex sources). This is much the same compared to the way  
> metapost figures are included inpdftex.

Sure; but it's surprising how many people are terrified
to attempt to use 'make', or any other command-line tool.
There have been messages to this list where people don't even
know how to launch  Terminal.app , or just don't want to.

I'd expect everyone on this list has friends and colleagues
that are like this.

> Maarten



Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the macostex-archives mailing list