5

I've got a PStricks schema made with both pst-solides3d and pst-3dplot, put (thanks to the standalone package) apart in a different file.

The schema, when compiled itself, doesn't make any problems, and the output is normal, as it should be.

This is the preamble of my main document :

\documentclass[a4paper,11pt]{report}
\usepackage{standalone}
\usepackage{a4wide}
\usepackage[french]{babel}
\NoAutoSpaceBeforeFDP % empêcher d'ajouter un espace après :
\usepackage[table, usenames,dvips, dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, here}
\usepackage[hyperindex, pdfborder={0 0 0}]{hyperref} % Table des matières & références interactive
\usepackage{url}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\usepackage{fancyref}

\usepackage{pstricks,  pst-circ, pst-plot, pst-3dplot, pst-solides3d}
\usepackage[locale = FR]{siunitx}

If I load the pst-solides3d (required to draw the schema in the included file), it doesn't compile, and I got this as error :

Error: /typecheck in --length--
Operand stack:
71.7882   -207.763   71.7882   -193.537   71.7882   -179.31   71.7882   -179.31   
[...]
809.324   -165.366   809.324   -165.366   1   1
Execution stack:
%interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2  
%stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1  
%stopped_push   1900   1   3   %oparray_pop   1899   1   3   %oparray_pop   18831   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2  
--nostringval--   --nostringval--   --nostringval--   2   %stopped_push  
--nostringval--  
--nostringval--
Dictionary stack:
--dict:1163/1684(ro)(G)--   --dict:1/20(G)--   --dict:139/200(L)--
--dict:747/1012(L)--   --dict:227/300(L)--   --dict:62/200(L)--   --dict:57/75(L)--  
--dict:211/313(L)--   --dict:72/140(L)--   --dict:0/10(G)--   --dict:18/20(L)--      
--dict:4/50(ro)(G)--   --dict:56/71(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 10226107
GPL Ghostscript 9.10: Unrecoverable error, exit code 1

Moreover, if I don't load the package pst-solides3d, LaTeX doesn't recognise the pst-solides3d macros, and I've got errors, and it doesn't compile either...

I don't know what to do, since the apart file compile, and when included in the main, it compile no more...

Is it an interaction with others packages ?

Here is the code PSTricks I use :

\documentclass[pstricks, float]{standalone}
\usepackage{pstricks, pst-circ, pst-plot, pst-3dplot, pst-solides3d}
\begin{document}

%\bgroup% holds everything local
\begin{pspicture}[showgrid=false](-1,-2)(9,6)
    \psset{unit=0.5, Alpha=45, Beta=15,
            viewpoint=60 45 15 rtp2xyz, Decran=120, lightsrc=viewpoint,
            linewidth=0.15pt,solidmemory}
    %%%%%%      
    \defFunction{K}(t){t cos 2.5 mul}{t sin 2.5 mul}{}
    \psSolid[object=prisme,h=0.15,
        %fillcolor=yellow,
        RotX=-90,
        resolution=50,
        action=none,name=fond,
        base=90 270 {K} CourbeR2+](0,-0.15,2.5)
    \defFunction{F}(t){t cos 2.5 mul}{t sin 2.5 mul}{}
    \defFunction{G}(t){t cos 2.4 mul}{t sin 2.4 mul}{}
    \psSolid[object=prisme,
        h=8,%fillcolor=yellow,
        RotX=90,ngrid=1 0,
        resolution=50,
        base=90 270 {F} CourbeR2+
        270 90 {G} CourbeR2+,
        action=none,name=can](0,8,2.5)
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.1,r=0.25,
            fillcolor=red!50,
            action=none,name=pas,
            mode=4,
            ngrid=1 20]
            (0, 2, -0.1)    
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.3,r=0.15,
            fillcolor=red!50,
            action=none,name=bout,
            mode=4,
            ngrid=1 20]
            (0, 2, -0.4)    
    \psSolid[object=fusion,
            action=draw**, linewidth=0.2pt,
            base=can fond pas bout](0,0,0)
    %\composeSolid  
        \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.1,r=0.15,
            fillcolor=red!50,
            mode=4,
            action=none,name=filet,
            ngrid=1 20]
            (0, 2, 0)
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=1.5625,r=0.05,
            fillcolor=green,
            mode=4,
            action=none,name=antenne,
            ngrid=1 10]
            (0, 2, 0.1) 
    \psSolid[object=fusion,
            action=draw**, linewidth=0.2pt,
            base=filet antenne](0,0,0)
    \composeSolid

