扫描\ pgfutil @ next使用时文件结束

时间:2019-05-01 16:37:36

标签: latex tikz pgf

我正在尝试在作业中显示图形,并且不断向我显示此图形:

  

扫描\ pgfutil @ next使用中的文件结束

\begin{center}
    \Large{section 5.3 homework}
\end{center}

\begin{enumerate}
    \item The graph is:
    \begin{center}
    \begin{tikzpicture}                                                  
        \node[name=s, shape=regular polygon, regular polygon sides = 5,
              minimum size=4cm] at (0,0) {};

        \draw[shift=(s.corner 1)] plot[mark=*] coordinates{(0,0)} node[above] {\texttt{1}};                                                               
        \draw[shift=(s.corner 2)] plot[mark=*] coordinates{(0,0)} node[right] {\texttt{2}};                                                           
        \draw[shift=(s.corner 3)] plot[mark=*] coordinates{(0,0)} node[below] {\texttt{3}};                                                       
        \draw[shift=(s.corner 4)] plot[mark=*] coordinates{(0,0)} node[below] {\texttt{4}};                                                           
        \draw[shift=(s.corner 5)] plot[mark=*] coordinates{(0,0)} node[left]  {\texttt{5}};

        \draw (s.corner 1) -- (s.corner 2) -- (s.corner 3) --
              (s.corner 4) -- (s.corner 5) -- (s.corner 1);
        \draw (s.corner 2) -- (s.corner 5):
        \draw (s.corner 3) -- (s.corner 5):
    \end{tikzpicture}
    \end {center}
\end {enumerate}

1 个答案:

答案 0 :(得分:1)

tikz命令的结尾必须以;终止,而不是:

\documentclass{article}

\usepackage{pgfplots}
\usetikzlibrary{shapes}

\begin{document}

\begin{tikzpicture}

\node[name=s, shape=regular polygon, regular polygon sides = 5, minimum size=4cm] at (0,0) {};                                                              

\draw[shift=(s.corner 1)] plot[mark=*] coordinates{(0,0)} node[above] {\texttt{1}};

\draw[shift=(s.corner 2)] plot[mark=*] coordinates{(0,0)} node[right]  {\texttt{2}};

\draw[shift=(s.corner 3)] plot[mark=*] coordinates{(0,0)} node[below]  {\texttt{3}};

\draw[shift=(s.corner 4)] plot[mark=*] coordinates{(0,0)} node[below] {\texttt{4}};

\draw[shift=(s.corner 5)] plot[mark=*] coordinates{(0,0)} node[left] {\texttt{5}};
\draw (s.corner 1) -- (s.corner 2) -- (s.corner 3) --
(s.corner 4) -- (s.corner 5) --  (s.corner 1);
\draw (s.corner 2) -- (s.corner 5);
\draw (s.corner 3) -- (s.corner 5);
\end{tikzpicture}

\end{document}

enter image description here