[OS X TeX] SVG to LaTeX?

Alain Schremmer Schremmer.Alain at gmail.com
Mon Jun 26 07:24:49 EDT 2006


Ross Moore wrote:

> Hello Alain,
>
> On 24/06/2006, at 4:45 AM, Alain Schremmer wrote:
>
>> William Adams wrote:
>>
>>> On Jun 23, 2006, at 11:24 AM, Alain Schremmer wrote:
>>>
>>>> Is there a way to convert the SVG pictures into something that I 
>>>> could then incorporate in the LaTeX source to get one single file?
>>>>
>>>
>>> Have you found this?
>>>
>>> http://me.in-berlin.de/~darwin/svg/svg2pdf.html
>>>
>>> should be able to set things up so that an svg is transparently 
>>> converted to a .pdf at need using svglib
>>>
>> Well, once again, I was not clear.
>>
>> What you mention is not what I am looking for because I already Save 
>> in Intaglio/SVG and also Save A Copy in cropped pdf which is what 
>> gets included with \includegraphics{pdf}.
>
>
> Yes, it is a viable solution if you use the following
> kind of LaTeX coding.
>
> In the preamble:
>
> \begin{filecontents*}{mypicture.svg}
> ... SVG coding for a picture ...
> \end{filecontents*}
>
> In the document body:
>
> \begin{figure}
> \centering
> \immediate\write18{svg2pdf mypicture.svg mypicture.pdf}%
> \includegraphics{mypicture.pdf}
> \caption{...}\label{...}
> \end{figure}
>
>> But if I were to send you the book for you to edit, I would have to 
>> send you:
>>
>> - the LaTeX source
>> - plus all the pdf that are included so you can typeset it
>> - plus all the SVG so you can edit the graphics.
>
>
> With the (editable) SVG source included via {filecontents} you don't 
> have to supply it separately.
> Nor do you need to supply the PDF, since this will be created 
> on-the-fly, provided the svg2pdf program is
> available.

Now let me see if I got this right:

- I get the SVG code from RedCircle.svg. (I don't know how to do that's 
not the point right now.)
- I place the SVG code for RedCircle in the preamble of the document.
- I insert before the line \includegraphics{RedCircle.pdf}the line 
\immediate\write18{svg2pdf RedCircle.svg mypicture.pdf}%
- TeXShop will show the red circle when typesetting if the svg2pdf 
program is … where?
- If I want to edit the red circel, I get RedCircle.svg from the SVG 
code in the preamble.

If I did get it right, I think that I am going to start looking for how 
to get the SVG code from RedCircle.svg to give it a try.

> 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 .
> 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.

Grateful regards
--schremmer
------------------------- 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 MacOSX-TeX mailing list