2

I generated a PStrick macros .tex file from a .svg using Inkscape 0.91 (Shift+Ctr+S, save as LaTeX with PStrick macros) but I am not able to include it in my document I have tried:

\documentclass{article}
\usepackage[pdf]{pstricks}
\begin{document}

\begin{figure}
    \centering
    \input{image.tex}
\end{figure}

\end{document}

But it seems that some packages is missing. To try on your own if you don't want to install inkscape, you can save as a .tex file the following code, that I've generated using inkscape.

%LaTeX with PSTricks extensions
%%Creator: inkscape 0.91
%%Please note this file requires PSTricks extensions
\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}
\begin{pspicture}(744.09448819,1052.36220472)
{
\newrgbcolor{curcolor}{0 0 1}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(129.74527979,894.28571241)
\lineto(307.39757299,894.28571241)
\curveto(311.21360267,894.28571241)(314.2857132,891.21360188)(314.2857132,887.39757221)
\lineto(314.2857132,778.31671303)
\curveto(314.2857132,774.50068336)(311.21360267,771.42857283)(307.39757299,771.42857283)
\lineto(129.74527979,771.42857283)
\curveto(125.92925012,771.42857283)(122.85713959,774.50068336)(122.85713959,778.31671303)
\lineto(122.85713959,887.39757221)
\curveto(122.85713959,891.21360188)(125.92925012,894.28571241)(129.74527979,894.28571241)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 1}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(274.2857132,731.42858046)
\curveto(274.2857132,655.68667578)(207.76802226,594.2857297)(125.71429079,594.28572767)
\lineto(125.7142868,731.42858046)
\closepath
}
}
\end{pspicture}
  • Please help us help you by turning your code into a minimal compilable example (i.e. with documentclass, packages, document environment) and specify how you are compiling. – TeXnician Feb 21 '19 at 12:12
  • As always ion this site, please post full minimal examples that others can copy and test as is. Then we don't have to guess. Plus we probably need the contents of image.tex – daleif Feb 21 '19 at 12:12
  • dflatex has only very limited support for pstricks, you could remove the [pdf] option aand use latex,dvips,ps2pdf rather than pdflatex, but of starting with svg, why not simply save as pdf and include that? – David Carlisle Feb 21 '19 at 12:26
  • @DavidCarlisle thanks a lot, but unfortunately it doesn't work. Mainly I would like to have control over the text included in the image, that's why I usually use tikz. – G M Feb 21 '19 at 12:40
  • 2
    you need to provide an example that people can use, and show the exact error message you get, if you just post code people can not run and say "it doesn't work" there isn't much help that can be given. – David Carlisle Feb 21 '19 at 12:45
3

use

\documentclass{article}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\begin{document}

    \begin{figure}
        \centering
        \input{image.tex}
    \end{figure}

\end{document}

and run it with

pdflatex --shell-escape <file>

enter image description here

However: the PSTricks export from Inkscape is rubbish ...

|improve this answer|||||

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.