2

I'm trying to draw smooth curves with variable width using PSTriks. The results I'm getting don't have the quality I need. For example, from this piece of code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pstricks-add}

\begin{document}
\begin{pspicture}(-2.5,-2.5)(2.5,2.5)
    \pscurve[variableLW,startLW=1pt,endLW=20pt]%
   (-1,0.5)(-2,1)(2,2)(-1,-2)(2,-2)
\end{pspicture}
\end{document}

that I got from the documentation, I get the following: result

As you can see, it has a few blank spaces. How can I avoid that?

Note: I need the output to be SVG, so to compile the code I'm doing:

latex file.tex 
dvips file.dvi
inkscape file.ps --export-plain-svg=file.svg

UPDATE: I'm new to this, and I forgot to check the .ps, this is what it looks like:

enter image description here

  • Have you checked whether the DVI is working? If it doesn't have the problems it's an Inkscape bug. – TeXnician Apr 22 '17 at 17:30
  • Does the postscript file also have the same problem? If not, it might be an inkscape problem, and probably offtopic here. – mickep Apr 22 '17 at 17:31
  • If I compile with xelatex, the resulting pdf also shown blank spaces, so the problem must be somewhere else. – Jennifer Hurtado Apr 22 '17 at 17:34
  • I can't say who is the culprit: After latex, dvips, and ps2pdf, the PDF viewed with evince (some document viewer) looks fine, but in all other combinations (ps viewed with ghostview, evince or okular, pdf viewed with ghostview or okular) the image is scrambled, like the second picture above. – gernot Apr 22 '17 at 17:40
1

run the example only with latex->dvips->ps2pdf. There are some problems mith xelatex:

or use package auto-pst-pdf and run pdflatex --shell-escape <file>

\documentclass{article}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\begin{document}
\begin{pspicture}(-2.5,-2.5)(2.5,2.5)
\pscurve[variableLW,startLW=1pt,endLW=20pt]%
    (-1,0.5)(-2,1)(2,2)(-1,-2)(2,-2)
\end{pspicture}
\end{document}

and

inkscape --without-gui --file=PSTricks.pdf --export-plain-svg=PSTricks.svg

works also very well.

enter image description here

|improve this answer|||||
  • I don't think that this solves the problem. I used this chain, and the result depends on the viewer. The image looks like yours only for one viewer, but not for the other two. And none of the viewers was able to display the ps file correctly, whatever correct means. – gernot Apr 22 '17 at 18:04
  • the ps file is not of interest here. Use the pdf file. – user2478 Apr 22 '17 at 18:07
  • To me it is unclear what the contents of the image really is, if it displays differently for various combinations of viewers and file formats. In fact, if it's a majority vote, than the meaning of the pstricks code is the second scrambled image. Is it clear that the code in the ps/pdf file is ok and all the viewers are buggy? – gernot Apr 22 '17 at 18:18
  • The pdf file looks fine, so thank you very much for that. However, the svg file still shows blank spaces; I guess that means it's a inkscape problem and that it's offtopic, but if you someone knows a way to fix it I would appreciate it. – Jennifer Hurtado Apr 22 '17 at 18:25
  • @JenniferHurtado: I have no idea what inkscape does. However, if you need it only for one image, then take a screenshot, save it in the pnm format and create with potrace a vector image file which has only the contour and convert it to svg. – user2478 Apr 22 '17 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.