%   \axesIIID(4,9,6)
%   \pstThreeDCoor[xMin=0,xMax=4.5,yMin=0,yMax=9,zMin=0,zMax=6,IIIDticks]

    \psset{linewidth=0.05, linecolor=black,arrowsize=0.2}   
    \pstThreeDLine{<->}(0, 0, 1.7)(0, 2, 1.7)
        \pstPlanePut[plane=yz,
            planecorr=normal](0, 2, 4.1){$\frac{L_g}{4}$}
    \pstThreeDLine{<->}(0, 2.7, 0.1)(0, 2.7, 1.6625)
        \pstPlanePut[plane=yz,
            planecorr=normal](0, 6, 1.6){\colorbox{white!10}{$\frac{L_o}{4}$}}  
    \pstThreeDLine{<->}(0.5, 0, 0.1)(0.5, 0, 4.9)
        \pstPlanePut[plane=xz,
            planecorr=normal](2.2, 0, 4.4){$D$}
    \pstThreeDLine{<->}(0.5, 0, 0)(0.5, 8, 0)
        \pstPlanePut[plane=yz,
            planecorr=xyrot](0.5, 8, -1){$\frac{3}{4}L_g$}
    \end{pspicture}
%\egroup
\end{document}

And here's what I got when compiles separately : enter image description here

  • Not having your pstricks code makes it hard to answer. However, I noticed that hyperref must be loaded after most packages. Firstload only the packages that are indispensable to draw your figure, commenting out the others. Then un comment them one after the other, until you have the same problem. This will let you identify the source of your problem. Sometimes, it is enough to change the loading order. – Bernard May 20 '14 at 23:10
2

Divide and Conquer (best practice)

Put each diagram in its separate compilable input file. For this, use standalone document class. Then compile the input file with latex->dvips->ps2pdf to get a PDF output.

% the filename of this code is diagram-1.tex

% compile this with the following 3 steps:
% latex diagram-1
% dvips diagram-1
% ps2pdf -dAutoRotatePages=/None diagram-1.ps
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-solides3d,pst-3dplot}
\begin{document}

%\bgroup% holds everything local
\begin{pspicture}[showgrid=false](-1,-2)(9,6)
    \psset{unit=0.5, Alpha=45, Beta=15,
            viewpoint=60 45 15 rtp2xyz, Decran=120, lightsrc=viewpoint,
            linewidth=0.15pt,solidmemory}
    %%%%%%      
    \defFunction{K}(t){t cos 2.5 mul}{t sin 2.5 mul}{}
    \psSolid[object=prisme,h=0.15,
        %fillcolor=yellow,
        RotX=-90,
        resolution=50,
        action=none,name=fond,
        base=90 270 {K} CourbeR2+](0,-0.15,2.5)
    \defFunction{F}(t){t cos 2.5 mul}{t sin 2.5 mul}{}
    \defFunction{G}(t){t cos 2.4 mul}{t sin 2.4 mul}{}
    \psSolid[object=prisme,
        h=8,%fillcolor=yellow,
        RotX=90,ngrid=1 0,
        resolution=50,
        base=90 270 {F} CourbeR2+
        270 90 {G} CourbeR2+,
        action=none,name=can](0,8,2.5)
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.1,r=0.25,
            fillcolor=red!50,
            action=none,name=pas,
            mode=4,
            ngrid=1 20]
            (0, 2, -0.1)    
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.3,r=0.15,
            fillcolor=red!50,
            action=none,name=bout,
            mode=4,
            ngrid=1 20]
            (0, 2, -0.4)    
    \psSolid[object=fusion,
            action=draw**, linewidth=0.2pt,
            base=can fond pas bout](0,0,0)
    %\composeSolid  
        \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=0.1,r=0.15,
            fillcolor=red!50,
            mode=4,
            action=none,name=filet,
            ngrid=1 20]
            (0, 2, 0)
    \psSolid[linewidth=0.15pt,
            object=cylindre,
            h=1.5625,r=0.05,
            fillcolor=green,
            mode=4,
            action=none,name=antenne,
            ngrid=1 10]
            (0, 2, 0.1) 
    \psSolid[object=fusion,
            action=draw**, linewidth=0.2pt,
            base=filet antenne](0,0,0)
    \composeSolid

