程序包和 tikz 存在问题

程序包和 tikz 存在问题

当我尝试在同一个文档中使用 tikz 和 program 包时,出现错误。只使用其中一个就可以了。有人知道如何解决这个问题吗?

这是我的代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{hyperref}
\usepackage[bottom]{footmisc}
\usepackage{amsmath}
\usepackage{algorithmic}
\usepackage{program}
\usepackage{tikz}
\usetikzlibrary{automata,chains}

\begin{document}

\begin{program}
    \text{input F (Sei $n$ = $\vert Var(F) \vert$}
    \FOR i:=1 \TO t \DO
        \BEGIN \\ %
        \text{Wähle eine zufällige Anfangsbelegung $\alpha$}
        \FOR j:=1 \TO n \DO
            \BEGIN \\ %
                \IF F\alpha = 1 \THEN  |return \dq erfüllbar\dq| \\ %
                |Wähle ein | K \in F | mit | K \alpha = 0, K = \{u_1, u_2, u_3\}
                |Wähle zufällig | l = \{1, 2, 3\}
                \alpha := \alpha[u_l = 1]
            \END
        \END
\end{program}

\begin{tikzpicture}[start chain=going right]
\node[state, on chain]                 (0) {0};
\node[state, on chain]                 (1) {1};
\node[state, on chain]                 (2) {2};
\node[on chain]                   (2-g) {...};
\node[state, on chain, text depth=0pt] (g) {g};

\draw[
    >=latex,
%   every node/.style={above,midway},% either
    auto=right,                      % or
    loop above/.style={out=75,in=105,loop},
    every loop,
    ]
     (g)   edge[loop above] node {$p_{gg}$}   (g)
           edge             node {$p_{gg-1}$} (2-g)
     (2-g) to               node {$p_{32}$}   (2)
           edge[loop above] node {$p_{22}$}   (2)
     (2)   edge             node {$p_{21}$}   (1)
     (1)   edge[loop above] node {$p_{11}$}   (1)
           edge             node {$p_{10}$}   (0)
     (0)   edge[loop above] node {$p_{00}$}   (0);
% The \draw path is like the one above.
\end{tikzpicture}


\end{document}

相关内容