Tikz 图片未在论文中显示

Tikz 图片未在论文中显示

我有一张 tikz 图片。这是一张图表。我创建了一个演示文稿,它在演示文稿中显示正确。因此,代码是正确的。但现在我正在制作学位作品,我有

\documentclass{report} 

但是图片没有显示出来,代码如下:

\begin{tikzpicture}
    \tikzset{VertexStyleOrange/.style = {
                 shape         = circle,
                                 ball color     = orange,
                                 inner sep      = 1pt,
                                 outer sep      = 0pt,
                                 minimum size   = 1 pt}}
    \tikzset{VertexStyleBlue/.style = {
                 shape          = circle,
                                 ball color     = blue,
                                 inner sep      = 1pt,
                                 outer sep      = 0pt,
                                 minimum size   = 1 pt}}
    \tikzset{EdgeStyleBlue/.style   = {thick,
                                 double  = blue,
                                 double distance = 1pt}}
 \tikzset{EdgeStyle/.style   = {thick,
                                 double  = orange,
                                 double distance = 1pt}}

\node at ( -3.5,3)[VertexStyleOrange](0) {0};                                
\node at ( -5,1)[VertexStyleBlue](1) {1};
\node at ( -2,1)[VertexStyleBlue](2) {2};
\node at ( -2,-1)[VertexStyleBlue](3) {3};
\node at ( -5,-1)[VertexStyleBlue](4) {4};
\node at ( -3.5,-3)[VertexStyleOrange](5) {5};
\node at ( 3.5,3)[VertexStyleOrange](6) {0};                                
\node at ( 5,1)[VertexStyleBlue](7) {1};
\node at ( 2,1)[VertexStyleBlue](8) {2};
\node at ( 2,-1)[VertexStyleBlue](9) {3};
\node at ( 5,-1)[VertexStyleBlue](10) {4};
\node at ( 3.5,-3)[VertexStyleOrange](11) {5};

\draw[EdgeStyle](1) to node{}(0);
\draw[EdgeStyle](2) to node{}(0);
\draw[EdgeStyleBlue](1) to node{}(2);
\draw[EdgeStyleBlue](2) to node{}(3);
\draw[EdgeStyleBlue](3) to node{}(4);
\draw[EdgeStyleBlue](4) to node{}(1);
\draw[EdgeStyleBlue](1) to node{}(3);
\draw[EdgeStyleBlue](4) to node{}(2);
\draw[EdgeStyle](5) to node{}(3);
\draw[EdgeStyle](4) to node{}(5);

\draw[EdgeStyle](11) to node{}(7);
\draw[EdgeStyle](11) to node{}(8);
\draw[EdgeStyle](6) to node{}(10);
\draw[EdgeStyle](6) to node{}(9);

\end{tikzpicture}

但我看到的不是这个,而是一个小黑点。我把它贴在文件的所有地方,但结果都一样——一个小小的黑色污点。这是什么原因呢?

以下是示例:

\documentclass[a4paper,14pt]{report}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amssymb,amsfonts,amsmath,mathtext,cite,enumerate,float}
\usepackage[dvips]{graphicx}
\usepackage[14pt]{extsizes}
\usepackage{times}
\usepackage{hyperref}
\usepackage{tikz}
\usepackage[labelsep=period]{caption}
\usepackage{indentfirst} 
\usepackage{makecell} 
\DeclareCaptionLabelSeparator{par}{\par}
\captionsetup{labelsep=par,justification=centering}
\graphicspath{{images/}}


\newcommand\tablecaption[1]{
\captionsetup{labelsep=par,justification=centering}
\caption{#1}
}

\renewcommand{\baselinestretch}{1.5}\normalsize
\makeatletter
\renewcommand{\@biblabel}[1]{#1.}
\makeatother


\usepackage{geometry}
\geometry{left=3cm}
\geometry{right=1cm}
\geometry{top=2cm}
\geometry{bottom=2cm}

\setcounter{tocdepth}{2}
\setlength{\parindent}{1.5cm}

\renewcommand{\theenumi}{\arabic{enumi}}
\renewcommand{\labelenumi}{\arabic{enumi}}
\renewcommand{\theenumii}{.\arabic{enumii}}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\theenumiii}{.\arabic{enumiii}}
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}
\renewcommand{\rmdefault}{ftm}

\begin{document}
\renewcommand\contentsname{Table of Contents}
\renewcommand\chaptername{Chapter}
\tableofcontents
\input{Introduction}
\end{document}

在“引言”中还有另一段代码:

\chapter{Introduction}
I want to tell you about smth...

