1

I saw this question, and wonder how to make it using PSTricks...

I tried, but failed. The compilation ends, but fails to produce a pdf. I have the Cisco Icons in a subfolder, and putting them in a \rput doesn't work...

This could have a lot of applications, as I'm actually writing my Master Thesis in Network Engineering...

Here's my MWE :

\documentclass[pstricks, float]{standalone}
\usepackage{graphicx}
\usepackage[table, usenames, dvipsnames]{xcolor}
\usepackage{pstricks, pst-node, pst-circ, pst-plot, pst-3dplot, pst-solides3d, pst-sigsys, pstricks-add, pst-eucl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[frenchb]{babel}    

\begin{document}
    \begin{pspicture}[labelangle=:U, showgrid=false](0, 1)(10, 5)
        \rput[bl](0,0){\rnode{A}{\includegraphics[width=30pt]{Cisco_Icons/pc}}}
        \rput[tr](4,3){\rnode{B}{\includegraphics[width=30pt]{Cisco_Icons/pc}}}
        \ncline[nodesep=3pt]{<->}{A}{B}
    \end{pspicture}
\end{document}

Here is the console output :

Error: /typecheck in --length--
Operand stack:
   1   1
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1951   1   3   %oparray_pop   1950   1   3   %oparray_pop   1934   1   3   %oparray_pop   1820   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1185/1684(ro)(G)--   --dict:0/20(G)--   --dict:176/200(L)--   --dict:745/1012(L)--   --dict:173/300(L)--   --dict:43/200(L)--   --dict:38/60(L)--   --dict:181/205(L)--   --dict:41/60(L)--   --dict:43/65(L)--   --dict:7/7(L)--   --dict:7/7(L)--
Current allocation mode is local
Last OS error: Invalid argument
Current file position is 531884
GPL Ghostscript 9.16: Unrecoverable error, exit code 1
### FAILED to generate /tmp/altpdflatex.59686-1458308792/Archi_centra.pdf ()

It seems to ba a Ghostscript problem, but I can't figure it.

EDIT 1 : I compile with TeX+DVI

EDIT 2 : This standalone file is to be included in my main.tex like this :

\begin{figure}[H]
    \centering
    \input{Schemas/this_standalone}
    \caption{2 PCs linked together}
    \label{fig:pcLinked}
\end{figure}

And the main.tex HAS to be compiled using TeX+DVI, otherwise I'll get other problems with other packagesif compiled with XeLaTex (breakurl for instance)

FINAL EDIT : All this problem comes from the Cisco Icon package I downloaded. On their page, you have 2 choices, for eps files : B/W or PSM 3015. The files of the latter (PMS 3015) are misunderstood by Ghostscript, leading to the problem I presented...

What works : B/W icons, compiled with LaTeXand TeX+DVI

3isenHeim
  • 2,107

2 Answers2

1

with up-to-date TeXLive 2015 I have no problem with your example. However, try to run xelatex instead of latex->dvips->ps2pdf:

\documentclass[pstricks,dvipsnames,table]{standalone}
\usepackage{fontspec}
\usepackage{pstricks, pst-node}
\usepackage[frenchb]{babel}    

\begin{document}
\begin{pspicture}(-1, -1)(6, 5)
    \rput[bl](0,0){\rnode{A}{\includegraphics[width=30pt]{/tmp//pc}}}
    \rput[tr](4,3){\rnode{B}{\includegraphics[width=30pt]{/tmp/pc}}}
    \ncline[nodesep=3pt]{<->}{A}{B}
\end{pspicture}
\end{document}

enter image description here

  • This is ok with xelatex, but I still got the error when including them (with standalonne's \input). – 3isenHeim Mar 21 '16 at 19:44
  • Your example code shows no \input –  Mar 21 '16 at 20:15
  • I got problems when compiling it with TeX+DVI, because this file will be included in my main.tex, which I must compile with TeX+DVIanyway... – 3isenHeim Mar 21 '16 at 21:41
  • What exactly do you inlcude? If you run your main document with TeX+DVI then you do not need to run standalone. However, you can run your complete document with xelatex –  Mar 21 '16 at 21:45
  • I have now problems with the breakurlpakcage (for my bibliography), when runnig with XeLaTex : `/usr/local/texlive/2015/texmf-dist/tex/latex/breakurl/breakurl.sty:311: Undefined control sequence.\headerps@out {/burl@stx null def /BU.S { /burl@stx null def } de... l.311 }

    ?`

    – 3isenHeim Mar 21 '16 at 21:54
  • 1
    breakurl is not needed for xelatex. It is done by default. –  Mar 21 '16 at 22:12
  • I deleted breakurl, everything works fine with xelatex. Thanks ! – 3isenHeim Mar 22 '16 at 05:41
  • See my edited answer for final solution, which works with everything ! – 3isenHeim Mar 22 '16 at 19:40
0

With this code, it compiles with pdflatex, provided it is launched with the --enable-write18 switch, if you're under MiKTeX, shell-escape under TeX Live or MacTeX.

Another solution might be to convert the icons from èpstopdfformat, with a tool likeepspdf`.

I slightly simplified your code, as pstricks-add loads a number of the packages you use.

\documentclass[pstricks, french, float]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[table, dvipsnames]{xcolor}
\usepackage{pstricks-add, pst-3dplot, pst-solides3d, , pst-eucl, pst-circ, pst-sigsys}
\usepackage{babel}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}[labelangle=:U, showgrid=false](0, 1)(10, 5)
    \rput[bl](0,0){\rnode{A}{\includegraphics[width=30pt]{Cisco_Icons/pc}}}
    \rput[tr](4,3){\rnode{B}{\includegraphics[width=30pt]{Cisco_Icons/pc}}}
    \ncline[nodesep=3pt]{<->}{A}{B}
\end{pspicture}

\end{document} 

enter image description here

Bernard
  • 271,350
  • Sorry, I forgot to mention it, but I compile using TeX+DVI... – 3isenHeim Mar 18 '16 at 15:03
  • With LaTeX+DVI, the .ps file is queer: only one icon, and a bounding box appear in GsView, and pstopdf, yields a .pdf with two icons, but no bounding box. Do you have any reason not to take the pdflatex way? – Bernard Mar 18 '16 at 15:09
  • Yes, I also use pst-circ and other PSTricks packages to draw my diagrams... – 3isenHeim Mar 18 '16 at 15:12
  • Usually it works fine with pdflatex and auto-pst-pdf, which is done for that. – Bernard Mar 18 '16 at 15:14
  • I tried with pdflatex, and I saw that the template I use requires TeX+DVI => I have no choice. And my work is pretty much advandec to change everything ^^ – 3isenHeim Mar 18 '16 at 15:17
  • Why does it require TeX+DVI? If it is only because of pstricks, it only means the template was not updated (it's been quite a few years that pstricks can be compiled with pdflatex). You just have to load auto-pst-pdf after pstricks and add the switch. I can't imagine any other reason for not using `pdflatex. Note you also may convert the .eps files to .pdf format. – Bernard Mar 18 '16 at 15:28
  • The template hasn't been updated since 2002 :P – 3isenHeim Mar 18 '16 at 15:44
  • At that time, the way LaTeX+DVI was mandatory. It's not anymore (since 2008 or so). anyway, you can try to compile the template with pdflatex and see what happens. – Bernard Mar 18 '16 at 15:47
  • I don't have the pictures (which also are in .pdf) and the coloured frames. And I compiled my other drawings with pdflatex juste fine, but they don't appear. I have this error : !pdfTeX error: /Library/TeX/texbin/pdflatex (file ./TFE_pdflatex-pics.pdf): PDF inclusion: required page does not exist <1> ==> Fatal error occurred, no output PDF file produced! – 3isenHeim Mar 18 '16 at 15:52
  • Could you post a minimal (non-)working example? – Bernard Mar 18 '16 at 15:56
  • The MWE I presented don't work... – 3isenHeim Mar 21 '16 at 07:42
  • I've just compiled it without any problem with pdflatex just adding \usepackage{auto-pst-pdf}. With latex+DVI, thers is a problem with dvips, but the result is almost correct after I've used pstopdf (almost means I have no bounding box). – Bernard Mar 21 '16 at 07:50
  • Here is the console output, when compiling with pdflatex : http://pastebin.com/B5SyJ0Ve – 3isenHeim Mar 21 '16 at 07:58