Using pgfsys-tex4ht.def to make svg output

View: New views
4 Messages — Rating Filter:   Alert me  

Using pgfsys-tex4ht.def to make svg output

by Andrew Lyons :: Rate this Message:

| View Threaded | Show Only this Message

Hi,

I'm trying to make a figure in svg (it's for wikipedia), and it seems
that TikZ is the most convenient way to make exactly what I want.
The manual says it's possible to output svg, but I'm not currently
able to realize this.  I'm using the CVS version, and I also appear to
get the same behavior from version 2.00.

Here's my attempt in LaTeX:
%=================================================================
\documentclass{article}
\def\pgfsysdriver{pgfsys-tex4ht.def}
\usepackage{tikz}
%---------------------------------------------------------------------
\begin{document}
\thispagestyle{empty}
\begin{center}
  \huge
  \begin{tikzpicture}[ultra thick,scale=4]
    \foreach \color/\pos/\name in
{{red/(0,-1.5)/a},{blue/(0.9,-2.25)/b},{orange/(0,-2.25)/c},{violet/(-0.9,-2.25)/d},{green/(0,-3)/e}}
      \node[\color,draw,circle,fill=white,minimum size=22pt,inner
sep=0pt] (\name) at \pos {\name};
    \foreach \src/\tgt in {a/b,a/c,a/d,b/c,c/d,b/e,d/e}
      \draw (\src) -- (\tgt);
    \clip[draw] (0,0) circle (1cm);
    \draw[red] (-1,0) -- (1,0.8) node[pos=0.5,above=-0.75mm] {a};
    \draw[blue] (-1,1) -- (1,-0.5) node[pos=0.7,above=-1mm] {b};
    \draw[orange] (0.75,1) -- (-1,-1) node[pos=0.55,right=-1mm] {c};
    \draw[violet] (-1,0.75) -- (0,-1) node[midway,left=-0.8mm] {d};
    \draw[green] (-0.5,-1) -- (1,0) node[midway,above=-0.9mm] {e};
  \end{tikzpicture}
\end{center}
\end{document}
%=================================================================

When I try to run latex this, I get the following error:
...
ABD: EveryShipout initializing macros
! Undefined control sequence.
\@begindocumenthook ...dcolor \fi } \ConfigureEnv
                                                  {pgfpicture}{}{}{}{}  \pgf...
l.5 \begin{document}


without the "\def\pgfsysdriver{pgfsys-tex4ht.def}", or if I put it
after the "\usepackage{tikz}" (the manual says to put it before), it
creates the dvi just fine, but then when I run tex4ht on the .dvi file
all I get is an html file whose only contents are "abcdeabcde"
(literally).

I also tried using plain tex (rather than LaTeX), but in that case I
get the following error:
...
(/home/lyonsam/texmf/tex/generic/pgf/generic/pgf/systemlayer/pgfsys-tex4ht.def
! Undefined control sequence.
l.13 \RequirePackage
                    {xcolor}

Sorry if I'm missing something obvious!  I'm new to TikZ, this is my
first attempt at using tex4ht, and I'm new to really tweaking
TeX/LaTeX.
Any help would be appreciated!  Also, if someone has a concrete
example of creating svg output, that would be great too.
Thanks for TikZ/pgf!

Best,

Andrew


--
------------------------------------------
Lyons, Andrew Myers

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Using pgfsys-tex4ht.def to make svg output

by Axel E. Retif :: Rate this Message:

| View Threaded | Show Only this Message

On  14 Apr, 2008, at 12:41, Andrew Lyons wrote:

> Hi,
>
> I'm trying to make a figure in svg (it's for wikipedia), and it seems
> that TikZ is the most convenient way to make exactly what I want.
> The manual says it's possible to output svg, but I'm not currently
> able to realize this.  I'm using the CVS version, and I also appear to
> get the same behavior from version 2.00.

I took your code exactly as it is, save it as ALcode.tex and in a  
terminal session just did

htlatex ALcode.tex

Every file was produced fine; I opened the .svg in Illustrator and,  
besides the font substitution (no Computer Modern for Illustrator),  
everything looks OK.

I'm sending you privately the files.


Best,

Axel



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Using pgfsys-tex4ht.def to make svg output

by Andrew Lyons :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, Apr 14, 2008 at 1:12 PM, Axel E. Retif <axel.retif@...> wrote:

> On  14 Apr, 2008, at 12:41, Andrew Lyons wrote:
>
>  > Hi,
>  >
>  > I'm trying to make a figure in svg (it's for wikipedia), and it seems
>  > that TikZ is the most convenient way to make exactly what I want.
>  > The manual says it's possible to output svg, but I'm not currently
>  > able to realize this.  I'm using the CVS version, and I also appear to
>  > get the same behavior from version 2.00.
>
>  I took your code exactly as it is, save it as ALcode.tex and in a
>  terminal session just did
>
>  htlatex ALcode.tex
>
>  Every file was produced fine; I opened the .svg in Illustrator and,
>  besides the font substitution (no Computer Modern for Illustrator),
>  everything looks OK.
>

Axel,

Thanks!  I tried running htlatex on the tex file, as you did, and it worked.
I might clean up the SVG first, but you should see the figure at
http://en.wikipedia.org/wiki/Circle_graph soon.

I suppose the manual could be a bit clearer (it talks about using
tex4ht specifically to transform .dvi to .html), but it's hard to
fault the manual writers/editor.  they've clearly put in an enormous
amount of work, and I appreciate it.

Best,

Andrew
--
------------------------------------------
Lyons, Andrew Myers
412.951.0816

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users

Re: Using pgfsys-tex4ht.def to make svg output

by Axel E. Retif :: Rate this Message:

| View Threaded | Show Only this Message

Andrew,

> [...]

> Axel,
>
> Thanks!  I tried running htlatex on the tex file, as you did, and  
> it worked.
> I might clean up the SVG first, but you should see the figure at
> http://en.wikipedia.org/wiki/Circle_graph soon.

I see it's already there, and that, by clicking in the figure, you're  
taking to a page with the graphic and the LaTeX/TikZ source code.

Congratulations.


Axel

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
pgf-users mailing list
pgf-users@...
https://lists.sourceforge.net/lists/listinfo/pgf-users