\begin{center}
\begin{tikzpicture}
    \tikzset{VertexStyleOrange/.style = {
                 shape         = circle,
                                 ball color     = orange,
                                 inner sep      = 1pt,
                                 outer sep      = 0pt,
                                 minimum size   = 1 pt}}
    \tikzset{VertexStyleBlue/.style = {
                 shape          = circle,
                                 ball color     = blue,
                                 inner sep      = 1pt,
                                 outer sep      = 0pt,
                                 minimum size   = 1 pt}}
    \tikzset{EdgeStyleBlue/.style   = {thick,
                                 double  = blue,
                                 double distance = 1pt}}
 \tikzset{EdgeStyle/.style   = {thick,
                                 double  = orange,
                                 double distance = 1pt}}

\node at ( -3.5,3)[VertexStyleOrange](0) {0};                                
\node at ( -5,1)[VertexStyleBlue](1) {1};
\node at ( -2,1)[VertexStyleBlue](2) {2};
\node at ( -2,-1)[VertexStyleBlue](3) {3};
\node at ( -5,-1)[VertexStyleBlue](4) {4};
\node at ( -3.5,-3)[VertexStyleOrange](5) {5};
\node at ( 3.5,3)[VertexStyleOrange](6) {0};                                
\node at ( 5,1)[VertexStyleBlue](7) {1};
\node at ( 2,1)[VertexStyleBlue](8) {2};
\node at ( 2,-1)[VertexStyleBlue](9) {3};
\node at ( 5,-1)[VertexStyleBlue](10) {4};
\node at ( 3.5,-3)[VertexStyleOrange](11) {5};

\draw[EdgeStyle](1) to node{}(0);
\draw[EdgeStyle](2) to node{}(0);
\draw[EdgeStyleBlue](1) to node{}(2);
\draw[EdgeStyleBlue](2) to node{}(3);
\draw[EdgeStyleBlue](3) to node{}(4);
\draw[EdgeStyleBlue](4) to node{}(1);
\draw[EdgeStyleBlue](1) to node{}(3);
\draw[EdgeStyleBlue](4) to node{}(2);
\draw[EdgeStyle](5) to node{}(3);
\draw[EdgeStyle](4) to node{}(5);

\draw[EdgeStyle](11) to node{}(7);
\draw[EdgeStyle](11) to node{}(8);
\draw[EdgeStyle](6) to node{}(10);
\draw[EdgeStyle](6) to node{}(9);

\end{tikzpicture}
\end{center}

即使删除 \begin{center} 后图片也不会显示

答案1

运行完美,但你可以稍微修改一下代码

\documentclass[11pt]{report}
\usepackage{tikz}
\usetikzlibrary{%
  arrows,
  calc
}

\begin{document}
\chapter{Introduction}
I want to tell you about smth...

\begin{center}
\begin{tikzpicture}
    \tikzset{VertexStyle/.style = {
                 shape         = circle,
                                 ball color     = #1,
                                 inner sep      = 1pt,
                                 outer sep      = 0pt,
                                 minimum size   = 1 pt}}


 \tikzset{EdgeStyle/.style   = {thick,
                                 double  = #1,
                                 double distance = 1pt}}


\begin{scope}[every node/.style={VertexStyle=blue}]                             
    \node at ( -5,1)  (1) {1};
    \node at ( -2,1)  (2) {2};
    \node at ( -2,-1) (3) {3};
    \node at ( -5,-1) (4) {4};
    \node at ( 3.5,3) (6) {0};                                
    \node at ( 5,1)   (7) {1};
    \node at ( 2,1)   (8) {2};
    \node at ( 2,-1)  (9) {3};
    \node at ( 5,-1)  (10) {4}; 
\end{scope}

\begin{scope}[every node/.style={VertexStyle=orange}]
    \node at ( -3.5,3)  (0) {0};                                
    \node at ( -3.5,-3) (5) {5};
    \node at ( 3.5,3)   (6) {0};                                
    \node at ( 3.5,-3)  (11) {5};  
\end{scope}   

\begin{scope}
\draw[EdgeStyle=blue]   
 (1) to  (2)
 (2) to  (3)
 (3) to  (4)
 (4) to  (1)
 (1) to  (3)
 (4) to  (2);  
\end{scope}   

\begin{scope}
\draw[EdgeStyle=orange] 
 (1)     to  (0)
 (2)     to  (0)
 (5)     to  (3)
 (4)     to  (5)
 (11)    to  (7)
 (11)    to  (8)
 (6)     to  (10)
 (6)     to  (9);  
\end{scope}  

\end{tikzpicture}
\end{center}
\end{document}  

在此处输入图片描述

相关内容