使用 documentclass“memoir”在 Latex 中绘制图表

使用 documentclass“memoir”在 Latex 中绘制图表

我正在使用 Latex 中的“memoir”绘制图表。我遇到了错误。有人能告诉我下面我做错了什么吗?

\documentclass[a4paper,twoside,oldfontcommands,12pt]{memoir}

%%% INCLUDE THE PACKAGES

\usepackage[utf8x]{inputenc}

\usepackage{a4wide}

\usepackage{graphicx}

\usepackage{amssymb,amsmath,amsthm}

\usepackage{amssymb, hyperref}

\usepackage{epsfig,graphicx}

\usepackage{tikz}

\usepackage{tikz-cd}

\tikzset{node distance=2cm, auto}

\usepackage{hyperref}

\usetikzlibrary{graphs}

\usetikzlibrary{backgrounds}

\usepackage{multicol}

\usetikzlibrary{arrows,decorations.markings}

\usepackage{calc,graphicx,soul}

\begin{document}

\begin{tikzpicture}[scale=4, every loop/.style={}]

\vertex[fill] (1) at (.2, 0) [label=below:1]  {};

\vertex [fill](2) at (0,.2) [label=left:2] {};

\vertex[fill] (3) at (.2,.4) [label=above:3] {};

\vertex[fill] (4) at (.4,.4) [label=above:4] {}; 

\vertex[fill] (5) at (.4, 0) [label=below:5] {}; 

\vertex [fill](6) at (.6,.2) [label=right:6] {};

\vertex[fill] (7) at (1.2, 0) [label=below:1]  {};

\vertex [fill](8) at (1,.2) [label=left:2] {};

\vertex[fill] (9) at (1.2,.4) [label=above:3] {};

\vertex[fill] (10) at (1.4,.4) [label=above:4] {};

\vertex[fill] (11) at (1.6, .2) [label=right:6] {}; 

\vertex [fill](12) at (1.4,0) [label=below:5] {};

\vertex[fill] (13) at (2.2, 0) [label=below:1] {}; 

\vertex [fill](14) at (2,.2)  [label=left:2]  {};

\vertex[fill] (15) at (2.2,.4)  [label=above:3]{};

\vertex[fill] (16) at (2.4,.4) [label=above:4] {};

\vertex[fill] (17) at (2.6,.2) [label=right: 6]  {};

\vertex [fill](18) at (2.4,0) [label=below:5] {};   

\path

    (1) edge (2)
    (1) edge (3)
    (2) edge (3)
    (4) edge (5)
    (4) edge (6)
    (5) edge (6)
    (7) edge (8)
    (8) edge (9)
    (9) edge (10)
    (7) edge (12)
    (10) edge (11)
    (11) edge (12)
    (13) edge (14)
    (14) edge (15)
    (15) edge (18)
    (13) edge (16)
    (16) edge (17)
    (17) edge (18)
 ;  

\end{tikzpicture}
\end{document}

答案1

\vertex未定义。我认为您正在寻找\coordinate

\documentclass[a4paper,twoside,oldfontcommands,12pt]{memoir}

%%% INCLUDE THE PACKAGES

\usepackage[utf8x]{inputenc}

\usepackage{a4wide}

\usepackage{graphicx}

\usepackage{amssymb,amsmath,amsthm}

\usepackage{amssymb, hyperref}

\usepackage{epsfig,graphicx}

\usepackage{tikz}

\usepackage{tikz-cd}

\tikzset{node distance=2cm, auto}

\usepackage{hyperref}

\usetikzlibrary{graphs}

\usetikzlibrary{backgrounds}

\usepackage{multicol}

\usetikzlibrary{arrows,decorations.markings}

\usepackage{calc,graphicx,soul}

\begin{document}

\begin{tikzpicture}[scale=4, every loop/.style={}]

\coordinate[fill] (1) at (.2, 0) [label=below:1]  {};

\coordinate [fill](2) at (0,.2) [label=left:2] {};

\coordinate[fill] (3) at (.2,.4) [label=above:3] {};

\coordinate[fill] (4) at (.4,.4) [label=above:4] {}; 

\coordinate[fill] (5) at (.4, 0) [label=below:5] {}; 

\coordinate [fill](6) at (.6,.2) [label=right:6] {};

\coordinate[fill] (7) at (1.2, 0) [label=below:1]  {};

\coordinate [fill](8) at (1,.2) [label=left:2] {};

\coordinate[fill] (9) at (1.2,.4) [label=above:3] {};

\coordinate[fill] (10) at (1.4,.4) [label=above:4] {};

\coordinate[fill] (11) at (1.6, .2) [label=right:6] {}; 

\coordinate [fill](12) at (1.4,0) [label=below:5] {};

\coordinate[fill] (13) at (2.2, 0) [label=below:1] {}; 

\coordinate [fill](14) at (2,.2)  [label=left:2]  {};

\coordinate[fill] (15) at (2.2,.4)  [label=above:3]{};

\coordinate[fill] (16) at (2.4,.4) [label=above:4] {};

\coordinate[fill] (17) at (2.6,.2) [label=right: 6]  {};

\coordinate [fill](18) at (2.4,0) [label=below:5] {};   

\path

    (1) edge (2)
    (1) edge (3)
    (2) edge (3)
    (4) edge (5)
    (4) edge (6)
    (5) edge (6)
    (7) edge (8)
    (8) edge (9)
    (9) edge (10)
    (7) edge (12)
    (10) edge (11)
    (11) edge (12)
    (13) edge (14)
    (14) edge (15)
    (15) edge (18)
    (13) edge (16)
    (16) edge (17)
    (17) edge (18)
 ;  

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容