1

I am trying to use \input{.} to import externally created pstricks graphics. These .tikz pictures are created by inkscape. When I try to import the picture using \input, I get this following error

error in line 16 Undefined control sequence }
error in line 28 Undefined control sequence }
error in line 40 Undefined control sequence }
error in line 52 Undefined control sequence }
error in line 64 Undefined control sequence }
error in line 76 Undefined control sequence }
error in line 99 Undefined control sequence }
error in line 146 Undefined control sequence }
error in line 193 Undefined control sequence }
error in line 223 Undefined control sequence }
error in line 270 Undefined control sequence }

the concerned snippet is below:

%&lualatex
% !TeX program = lualatex
\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{pstricks} 
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{tikz}
\begin{document}
    g
\begin{figure}[h]
    \centering{
        \resizebox{0.5\textwidth}{!}{\input{drawing8.tex}}}
    \caption{your caption} \label{fig:figureone}
\end{figure}
\end{document}

and the drawing8.tex is

\psset{xunit=.5pt,yunit=.5pt,runit=.5pt}
\begin{pspicture}(793.7007874,1122.51968504)
{
\newrgbcolor{curcolor}{0.20784314 0.20784314 0.39215687}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(294.28571348,669.86465198)
\lineto(294.28571348,422.85714322)
\lineto(372.39153095,444.50257385)
\lineto(372.39153095,652.87944509)
\closepath
}
}
{
\newrgbcolor{curcolor}{0.68627453 0.68627453 0.87058824}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(294.28571348,422.85714322)
\lineto(631.42857453,264.29872692)
\lineto(677.6075585,348.80709764)
\lineto(372.39153095,444.50257385)
\closepath
}
}
{
\newrgbcolor{curcolor}{0.9137255 0.9137255 1}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(372.39153095,652.87944509)
\lineto(677.6075585,727.97185096)
\lineto(677.6075585,348.80709764)
\lineto(372.39153095,444.50257385)
\closepath
}
}
{
\newrgbcolor{curcolor}{0.3019608 0.3019608 0.62352943}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(294.28571348,669.86465198)
\lineto(631.42857453,794.28571578)
\lineto(677.6075585,727.97185096)
\lineto(372.39153095,652.87944509)
\closepath
}
}
{
\newrgbcolor{curcolor}{0.84313726 0.84313726 1}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(631.42857453,794.28571578)
\lineto(631.42857453,264.29872692)
\lineto(677.6075585,348.80709764)
\lineto(677.6075585,727.97185096)
\closepath
}
}
{
\newrgbcolor{curcolor}{0.52549022 0.52549022 0.74901962}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(294.28571348,669.86465198)
\lineto(631.42857453,794.28571578)
\lineto(631.42857453,264.29872692)
\lineto(294.28571348,422.85714322)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(480.08370896,537.81248024)
\lineto(479.88839646,537.81248024)
\curveto(479.34152148,537.94268857)(478.80766733,538.0338344)(478.28683401,538.08591773)
\curveto(477.77902153,538.1510219)(477.1735528,538.18357398)(476.47042782,538.18357398)
\curveto(475.33761535,538.18357398)(474.24386538,537.92966774)(473.18917792,537.42185525)
\curveto(472.13449045,536.9270636)(471.11886548,536.28253237)(470.14230301,535.48826156)
\lineto(470.14230301,519.99998078)
\lineto(466.47042812,519.99998078)
\lineto(466.47042812,541.81638637)
\lineto(470.14230301,541.81638637)
\lineto(470.14230301,538.59373022)
\curveto(471.6006363,539.76560518)(472.88318834,540.59242807)(473.98995914,541.07419889)
\curveto(475.10975078,541.56899055)(476.24907366,541.81638637)(477.40792779,541.81638637)
\curveto(478.0459486,541.81638637)(478.50818817,541.79685512)(478.7946465,541.75779262)
\curveto(479.08110482,541.73175096)(479.51079231,541.67315721)(480.08370896,541.58201138)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(500.53292761,519.99998078)
\lineto(496.88058397,519.99998078)
\lineto(496.88058397,522.32419946)
\curveto(496.55506314,522.1028453)(496.11235482,521.79034531)(495.55245901,521.38669948)
\curveto(495.00558402,520.9960745)(494.47172987,520.68357451)(493.95089656,520.44919951)
\curveto(493.33891741,520.14972036)(492.63579243,519.90232453)(491.84152162,519.70701204)
\curveto(491.04725081,519.49867871)(490.11626125,519.39451204)(489.04855295,519.39451204)
\curveto(487.08240718,519.39451204)(485.41574056,520.04555369)(484.0485531,521.34763699)
\curveto(482.68136564,522.64972028)(481.99777192,524.30987648)(481.99777192,526.32810559)
\curveto(481.99777192,527.98175137)(482.3493344,529.31638675)(483.05245938,530.33201172)
\curveto(483.7686052,531.36065752)(484.78423017,532.16794916)(486.09933429,532.75388664)
\curveto(487.42745925,533.33982413)(489.02251129,533.73695953)(490.8844904,533.94529286)
\curveto(492.74646951,534.15362618)(494.74516737,534.30987618)(496.88058397,534.41404284)
\lineto(496.88058397,534.98044908)
\curveto(496.88058397,535.81378238)(496.73084439,536.50388653)(496.43136523,537.05076151)
\curveto(496.14490691,537.5976365)(495.72824025,538.02732398)(495.18136527,538.33982398)
\curveto(494.66053195,538.63930313)(494.03553197,538.84112604)(493.30636533,538.94529271)
\curveto(492.57719868,539.04945937)(491.81547995,539.1015427)(491.02120914,539.1015427)
\curveto(490.05766751,539.1015427)(488.98344879,538.97133437)(487.79855299,538.71091771)
\curveto(486.61365719,538.46352189)(485.3896989,538.09893857)(484.1266781,537.61716775)
\lineto(483.93136561,537.61716775)
\lineto(483.93136561,541.34763639)
\curveto(484.64751142,541.54294888)(485.68266764,541.75779262)(487.03683426,541.99216762)
\curveto(488.39100089,542.22654261)(489.72563627,542.34373011)(491.04074039,542.34373011)
\curveto(492.57719868,542.34373011)(493.91183406,542.21352178)(495.04464652,541.95310512)
\curveto(496.19047982,541.70570929)(497.18006313,541.2760218)(498.01339643,540.66404266)
\curveto(498.83370891,540.06508434)(499.45870889,539.29034478)(499.88839638,538.33982398)
\curveto(500.31808387,537.38930317)(500.53292761,536.21091779)(500.53292761,534.80466783)
\closepath
\moveto(496.88058397,525.37107436)
\lineto(496.88058397,531.44529293)
\curveto(495.76079234,531.38018877)(494.43917779,531.28253252)(492.91574034,531.15232419)
\curveto(491.40532372,531.02211586)(490.20740709,530.83331378)(489.32199045,530.58591796)
\curveto(488.26730298,530.2864388)(487.41443842,529.81768881)(486.76339677,529.179668)
\curveto(486.11235513,528.55466802)(485.7868343,527.68878263)(485.7868343,526.58201183)
\curveto(485.7868343,525.33201187)(486.16443846,524.38800148)(486.91964677,523.74998066)
\curveto(487.67485508,523.12498068)(488.82719879,522.81248069)(490.37667791,522.81248069)
\curveto(491.66574038,522.81248069)(492.84412576,523.05987652)(493.91183406,523.55466817)
\curveto(494.97954236,524.06248065)(495.96912566,524.66794939)(496.88058397,525.37107436)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(524.59542641,519.99998078)
\lineto(520.94308277,519.99998078)
\lineto(520.94308277,522.32419946)
\curveto(520.61756194,522.1028453)(520.17485362,521.79034531)(519.61495781,521.38669948)
\curveto(519.06808282,520.9960745)(518.53422867,520.68357451)(518.01339535,520.44919951)
\curveto(517.40141621,520.14972036)(516.69829123,519.90232453)(515.90402042,519.70701204)
\curveto(515.10974961,519.49867871)(514.17876005,519.39451204)(513.11105175,519.39451204)
\curveto(511.14490598,519.39451204)(509.47823936,520.04555369)(508.1110519,521.34763699)
\curveto(506.74386444,522.64972028)(506.06027071,524.30987648)(506.06027071,526.32810559)
\curveto(506.06027071,527.98175137)(506.4118332,529.31638675)(507.11495818,530.33201172)
\curveto(507.83110399,531.36065752)(508.84672896,532.16794916)(510.16183309,532.75388664)
\curveto(511.48995805,533.33982413)(513.08501009,533.73695953)(514.9469892,533.94529286)
\curveto(516.80896831,534.15362618)(518.80766616,534.30987618)(520.94308277,534.41404284)
\lineto(520.94308277,534.98044908)
\curveto(520.94308277,535.81378238)(520.79334319,536.50388653)(520.49386403,537.05076151)
\curveto(520.20740571,537.5976365)(519.79073905,538.02732398)(519.24386407,538.33982398)
\curveto(518.72303075,538.63930313)(518.09803077,538.84112604)(517.36886412,538.94529271)
\curveto(516.63969748,539.04945937)(515.87797875,539.1015427)(515.08370794,539.1015427)
\curveto(514.12016631,539.1015427)(513.04594759,538.97133437)(511.86105179,538.71091771)
\curveto(510.67615599,538.46352189)(509.4521977,538.09893857)(508.1891769,537.61716775)
\lineto(507.99386441,537.61716775)
\lineto(507.99386441,541.34763639)
\curveto(508.71001022,541.54294888)(509.74516644,541.75779262)(511.09933306,541.99216762)
\curveto(512.45349969,542.22654261)(513.78813507,542.34373011)(515.10323919,542.34373011)
\curveto(516.63969748,542.34373011)(517.97433286,542.21352178)(519.10714532,541.95310512)
\curveto(520.25297862,541.70570929)(521.24256192,541.2760218)(522.07589523,540.66404266)
\curveto(522.89620771,540.06508434)(523.52120769,539.29034478)(523.95089518,538.33982398)
\curveto(524.38058266,537.38930317)(524.59542641,536.21091779)(524.59542641,534.80466783)
\closepath
\moveto(520.94308277,525.37107436)
\lineto(520.94308277,531.44529293)
\curveto(519.82329113,531.38018877)(518.50167659,531.28253252)(516.97823914,531.15232419)
\curveto(515.46782251,531.02211586)(514.26990588,530.83331378)(513.38448924,530.58591796)
\curveto(512.32980178,530.2864388)(511.47693722,529.81768881)(510.82589557,529.179668)
\curveto(510.17485392,528.55466802)(509.8493331,527.68878263)(509.8493331,526.58201183)
\curveto(509.8493331,525.33201187)(510.22693726,524.38800148)(510.98214557,523.74998066)
\curveto(511.73735388,523.12498068)(512.88969759,522.81248069)(514.43917671,522.81248069)
\curveto(515.72823917,522.81248069)(516.90662455,523.05987652)(517.97433286,523.55466817)
\curveto(519.04204116,524.06248065)(520.03162446,524.66794939)(520.94308277,525.37107436)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(538.50167551,545.46873001)
\lineto(534.36105064,545.46873001)
\lineto(534.36105064,549.27732365)
\lineto(538.50167551,549.27732365)
\closepath
\moveto(538.26730052,519.47263704)
\curveto(538.26730052,516.92055379)(537.61625887,514.99347051)(536.31417558,513.69138722)
\curveto(535.01209228,512.38930392)(533.26730067,511.73826227)(531.07980073,511.73826227)
\curveto(530.55896742,511.73826227)(529.86886327,511.79034561)(529.0094883,511.89451227)
\curveto(528.16313415,511.99867893)(527.45349876,512.12888726)(526.88058211,512.28513726)
\lineto(526.88058211,515.7812309)
\lineto(527.0758946,515.7812309)
\curveto(527.44047793,515.63800174)(527.92875916,515.47524133)(528.54073831,515.29294967)
\curveto(529.16573829,515.11065801)(529.77120702,515.01951218)(530.35714451,515.01951218)
\curveto(531.29464448,515.01951218)(532.04985279,515.14972051)(532.62276944,515.41013716)
\curveto(533.19568609,515.67055382)(533.62537357,516.06117881)(533.9118319,516.58201213)
\curveto(534.19829022,517.10284545)(534.38058188,517.73435584)(534.45870688,518.47654332)
\curveto(534.54985271,519.20570997)(534.59542563,520.09763702)(534.59542563,521.15232449)
\lineto(534.59542563,538.73044896)
\lineto(530.04464451,538.73044896)
\lineto(530.04464451,541.81638637)
\lineto(538.26730052,541.81638637)
\closepath
}
}
{
\newrgbcolor{curcolor}{0 0 0}
\pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
{
\newpath
\moveto(562.40792761,519.99998078)
\lineto(558.75558397,519.99998078)
\lineto(558.75558397,522.32419946)
\curveto(558.43006314,522.1028453)(557.98735482,521.79034531)(557.42745901,521.38669948)
\curveto(556.88058402,520.9960745)(556.34672987,520.68357451)(555.82589656,520.44919951)
\curveto(555.21391741,520.14972036)(554.51079243,519.90232453)(553.71652162,519.70701204)
\curveto(552.92225081,519.49867871)(551.99126125,519.39451204)(550.92355295,519.39451204)
\curveto(548.95740718,519.39451204)(547.29074056,520.04555369)(545.9235531,521.34763699)
\curveto(544.55636564,522.64972028)(543.87277192,524.30987648)(543.87277192,526.32810559)
\curveto(543.87277192,527.98175137)(544.2243344,529.31638675)(544.92745938,530.33201172)
\curveto(545.6436052,531.36065752)(546.65923017,532.16794916)(547.97433429,532.75388664)
\curveto(549.30245925,533.33982413)(550.89751129,533.73695953)(552.7594904,533.94529286)
\curveto(554.62146951,534.15362618)(556.62016737,534.30987618)(558.75558397,534.41404284)
\lineto(558.75558397,534.98044908)
\curveto(558.75558397,535.81378238)(558.60584439,536.50388653)(558.30636523,537.05076151)
\curveto(558.01990691,537.5976365)(557.60324025,538.02732398)(557.05636527,538.33982398)
\curveto(556.53553195,538.63930313)(555.91053197,538.84112604)(555.18136533,538.94529271)
\curveto(554.45219868,539.04945937)(553.69047995,539.1015427)(552.89620914,539.1015427)
\curveto(551.93266751,539.1015427)(550.85844879,538.97133437)(549.67355299,538.71091771)
\curveto(548.48865719,538.46352189)(547.2646989,538.09893857)(546.0016781,537.61716775)
\lineto(545.80636561,537.61716775)
\lineto(545.80636561,541.34763639)
\curveto(546.52251142,541.54294888)(547.55766764,541.75779262)(548.91183426,541.99216762)
\curveto(550.26600089,542.22654261)(551.60063627,542.34373011)(552.91574039,542.34373011)
\curveto(554.45219868,542.34373011)(555.78683406,542.21352178)(556.91964652,541.95310512)
\curveto(558.06547982,541.70570929)(559.05506313,541.2760218)(559.88839643,540.66404266)
\curveto(560.70870891,540.06508434)(561.33370889,539.29034478)(561.76339638,538.33982398)
\curveto(562.19308387,537.38930317)(562.40792761,536.21091779)(562.40792761,534.80466783)
\closepath
\moveto(558.75558397,525.37107436)
\lineto(558.75558397,531.44529293)
\curveto(557.63579234,531.38018877)(556.31417779,531.28253252)(554.79074034,531.15232419)
\curveto(553.28032372,531.02211586)(552.08240709,530.83331378)(551.19699045,530.58591796)
\curveto(550.14230298,530.2864388)(549.28943842,529.81768881)(548.63839677,529.179668)
\curveto(547.98735513,528.55466802)(547.6618343,527.68878263)(547.6618343,526.58201183)
\curveto(547.6618343,525.33201187)(548.03943846,524.38800148)(548.79464677,523.74998066)
\curveto(549.54985508,523.12498068)(550.70219879,522.81248069)(552.25167791,522.81248069)
\curveto(553.54074038,522.81248069)(554.71912576,523.05987652)(555.78683406,523.55466817)
\curveto(556.85454236,524.06248065)(557.84412566,524.66794939)(558.75558397,525.37107436)
\closepath
}
}
\end{pspicture}

Am I making any mistakes in the way that I \input the "pstricks" files? Because, as a matter of fact, I know this works for tikzpicture.

6
2

Run the document with lualatex --shell-escape <file>, which needs the package auto-pst-pdf-lua (see code).

However, the exported PSTricks code is annoying. Your image can be created as a three-liner!

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{pstricks} 
\usepackage{auto-pst-pdf-lua}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{tikz}
\begin{document}
    g
\begin{figure}[!htb]
  \centering
 \resizebox{0.5\textwidth}{!}{\input{drawing8.tex}}
\caption{your caption} \label{fig:figureone}
\end{figure}
\end{document}

enter image description here

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.