This is a PDFTricks question much more than a PSTricks question.

I am trying to use PDFTricks to compile a PSTricks document with the standalone class. I believe I have followed the manual's instructions, but must have missed something: I am compiling with pdflatex. I have allowed shell-escape as you can see from the first line of code in the preamble, and the log reports \write18 enabled. I get the following error:

! LaTeX Error: Environment psinputs undefined.

But I do have PDFTricks installed. As you can see from the code below, I pass pdftricks as an option to class standalone, now perhaps that's not allowed? Well, I also tried with an explicit usepackage{pdftricks} instead, and I get the following error (edited for clarity):

! LaTeX Error: Something's wrong--perhaps a missing \item.
l.82 \end{pdfpic}

The code works when compiled with PSTricks in a LaTeX -> DVI -> PDF workflow. See my earlier question PSTricks with standalone class and newpage or pagebreak

The PSTricks code I use is from: http://tug.org/PSTricks/Examples/bracket.tex

% !TeX document-id = {b33ceedb-1e8e-41cf-91b1-c1c63954e674}
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
% Author: Peter S. Simon, Camarillo, CA
    % \nbox draws an ovalbox labeled by the argument which is also used
% as the node label.
    {\scriptsize #2:}\rule[-.3\unitlength]{0cm}{0.6\unitlength}}}}

% \race[#1]{#2}{#3}{#4}{#5}
% \race draws two \nbox's vertically centered and separated by #4 (no units).
% #1 is the top \nbox argument, #2 is the race label, #3 is the bottom \nbox
% argument.
    \psGetNodeCenter{#2} \psGetNodeCenter{#4} #2.x #4.x add 2 div #2.y #4.y add 2 div     ){\small\sf Race #3}}


        \hphantom{The} Intratribal Winner's Bracket
        Tribe: & 
        \underbar{\hphantom{The Shoshone Tribe}} 
        Race Time: & 
        \underbar{\hphantom{The Shoshone Tribe}} 
    \ncdiag{-}{Car1}{W1}    \ncdiag{-}{Car9}{W1}
    \ncdiag{-}{Car5}{W2}    \ncdiag{-}{Car13}{W2}
    \ncdiag{-}{Car3}{W3}    \ncdiag{-}{Car11}{W3}
    \ncdiag{-}{Car7}{W4}    \ncdiag{-}{Car15}{W4}
    \ncdiag{-}{Car16}{W5}    \ncdiag{-}{Car8}{W5}
    \ncdiag{-}{Car12}{W6}    \ncdiag{-}{Car4}{W6}
    \ncdiag{-}{Car6}{W7}    \ncdiag{-}{Car14}{W7}
    \ncdiag{-}{Car10}{W8}    \ncdiag{-}{Car2}{W8}
    \ncdiag{-}{W1}{W9}    \ncdiag{-}{W2}{W9}
    \ncdiag{-}{W3}{W10}    \ncdiag{-}{W4}{W10}
    \ncdiag{-}{W5}{W11}    \ncdiag{-}{W6}{W11}
    \ncdiag{-}{W7}{W12}    \ncdiag{-}{W8}{W12}
    \ncdiag{-}{W9}{W17}    \ncdiag{-}{W10}{W17}
    \ncdiag{-}{W11}{W18}    \ncdiag{-}{W12}{W18}
    \ncdiag{-}{W17}{W23}    \ncdiag{-}{W18}{W23}
    \ncdiag{-}{W23}{W30}    \ncdiag{-}{W29}{W30}
    \rput{0}(19,5){\race[blue!40]{W23}{31 (if necessary)}{W29}{2}}
    \ncdiag{-}{W23}{Champ}    \ncdiag{-}{W29}{Champ}


An alternative preamble that doesn't work either is:


Something wrong with my preamble?

  • Where is the sense to use standalone and pdftricks? Both are used to create single pdf images. – user2478 Feb 14 '14 at 18:56
  • The original code (see the url to bracket.tex) had this in the preamble: \documentclass[landscape]{article} \usepackage[margin=5mm]{geometry} \thispagestyle{empty} and my purpose in using standalone was to remove these lines and obtain a nicely cropped image. My purpose in using PDFTricks was to obtain a PDF in one compilation instead of 3. I do not know much about PDFTricks and particularly as I have not been able to make it work, and may never have to. ;-) Thanks for your help Herbert. – PatrickT Feb 14 '14 at 19:03
  • Yes, that's ok. But you are using the standalone class to create a single pdf file. That is the reason why using the pdflatex call makes no real sense. – user2478 Feb 14 '14 at 19:05
  • @Herbert, how do you suggest I compile the document? I tried XeLaTeX earlier with shell-escape, pdftricks and pdfpic, but that crashed. If I compile with XeLaTeX with usepackage[pdf]{pstricks} it produces the correct output except that the margin is wider than the requested 3pt, and it also generates errors. I compile with pdflatex only because I don't know any better. Thanks. – PatrickT Feb 14 '14 at 19:12
  • Also, standalone is a class and pdftricks is a package, is there a reason I should know why the two couldn't be used together? Thanks. – PatrickT Feb 14 '14 at 19:13

A preamble that works with pdflatex, provided you have a relatively recent version, is without loading pdftricks and loading pstricks with the pdf option:



and removing the pdfpic environment. This gives:

enter image description here

  • Wow, could it be any simpler? Thanks!!! – PatrickT Feb 14 '14 at 18:57

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.