Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am new to LaTeX and was writing an article with MikTeX. But when I insert a pspicture and compile the file into pdf format, the pspicture just does not show up. But if I compile the file into ps, then the figure, which is an external .png file, goes wrong. Seemingly they just cannot be together :( I googled many solutions and tried to import many different packages but still doesn't work out.

The code is given as below:




      \pscircleop(6, -1)    {oplus}

    %--- First and second channels ---
    \psforeach{\ry}{0,-2}{\advance\cnt by 1\relax

    %--- Connecting blocks ---
      \nclist{ncline}{f, dot1}
      \nclist{ncline}{oplus, ff}
      \nclist{ncline}{h0, ds0, dots0, us0, g0}
      \nclist{ncline}{h1, ds1, dots1, us1, g1}
      \ncangle[angleA=90, angleB=180]{dot1}{h0}
      \ncangle[angleA=-90, angleB=180]{dot1}{h1}



Hope somebody can help me solve the problem. Thanks a lot.

Here I am also giving the log-file. I didn't change the code at all, only passing -escape-shell to compiler.

    This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8) (preloaded format=pdflatex 2011.8.7)  20 JAN 2012 14:22
    entering extended mode
    ("D:/Documents/LaTeX file/BlockDiagram.tex"
    LaTeX2e <2011/06/27>
    Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, german, ngerman, german-x-2009-06-19, ngerm
    an-x-2009-06-19, french, loaded.
    ("C:\Program Files\MiKTeX 2.8\tex\latex\base\article.cls"
    Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
    ("C:\Program Files\MiKTeX 2.8\tex\latex\base\size10.clo"
    File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
    ) ("C:\Program Files\MiKTeX 2.8\tex\latex\pstricks\pstricks.sty"
    Package: pstricks 2011/10/31 v0.52 LaTeX wrapper for `PSTricks' (RN,HV)

    >>> Loading package auto-pst-pdf <<<
    ("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\base\pstricks.tex"
    ("C:\Program Files\MiKTeX 2.8\tex\generic\xkeyval\pst-xkey.tex"
    File: pst-xkey.tex 2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)

    ("C:\Program Files\MiKTeX 2.8\tex\latex\xkeyval\xkeyval.sty"
    Package: xkeyval 2008/08/13 v2.6a package option processing (HA)

    ("C:\Program Files\MiKTeX 2.8\tex\generic\xkeyval\xkeyval.tex"
    File: xkeyval.tex 2008/08/13 v2.6a key=value parser (HA)
     ("D:\Documents\LaTeX file\keyval.tex"))))
    ("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\base\pst-fp.tex" `pst-fp' v0.05, 2010/01/17 (hv)

    `PSTricks' v2.23  <2011/09/04> (tvz)
    ("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\base\pstricks.con")
    File: pstricks.tex 2011/09/04 v2.23 `PSTricks' (tvz,hv)

    ("C:\Program Files\MiKTeX 2.8\tex\generic\pstricks\base\pst-fp.tex")
    File: pst-fp.tex 2011/09/04 v2.23 `PST-fp' (hv)

    ("C:\Program Files\MiKTeX 2.8\tex\latex\xcolor\xcolor.sty"
    Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK)
     ("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\color.cfg"
    File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
    Package xcolor Info: Package option `pdf' ignored on input line 216.
    Package xcolor Info: Driver file: pdftex.def on input line 225.

    ("C:\Program Files\MiKTeX 2.8\tex\latex\pdftex-def\pdftex.def"
    File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX

    ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\infwarerr.sty"
    Package: infwarerr 2010/04/08 v1.3 Providing info/warning/message (HO)
    ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\ltxcmds.sty"
    Package: ltxcmds 2011/04/18 v1.20 LaTeX kernel commands for general use (HO)
    Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337.
    Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341.
    Package xcolor Info: Model `RGB' extended on input line 1353.
    Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355.
    Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356.
    Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357.
    Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358.
    Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359.
    Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360.
    ("C:\Program Files\MiKTeX 2.8\tex\latex\pst-sigsys\pst-sigsys.sty"
    Package: pst-sigsys 2011/03/07 package wrapper for pst-sigsys.tex (fd)

    ("C:\Program Files\MiKTeX 2.8\tex\generic\pst-sigsys\pst-sigsys.tex"
    ("C:\Program Files\MiKTeX 2.8\tex\generic\pst-node\pst-node.tex"  v1.21, 2011/11/21
    ) `PST-SigSys' v1.4, 2011/03/07 (fd)
    File: pst-sigsys.tex 2011/03/07 v1.4 `PST-sigsys' (fd)
    ) ("C:\Program Files\MiKTeX 2.8\tex\latex\auto-pst-pdf\auto-pst-pdf.sty"
    Package: auto-pst-pdf 2009/04/26 v0.6 Wrapper for pst-pdf
     ("D:\Documents\LaTeX file\ifpdf.sty"
    Package: ifpdf 2001/06/14 v1.0 Providing \ifpdf (HO)
    Package ifpdf Info: pdfTeX in pdf mode detected on input line 140.
    ("C:\Program Files\MiKTeX 2.8\tex\latex\ifplatform\ifplatform.sty"
    Package: ifplatform 2010/10/22 v0.4 Testing for the operating system

    ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\pdftexcmds.sty"
    Package: pdftexcmds 2011/04/22 v0.16 Utilities of pdfTeX for LuaTeX (HO)

    ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\ifluatex.sty"
    Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO)
    Package ifluatex Info: LuaTeX not detected.

    LaTeX Warning: You have requested, on input line 187, version
                   `2010/09/13' of package ifpdf,
                   but only version
                   `2001/06/14 v1.0 Providing \ifpdf (HO)'
                   is available.

    Package pdftexcmds Info: LuaTeX not detected.
    Package pdftexcmds Info: \pdf@primitive is available.
    Package pdftexcmds Info: \pdf@ifprimitive is available.
    Package pdftexcmds Info: \pdfdraftmode found.
    ) ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\catchfile.sty"
    Package: catchfile 2011/03/01 v1.6 Catches the contents of a file (HO)

    ("C:\Program Files\MiKTeX 2.8\tex\generic\oberdiek\etexcmds.sty"
    Package: etexcmds 2011/02/16 v1.5 Prefix for e-TeX command names (HO)
    Package etexcmds Info: Could not find \expanded.
    (etexcmds)             That can mean that you are not using pdfTeX 1.50 or
    (etexcmds)             that some package has redefined \expanded.
    (etexcmds)             In the latter case, load this package earlier.
    runsystem(echo " ")...executed.

    runsystem(echo "-------------------------------------------------")...executed.

    runsystem(echo "auto-pst-pdf: Auxiliary LaTeX compilation")...executed.

    runsystem(echo "-------------------------------------------------")...executed.

    runsystem(del "BlockDiagram-autopp.log")...executed.

    runsystem(del "BlockDiagram-autopp.aux")...executed.

    runsystem(del "BlockDiagram-autopp.dvi")...executed.

    runsystem(del "BlockDiagram-autopp.ps")...executed.

    runsystem(del "BlockDiagram-autopp.pdf")...executed.

    runsystem(latex -disable-write18 -jobname="BlockDiagram-autopp" -interaction=batchmode  "\let \APPmakepictures \empty \i
    nput  BlockDiagram.tex")...executed.

    runsystem(dvips -Ppdf -o "BlockDiagram-autopp.ps" "BlockDiagram-autopp.dvi")...executed.

    runsystem(ps2pdf  "BlockDiagram-autopp.ps" "BlockDiagram-autopp.pdf")...executed.

    runsystem(pdfcrop  "BlockDiagram-autopp.pdf" "BlockDiagram-pics.pdf")...executed.

    Package auto-pst-pdf Warning: 
        Creation of BlockDiagram-pics.pdf failed.
    This warning occured on input line 124.

    Package auto-pst-pdf Warning: 
        Could not create BlockDiagram-pics.pdf. Auxiliary files not deleted.
    This warning occured on input line 124.

    runsystem(echo "-------------------------------------------------")...executed.

    runsystem(echo "auto-pst-pdf: End auxiliary LaTeX compilation")...executed.

    runsystem(echo "-------------------------------------------------")...executed.

    ("C:\Program Files\MiKTeX 2.8\tex\latex\pst-pdf\pst-pdf.sty"
    Package: pst-pdf 2008/10/09 v1.1v PS graphics for pdfLaTeX (RN,HjG)

    ("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\graphicx.sty"
    Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

    ("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\graphics.sty"
    Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
     ("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\trig.sty"
    Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
    ) ("C:\Program Files\MiKTeX 2.8\tex\latex\00miktex\graphics.cfg"
    File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
    Package graphics Info: Driver file: pdftex.def on input line 91.
    Package pst-pdf Info: MODE: 1 (pdfTeX mode) on input line 214.

    ("C:\Program Files\MiKTeX 2.8\tex\latex\preview\preview.sty"
    Package: preview 2010/02/14 11.86 (AUCTeX/preview-latex)
    ) ("C:\Program Files\MiKTeX 2.8\tex\latex\graphics\dvips.def"
    File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
    ) ("C:\Program Files\MiKTeX 2.8\tex\latex\environ\environ.sty"
    Package: environ 2008/06/18 v0.2 A new way to define environments
    ))) ("D:\Documents\LaTeX file\BlockDiagram.aux")
    LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
    LaTeX Font Info:    ... okay on input line 8.
    LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
    LaTeX Font Info:    ... okay on input line 8.
    LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
    LaTeX Font Info:    ... okay on input line 8.
    LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
    LaTeX Font Info:    ... okay on input line 8.
    LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
    LaTeX Font Info:    ... okay on input line 8.
    LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
    LaTeX Font Info:    ... okay on input line 8.

    ("C:\Program Files\MiKTeX 2.8\tex\context\base\supp-pdf.mkii"
    [Loading MPS to PDF converter (version 2006.09.02).]
    Preview: Fontsize 10pt
    Preview: PDFoutput 1

    Package pst-pdf Warning: pspicture No. 1 undefined.

    <./gsample2.png, id=1, 422.32782pt x 316.18124pt>
    File: ./gsample2.png Graphic file (type png)
     <use ./gsample2.png>
    Package pdftex.def Info: ./gsample2.png used on input line 41.
    (pdftex.def)             Requested size: 211.16339pt x 158.09023pt.

    Package pst-pdf Warning: File `BlockDiagram-pics.pdf' not found.
    (pst-pdf)                Use the following commands to create it:
    (pst-pdf)                ---------------------------------------------------- 
    (pst-pdf)                latex BlockDiagram.tex
    (pst-pdf)                dvips -o BlockDiagram-pics.ps BlockDiagram.dvi
    (pst-pdf)                ps2pdf BlockDiagram-pics.ps
    (pst-pdf)                ---------------------------------------------------- .


    Non-PDF special ignored!
    Non-PDF special ignored!
    Non-PDF special ignored! <D:/Documents/LaTeX file/gsample2.png (PNG copy)>] ("D:\Documents\LaTeX file\BlockDiagram.aux")
    Here is how much of TeX's memory you used:
     4278 strings out of 495285
     57808 string characters out of 3180547
     141368 words of memory out of 3000000
     7442 multiletter control sequences out of 15000+200000
     3640 words of font info for 14 fonts, out of 3000000 for 9000
     14 hyphenation exceptions out of 8191
     39i,7n,38p,600b,332s stack positions out of 5000i,500n,10000p,200000b,50000s

    Output written on BlockDiagram.pdf (1 page, 10107 bytes).
    PDF statistics:
     7 PDF objects out of 1000 (max. 8388607)
     0 named destinations out of 1000 (max. 500000)
     6 words of extra memory for PDF output out of 10000 (max. 10000000)
share|improve this question
Instead of using auto-pst-pdf and the [pdf] option of pstricks, you can simply compile your document using xelatex, which will also give you a PDF. –  Jake Jan 20 '12 at 2:06
with the optional argument [pdf] the package auto-pst-pdf is already loaded. However, see tug.org/PSTricks/main.cgi?file=pdf/pdfoutput how you have to enable the optional argument shell-escape –  Herbert Jan 20 '12 at 9:50
add comment

3 Answers

up vote 8 down vote accepted

The code you have compiles as it is. However, if you want to compile the code to PDF, it is easier to use pdflatex. To use pstricks with pdflatex you should use the -shell-escape option when compiling your document. Consequently, you should call the compiler like this:

pdflatex -shell-escape file.tex  % on windows or linux

And your example shows: Example

Note that if you are using an IDE to write your document, most of them provide options to customize the way they call each command. You should be able to change it accordingly.

share|improve this answer
under linux -shell-escape also works. –  Herbert Jan 20 '12 at 9:50
@Herbert: Oh, thanks for the pointer. I edited it! –  adn Jan 20 '12 at 11:48
@adn: thanks for the help, but it still doesn't work out. I followed your instruction: adding -shell-escape to the command (I use texniccenter and changed the configuration for the output profiles), but the diagram still didn't come out. I added the log-file. Could you please help me to figure it out? thanks –  stwang Jan 20 '12 at 13:38
Do you have installed ps2pdf and pdfcrop? If you execute them in the command line do they work? Also, have you try to update your MikTeX distribution to the newest?, you are using an old one. –  adn Jan 20 '12 at 14:14
I finally got it work. the reason is that I didn't have perl installed. also provide the link of perl for those who may encounter the same problem in the future. [activestate.com/activeperl/downloads] Thanks for helping. –  stwang Jan 20 '12 at 20:58
add comment

You need to enable write18. If you are using TeXworks, which you are, if you have the default MikTeX installation, from TeXworks go to Edit->Preferences and adjust the Processing Tools accordingly.

enter image description here

When I set this, the first time, I had some other issues as well, which I do not remember off-hand. If you do try it this way, just post a comment or edit my post so that we can record the proper steps for fixing this issue.

share|improve this answer
thanks for answering. I also tried your solution, but the diagram still didn't appear. –  stwang Jan 20 '12 at 13:42
@stwang Check if there are any associated files in the directory, after you tried it out (.pp, .dvi, .pdf etc). Also check the messages and log files for hints. –  Yiannis Lazarides Jan 20 '12 at 13:48
add comment

I usually separate independent PSTricks pictures from the main input file to well organize the document being written.

In your case, I will put the PSTricks picture in a file named flowdiagram.tex as follows:

% flowdiagram.tex


      \pscircleop(6, -1){oplus}

    %--- First and second channels ---
    \psforeach{\ry}{0,-2}{\advance\cnt by 1\relax

    %--- Connecting blocks ---
      \nclist{ncline}{f, dot1}
      \nclist{ncline}{oplus, ff}
      \nclist{ncline}{h0, ds0, dots0, us0, g0}
      \nclist{ncline}{h1, ds1, dots1, us1, g1}
      \ncangle[angleA=90, angleB=180]{dot1}{h0}
      \ncangle[angleA=-90, angleB=180]{dot1}{h1}

Note: I have changed the pspicture's width from 15 to 16 to avoid trimming on the left and right sides. flowdiagram.tex can be compiled with either xelatex or latex-dvips-ps2pdf to produce a PDF output named flowdiagram.pdf. The following parts (in flowdiagram.tex)


are used to get a tight picture.

In your main input file, namely main.tex, just import flowdiagram.pdf as follows:



    \includegraphics[scale=.5]{./flowdiagram}% file extension can be omitted.

    \includegraphics[scale=.5]{./gsample2}% file extension can be ignored.


Compile main.tex with pdflatex to get the PDF output named main.pdf. Don't forget to make sure flowdiagram.pdf exists in the same folder in which main.tex is.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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