[OS X TeX] SVG to LaTeX?

Ross Moore ross at ics.mq.edu.au
Sun Jun 25 23:59:34 EDT 2006


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.


> So, my question, triggered by the  threads  "Should I install X11"  
> and "making pictures", is whether there is a way automatically to  
> convert SVG graphics into code that could then be inserted into the  
> LaTeX source which would then result in a single source file that  
> you would then be able both to print and edit.

Going SVG --> LaTeX is not needed.
That adds a step which would be quit difficult to achieve
in any reliable way, depending perhaps on the complexity
of the graphics that you are trying to draw.


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.


>
> Best regards
> --schremmer


Hope this helps.

	Ross

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