%   \axesIIID(4,9,6)
%   \pstThreeDCoor[xMin=0,xMax=4.5,yMin=0,yMax=9,zMin=0,zMax=6,IIIDticks]

    \psset{linewidth=0.05, linecolor=black,arrowsize=0.2}   
    \pstThreeDLine{<->}(0, 0, 1.7)(0, 2, 1.7)
        \pstPlanePut[plane=yz,
            planecorr=normal](0, 2, 4.1){$\frac{L_g}{4}$}
    \pstThreeDLine{<->}(0, 2.7, 0.1)(0, 2.7, 1.6625)
        \pstPlanePut[plane=yz,
            planecorr=normal](0, 6, 1.6){\colorbox{white!10}{$\frac{L_o}{4}$}}  
    \pstThreeDLine{<->}(0.5, 0, 0.1)(0.5, 0, 4.9)
        \pstPlanePut[plane=xz,
            planecorr=normal](2.2, 0, 4.4){$D$}
    \pstThreeDLine{<->}(0.5, 0, 0)(0.5, 8, 0)
        \pstPlanePut[plane=yz,
            planecorr=xyrot](0.5, 8, -1){$\frac{3}{4}L_g$}
    \end{pspicture}
%\egroup
\end{document}

In case you have some setting that needs to be loaded in both diagram input files and the main input file, put those setting in a new package, namely mycommonsetting.sty, and save it in a folder that TeX system can find.

After all diagrams have been in PDF format, you now can import them from the main input file as follows

% the filename of this code is main.tex
% compile it with
% pdflatex main

\documentclass{article}
\usepackage{graphicx}
\graphicspath{{Images/}}
\begin{document}
\includegraphics{diagram-1}
\end{document}

I assume the folder Images contains all diagrams you want to import from within the main.tex which is saved in the same folder in which the folder Images exists. Confuse? Here is the tree structure of the files and folders.

\<any folder>\main.tex
\<any folder>\Images\diagram-1.tex

You will get a PDF output for your project after compiling the main with pdflatex main. Done.

  • I already use the standalone package, but I must compile the main.tex with TeX and DVI... And I have an Ghostscript error when including the pst-solides3d package I need for my pictures... – EisenHeim May 21 '14 at 11:11
1
When I use this document:

\documentclass[a4paper,11pt]{report}
\usepackage{ifxetex}
\usepackage{amsmath}
\ifxetex
  \usepackage{unicode-math}
  \setmathfont{XITS Math}
\else
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\fi
\usepackage{libertine}
\usepackage[french]{babel}

\usepackage{a4wide}
\usepackage[table,dvipsnames]{xcolor}
\NoAutoSpaceBeforeFDP % empêcher d'ajouter un espace après :
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{fancyhdr}
\usepackage{fancyref}
\usepackage[locale = FR]{siunitx}
\usepackage[hyperindex, pdfborder={0 0 0}]{hyperref} % Table des matières & références interactive

\usepackage{pst-circ,pst-plot,pst-3dplot, pst-solides3d}
\begin{document}
...
... The PSTricks code
...
\end{document}

I have no problem to create the document with running xelatex <file> or with latex->dvips->ps2pdf.

0

Solved, I was a GhostScript problem due to Adobe Illustrator...

I used it to transforms some pdf's into eps files, and it has brought some errors...

I converted them with pdf2ps (Terminal command), and it was solved...

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.