具有独立类的 PDFTricks

具有独立类的 PDFTricks

PDFTricks不仅仅是一个问题PSTricks

我正在尝试使用PDFTricks编译PSTricks包含该类standalone的文档。我相信我已经遵循了手册的说明,但肯​​定遗漏了一些东西:我正在使用 进行编译pdflatex。我允许 shell-escape,正如您从序言中的第一行代码中看到的那样,日志报告\write18 enabled.我收到以下错误:

! LaTeX Error: Environment psinputs undefined.

但是我已安装 PDFTricks。从代码中可以看出以下,我将其pdftricks作为选项传递给类standalone,现在也许不允许这样做?好吧,我也尝试使用显式usepackage{pdftricks},但出现以下错误(为清晰起见进行了编辑):

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

代码在工作流PSTricks中编译时可以工作LaTeX -> DVI -> PDF。请参阅我之前的问题具有独立类和新页或分页符的 PSTricks

我使用的 PSTricks 代码来自: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
\documentclass[margin=3pt,pdftricks]{standalone}
\begin{psinputs}
  \usepackage{pstricks}
  \usepackage{pst-node}
\end{psinputs}
    % \nbox draws an ovalbox labeled by the argument which is also used
% as the node label.
\newcommand\nbox[2][white]{\rnode{#2}{\psframebox[fillcolor=#1,fillstyle=solid]{\makebox[3.5\unitlength][l]%
    {\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.
\newcommand\race[5][white]{\vbox{\hsize=3.5\unitlength\addtolength{\hsize}{2\fboxsep}%
    \addtolength{\hsize}{2\fboxrule}\nbox[#1]{#2}\par%
    \vspace{#5\unitlength}\par\nbox[#1]{#4}}%
  \ncline{-}{#2}{#4}\rput*(!
    \psGetNodeCenter{#2} \psGetNodeCenter{#4} #2.x #4.x add 2 div #2.y #4.y add 2 div     ){\small\sf Race #3}}

\begin{document}

\psset{linewidth=1.5pt,framearc=0.3}
\begin{pdfpic}
  \begin{pspicture}(0,0)(25,20)
    %\psset{unit=0.95cm}
    \rput[t]{0}(12.5,20){\huge\bf
      \begin{tabular}[t]{c}
        \hphantom{The} Intratribal Winner's Bracket
      \end{tabular}}
    \rput[t]{0}(17,19){\large\bf
      \begin{tabular}[t]{ll}
        Tribe: & 
        \underbar{\hphantom{The Shoshone Tribe}} 
        \\[2\baselineskip]
        Race Time: & 
        \underbar{\hphantom{The Shoshone Tribe}} 
      \end{tabular}}
    \rput{0}(1,19){\race[yellow!40]{Car1}{1}{Car9}{.5}}
    \rput{0}(1,16.5){\race[blue!40]{Car5}{2}{Car13}{.5}}
    \rput{0}(1,14){\race[red!40]{Car3}{3}{Car11}{.5}}
    \rput{0}(1,11.5){\race[green!40]{Car7}{4}{Car15}{.5}}
    \rput{0}(1,9){\race[magenta!40]{Car16}{5}{Car8}{.5}}
    \rput{0}(1,6.5){\race[cyan!40]{Car12}{6}{Car4}{.5}}
    \rput{0}(1,4){\race[lime!40]{Car6}{7}{Car14}{.5}}
    \rput{0}(1,1.5){\race[black!20]{Car10}{8}{Car2}{.5}}
    %
    \rput{0}(5.5,17.75){\race[yellow!40]{W1}{9}{W2}{1.7}}
    \rput{0}(5.5,12.75){\race[red!40]{W3}{10}{W4}{1.7}}
    \rput{0}(5.5,7.75){\race[green!40]{W5}{11}{W6}{1.7}}
    \rput{0}(5.5,2.75){\race[blue!40]{W7}{12}{W8}{1.7}}
    %
    \psset{angleB=180,linearc=5pt}
    \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}
    %
    \rput{0}(10,15.25){\race[yellow!40]{W9}{17}{W10}{4.25}}
    \rput{0}(10,5.25){\race[red!40]{W11}{18}{W12}{4.25}}
    %
    \ncdiag{-}{W1}{W9}    \ncdiag{-}{W2}{W9}
    \ncdiag{-}{W3}{W10}    \ncdiag{-}{W4}{W10}
    \ncdiag{-}{W5}{W11}    \ncdiag{-}{W6}{W11}
    \ncdiag{-}{W7}{W12}    \ncdiag{-}{W8}{W12}
    %
    \rput{0}(14.5,10.25){\race[yellow!40]{W17}{23}{W18}{9}}
    %
    \ncdiag{-}{W9}{W17}    \ncdiag{-}{W10}{W17}
    \ncdiag{-}{W11}{W18}    \ncdiag{-}{W12}{W18}
    %
    \rput{0}(19,12){\race[yellow!40]{W23}{30}{W29}{2}}
    %
    \ncdiag{-}{W17}{W23}    \ncdiag{-}{W18}{W23}
    %
    \rput[l]{0}(22,12){\nbox[green!40]{W30}}
    %
    \ncdiag{-}{W23}{W30}    \ncdiag{-}{W29}{W30}
    %
    \rput{0}(19,5){\race[blue!40]{W23}{31 (if necessary)}{W29}{2}}
    \rput[l]{0}(22,5){\nbox[lime!40]{Champ}}
    %
    \ncdiag{-}{W23}{Champ}    \ncdiag{-}{W29}{Champ}
  \end{pspicture}
\end{pdfpic}

\end{document}

另一个不起作用的序言是:

\documentclass[margin=3pt]{standalone}
\usepackage{pdftricks}
\begin{psinputs}
  \usepackage{pstricks}
  \usepackage{pst-node}
\end{psinputs}

我的序言有问题吗?

答案1

如果您拥有相对较新的版本,则可以与 pdflatex 配合使用的序言无需加载 pdftricks 并使用以下pdf选项加载 pstricks:

\documentclass[margin=3pt]{standalone}%
\usepackage[pdf]{pstricks}
\usepackage{pst-node}

\newcommand\nbox[2]{…}
............

并删除pdfpic环境。这将得到:

在此处输入图片描述

相关内容