# DVISVGM and PSTricks

EPS file conversion is not satisfactory with dvisvgm because labels are not displayed.

  \documentclass[a4paper,11pt]{article}
\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools,amsmath,amsfonts,amssymb,amsthm,mathrsfs,nccmath}
\usepackage{pstricks}
\usepackage[frenchb]{babel}
\begin{document}
\TeXtoEPS
\psset{xunit=4cm,yunit=2cm,algebraic=true,arrowscale=1.2}
\begin{pspicture}(-1.5,-3)(2.5,2.5)
\psgrid[gridwidth=0.6pt,subgriddiv=0,gridlabels=0,gridcolor=lightgray,xunit=0.25,yunit=0.5](-6,-6)(10,5)
\psaxes[linewidth=1pt,Dx=1,Dy=1,labels=none,ticksize=-3pt 0pt]{->} (0,0)(-1.5,-3)(2.5,2.5)
\psxTick[ticksize=-3pt](1.25){\frac{5}{4}}
\psxTick[ticksize=-3pt](0.666666666666){\frac{2}{3}}
\begin{psclip}
{\psframe[linestyle=none](-1.5,-3)(2.5,2.5)}
{\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{6*x-3}}%
{\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{1-(2-3*x)^2}}%
\end{psclip}
\psline[linestyle=dashed,dash=3pt 2pt](0,1)(0.666666666666,1) (0.666666666666,0)
\uput[dl](0,0){O}
\uput[d](1,0){I}
\uput[l](0,1){J}
\uput[ur](1.25,-2){$\mathscr{C}_{f}$}
\uput[ur](0.75,1){$\mathscr{C}_{g}$}
\uput[d](2.42,0){$x$}
\uput[l](0,2.35){$y$}
\end{pspicture}
\endTeXtoEPS
\end{document}


Compiled with this simple Makefile:

 all:
latex fichier.tex
dvips -Ppk -V -E -o fichier.eps fichier.dvi
dvisvgm -E --libgs=/usr/lib/libgs.so.9 fichier.eps fichier.eps
gpicview fichier.svg

-
I get an error ! Use of \psaxes@ii doesn't match its definition. –  egreg Jul 25 '13 at 10:55

• it makes no sense to use the environment TeXtoEPS
• spaces between arguments of \psaxes are not allowed
• there is no need for using the eps file
\documentclass[a4paper,11pt]{article}
\usepackage{etex}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mathtools,amsmath,amsfonts,amssymb,amsthm,mathrsfs,nccmath}
\usepackage[frenchb]{babel}
\begin{document}

\psset{xunit=4cm,yunit=2cm,algebraic=true,arrowscale=1.2}
\begin{pspicture}(-1.5,-3)(2.5,2.5)
\psgrid[gridwidth=0.6pt,subgriddiv=0,gridlabels=0,gridcolor=lightgray,xunit=0.25,yunit=0.5](-6,-6)(10,5)
\psaxes[linewidth=1pt,Dx=1,Dy=1,ticksize=-3pt 0pt]{->}(0,0)(-1.5,-3)(2.5,2.5)
\psxTick[ticksize=-3pt](1.25){\frac{5}{4}}
\psxTick[ticksize=-3pt](0.666666666666){\frac{2}{3}}
\begin{psclip}{\psframe[linestyle=none](-1.5,-3)(2.5,2.5)}
\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{6*x-3}
\psplot[linewidth=0.8pt,plotpoints=2000]{0}{1.25}{1-(2-3*x)^2}
\end{psclip}
\psline[linestyle=dashed,dash=3pt 2pt](0,1)(0.666666666666,1) (0.666666666666,0)
\uput[dl](0,0){O}
\uput[d](1,0){I}
\uput[l](0,1){J}
\uput[ur](1.25,-2){$\mathscr{C}_{f}$}
\uput[ur](0.75,1){$\mathscr{C}_{g}$}
\uput[d](2.42,0){$x$}
\uput[l](0,2.35){$y$}
\end{pspicture}

\end{document}


with the sequence:

latex fichier.tex
dvisvgm --libgs=/usr/lib64/libgs.so.9 child.dvi


However, there is a problem with the correct math font.

-
There's no problem with the math font but with the SVG viewer. :) Call dvisvgm with option -n to create an SVG file that can be rendered correctly by most SVG viewers. –  Martin Jul 25 '13 at 12:39
@Herbert Rather the sequence : dvisvgm child.dvi –  Fabrice Jul 25 '13 at 13:53
@ Martin This actually seems to work with the sequence dvisvgm -n fichier.dvi, even though I'll have to change the position of some labels in the source file. –  Fabrice Jul 25 '13 at 13:59
@Fabrice Can you give us some more information? The positions of what labels do you have to adapt? The generated SVG and the PS file created with dvips look almost identical to me. –  Martin Jul 25 '13 at 14:15
@Martin It's ok !! –  Fabrice Jul 25 '13 at 16:18