\documentclass[a4paper,12pt]{article}
\usepackage{amsfonts}
%\usepackage{amsbsy}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{graphics}
%\usepackage{epsfig}
\usepackage{tgbonum}
\usepackage{tikz}
\usepackage{flexisym}
\usepackage{showkeys}
\usepackage{cite}
\usepackage{nth}
\usepackage{amsthm}
\usepackage{hyperref}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{tkz-euclide}
\newtheorem{theorem}{Theorem}
%\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
%\newtheorem{proof}[theorem]{Proof}
%\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\usetikzlibrary {positioning}
\usepackage{pifont,geometry,txfonts,hyperref}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newcommand{\bcomma}{,\allowbreak}
\renewcommand{\baselinestretch}{1.2}
\renewcommand{\qedsymbol}{$\blacksquare$}
\def\M{\mathcal{M}}
%\def\bd{\begin{definition}\rm}
\DeclareUnicodeCharacter{2212}{-}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
%\theoremstyle{remark}
%\newtheorem{remark}{Remark}[section]
\begin{document}
\begin{figure}[hbt!]
\begin{center}
\begin{tikzpicture}[scale=0.65,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{4}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{2}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{1}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{5}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{6}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{7}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{8}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a5) -- (a7);
\draw (a7) -- (a8);
\draw [dashed] (a7) -- (a3);
\draw (a3) -- (a4);
\draw [dashed] (a1) -- (a3);
\draw (0.75, -.9) node {$U_{1}$};
\end{tikzpicture}
\hspace{2.5cm}
%\textit{$U^{+}$}
\begin{tikzpicture}[scale=0.65,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{4}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{3}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{1}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{2}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{6}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{5}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{8}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{7}]{};
\draw (a4) -- (a3);
\draw [dashed] (a1) -- (a3);
\draw (a8) -- (a7);
\draw [dashed] (a2) -- (a5);
\draw (a6) -- (a5);
\draw [dashed] (a3) -- (a7);
\draw (a1) -- (a2);
\draw [dashed] (a5) -- (a7);
\draw [dashed] (a3) -- (a5);
\draw (0.95, -1) node {$U_{1}^{+}$};
\end{tikzpicture}
\vspace{.2cm}
\begin{tikzpicture}[scale=0.65,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\small{1}]{};
\node (a2) at (1.5,0)[acteur,label=below:\small{2}]{};
\node (a5) at (3,0) [acteur,label=below:\small{5}]{};
\node (a6) at (4.5,0) [acteur,label=right:\small{6}]{};
\node (a3) at (2.25,1.5) [acteur,label=right:\small{3}]{};
\node (a4) at (2.25,3) [acteur,label=right:\small{4}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a2) -- (a3);
\draw [dashed] (a3) -- (a5);
\draw (a3) -- (a4);
\node at (2.25,-1.5) {\textit{$U_2$}};
\end{tikzpicture}
\hspace{2cm}
\begin{tikzpicture}[scale=0.65,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a3) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a4) at (1.5,0)[acteur,label=below:\footnotesize{4}]{};
\node (a6) at (3,0) [acteur,label=below:\footnotesize{6}]{};
\node (a5) at (4.5,0) [acteur,label=right:\footnotesize{5}]{};
\node (a1) at (2.25,1.5) [acteur,label=right:\footnotesize{1}]{};
\node (a2) at (2.25,3) [acteur,label=right:\footnotesize{2}]{};
\draw (a3) -- (a4);
\draw [dashed] (a4) -- (a6);
\draw(a5) -- (a6);
\draw [dashed] (a1) -- (a4);
\draw [dashed] (a1) -- (a6);
\draw (a2) -- (a1);
\node at (2.25,-1.5) {\textit{$U_{2}^{+}$}};
\end{tikzpicture}
\end{center}
\vspace{-9mm}
\caption{Here the solid edges are the matching edges.}\label{h2}
\end{figure}
\end{document}
我想将这些图形绘制在一条水平线上。我们该怎么做?
答案1
下面的代码
\vspace
删除空白行和环境之间的空白行tikzpicutre
。- 用and替换
tikzpicutre
相邻之间的水平分隔\hfill
- 通过调整参数来减少图形的大小
scale=
。 - 消除当前问题不需要的包。
代码:
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[hbt!]
\begin{center}
\begin{tikzpicture}[scale=0.50,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65,
}
]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{4}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{2}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{1}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{5}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{6}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{7}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{8}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a5) -- (a7);
\draw (a7) -- (a8);
\draw [dashed] (a7) -- (a3);
\draw (a3) -- (a4);
\draw [dashed] (a1) -- (a3);
\draw (0.75, -.9) node {$U_{1}$};
\end{tikzpicture}%
\hfill
\begin{tikzpicture}[scale=0.50,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{4}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{3}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{1}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{2}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{6}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{5}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{8}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{7}]{};
\draw (a4) -- (a3);
\draw [dashed] (a1) -- (a3);
\draw (a8) -- (a7);
\draw [dashed] (a2) -- (a5);
\draw (a6) -- (a5);
\draw [dashed] (a3) -- (a7);
\draw (a1) -- (a2);
\draw [dashed] (a5) -- (a7);
\draw [dashed] (a3) -- (a5);
\draw (0.95, -1) node {$U_{1}^{+}$};
\end{tikzpicture}
\begin{tikzpicture}[scale=0.50,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\small{1}]{};
\node (a2) at (1.5,0)[acteur,label=below:\small{2}]{};
\node (a5) at (3,0) [acteur,label=below:\small{5}]{};
\node (a6) at (4.5,0) [acteur,label=right:\small{6}]{};
\node (a3) at (2.25,1.5) [acteur,label=right:\small{3}]{};
\node (a4) at (2.25,3) [acteur,label=right:\small{4}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a2) -- (a3);
\draw [dashed] (a3) -- (a5);
\draw (a3) -- (a4);
\node at (2.25,-1.5) {\textit{$U_2$}};
\end{tikzpicture}%
\hfill
\begin{tikzpicture}[scale=0.5,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,
scale=0.65
}
]
\node (a3) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a4) at (1.5,0)[acteur,label=below:\footnotesize{4}]{};
\node (a6) at (3,0) [acteur,label=below:\footnotesize{6}]{};
\node (a5) at (4.5,0) [acteur,label=right:\footnotesize{5}]{};
\node (a1) at (2.25,1.5) [acteur,label=right:\footnotesize{1}]{};
\node (a2) at (2.25,3) [acteur,label=right:\footnotesize{2}]{};
\draw (a3) -- (a4);
\draw [dashed] (a4) -- (a6);
\draw(a5) -- (a6);
\draw [dashed] (a1) -- (a4);
\draw [dashed] (a1) -- (a6);
\draw (a2) -- (a1);
\node at (2.25,-1.5) {\textit{$U_{2}^{+}$}};
\end{tikzpicture}%
\end{center}
\vspace{-9mm}
\caption{Here the solid edges are the matching edges.}\label{h2}
\end{figure}
\end{document}
答案2
作为@Peter Grill 回答的题外补充(+1):
- 图像中节点的通用样式
- 标签的通用样式
- 连接线按实线和虚线分组命令。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[hbt!]
\centering
\tikzset{
thick,
acteur/.style = {circle, fill, inner sep=0pt, minimum size=2mm},
every label/.append style = {font=\footnotesize,inner sep=2pt},
}
\begin{tikzpicture}[scale=0.6]
\node (a1) at (0,0) [acteur,label=left:3]{};
\node (a2) at (1.5,0) [acteur,label=right:4]{};
\node (a3) at (0,1.5) [acteur,label=below left:2]{};
\node (a4) at (-1.5,1.5)[acteur,label=below:1]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:5]{};
\node (a6) at (3,1.5) [acteur,label=below:6]{};
\node (a7) at (0.75,3) [acteur,label=right:7]{};
\node (a8) at (0.75,4.3)[acteur,label=8]{};
%
\draw (a1) -- (a2) (a5) -- (a6) (a7) -- (a8) (a3) -- (a4);
\draw [dashed] (a2) -- (a5) (a5) -- (a7) (a7) -- (a3)
(a1) -- (a3);
\node at (0.75, -.9) {$U_{1}$};
\end{tikzpicture}
\hfil
\begin{tikzpicture}[scale=0.6]
\node (a1) at (0,0) [acteur,label=left:4]{};
\node (a2) at (1.5,0) [acteur,label=right:3]{};
\node (a3) at (0,1.5) [acteur,label=below left:1]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:2]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:6]{};
\node (a6) at (3,1.5) [acteur,label=below:5]{};
\node (a7) at (0.75,3) [acteur,label=right:8]{};
\node (a8) at (0.75,4.3)[acteur,label=7]{};
%
\draw (a1) -- (a2) (a5) -- (a6) (a7) -- (a8) (a3) -- (a4);
\draw [dashed] (a2) -- (a5) (a5) -- (a7) (a7) -- (a3)
(a1) -- (a3);
\node at (0.95, -.9) {$U_{1}^{+}$};
\end{tikzpicture}
\hfil
\begin{tikzpicture}[scale=0.6]
\node (a3) at (0,0) [acteur,label=left:1]{};
\node (a4) at (1.5,0)[acteur,label=below:2]{};
\node (a6) at (3,0) [acteur,label=below:5]{};
\node (a5) at (4.5,0)[acteur,label=below:6]{};
\node (a1) at (2.25,1.5) [acteur,label=right:3]{};
\node (a2) at (2.25,3)[acteur,label=right:4]{};
%
\draw (a3) -- (a4) (a5) -- (a6) (a2) -- (a1);
\draw [dashed] (a4) -- (a6) (a1) -- (a4) (a1) -- (a6);
\node at (2.25,-1.5) {\textit{$U_2$}};
\end{tikzpicture}
\hfil
\begin{tikzpicture}[scale=0.6]
\node (a3) at (0,0) [acteur,label=left:3]{};
\node (a4) at (1.5,0) [acteur,label=below:4]{};
\node (a6) at (3,0) [acteur,label=below:6]{};
\node (a5) at (4.5,0) [acteur,label=below:5]{};
\node (a1) at (2.25,1.5)[acteur,label=right:1]{};
\node (a2) at (2.25,3) [acteur,label=right:2]{};
%
\draw (a3) -- (a4) (a5) -- (a6) (a2) -- (a1);
\draw [dashed] (a4) -- (a6) (a1) -- (a4) (a1) -- (a6);
\node at (2.25,-1.5) {\textit{$U_{2}^{+}$}};
\end{tikzpicture}
\caption{Here the solid edges are the matching edges.}
\label{h2}
\end{figure}
\end{document}
(红线表示文本边框)
答案3
只需将所有图形放在同一个tikzpicture
环境中,然后使用环境移动它们scope
即可。我注释了代码中不再需要的部分。可以对齐图形,使三角形对齐。
\documentclass[a4paper,12pt]{article}
\usepackage{amsfonts}
%\usepackage{amsbsy}
\usepackage{amssymb}
\usepackage{amsmath}
%\usepackage[a4paper, total={6in, 8in}]{geometry}
\usepackage{graphics}
%\usepackage{epsfig}
\usepackage{tgbonum}
\usepackage{tikz}
\usepackage{flexisym}
\usepackage{showkeys}
\usepackage{cite}
\usepackage{nth}
\usepackage{amsthm}
\usepackage{hyperref}
\usetikzlibrary{decorations.pathmorphing}
\usepackage{tkz-euclide}
\newtheorem{theorem}{Theorem}
%\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{proposition}[theorem]{Proposition}
%\newtheorem{proof}[theorem]{Proof}
%\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\usetikzlibrary {positioning}
\usepackage{pifont,geometry,txfonts,hyperref}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
%\usepackage{showframe}
\newcommand{\bcomma}{,\allowbreak}
\renewcommand{\baselinestretch}{1.2}
\renewcommand{\qedsymbol}{$\blacksquare$}
\def\M{\mathcal{M}}
%\def\bd{\begin{definition}\rm}
\DeclareUnicodeCharacter{2212}{-}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
%\theoremstyle{remark}
%\newtheorem{remark}{Remark}[section]
\begin{document}
\begin{figure}[hbt!]
\begin{center}
\begin{tikzpicture}[scale=0.6,
thick,
acteur/.style={
circle,
fill=black,
thick,
inner sep=2pt,
minimum size=0.2cm,scale=0.65
}
]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{4}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{2}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{1}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{5}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{6}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{7}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{8}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a5) -- (a7);
\draw (a7) -- (a8);
\draw [dashed] (a7) -- (a3);
\draw (a3) -- (a4);
\draw [dashed] (a1) -- (a3);
\draw (0.75, -.9) node {$U_{1}$};
% \end{tikzpicture}
%\hspace{2.5cm}
%%\textit{$U^{+}$}
% \begin{tikzpicture}
\begin{scope}[xshift=6cm]
%[scale=0.65,
% thick,
% acteur/.style={
% circle,
% fill=black,
% thick,
% inner sep=2pt,
% minimum size=0.2cm,scale=0.65
% }
% ]
\node (a1) at (0,0) [acteur,label=left:\footnotesize{4}]{};
\node (a2) at (1.5,0)[acteur,label=right:\footnotesize{3}]{};
\node (a3) at (0,1.5) [acteur,label=below left:\footnotesize{1}]{};
\node (a4) at (-1.5,1.5) [acteur,label=below:\footnotesize{2}]{};
\node (a5) at (1.5,1.5) [acteur,label=below right:\footnotesize{6}]{};
\node (a6) at (3,1.5) [acteur,label=right:\footnotesize{5}]{};
\node (a7) at (0.75,3) [acteur,label=right:\footnotesize{8}]{};
\node (a8) at (0.75,4.3) [acteur,label=\footnotesize{7}]{};
\draw (a4) -- (a3);
\draw [dashed] (a1) -- (a3);
\draw (a8) -- (a7);
\draw [dashed] (a2) -- (a5);
\draw (a6) -- (a5);
\draw [dashed] (a3) -- (a7);
\draw (a1) -- (a2);
\draw [dashed] (a5) -- (a7);
\draw [dashed] (a3) -- (a5);
\draw (0.95, -1) node {$U_{1}^{+}$};
\end{scope}
% \end{tikzpicture}
%
% \vspace{.2cm}
%
%
% \begin{tikzpicture}
\begin{scope}[xshift=10cm]
%[scale=0.65,
% thick,
% acteur/.style={
% circle,
% fill=black,
% thick,
% inner sep=2pt,
% minimum size=0.2cm,scale=0.65
% }
% ]
\node (a1) at (0,0) [acteur,label=left:\small{1}]{};
\node (a2) at (1.5,0)[acteur,label=below:\small{2}]{};
\node (a5) at (3,0) [acteur,label=below:\small{5}]{};
\node (a6) at (4.5,0) [acteur,label=right:\small{6}]{};
\node (a3) at (2.25,1.5) [acteur,label=right:\small{3}]{};
\node (a4) at (2.25,3) [acteur,label=right:\small{4}]{};
\draw (a1) -- (a2);
\draw [dashed] (a2) -- (a5);
\draw(a5) -- (a6);
\draw [dashed] (a2) -- (a3);
\draw [dashed] (a3) -- (a5);
\draw (a3) -- (a4);
\node at (2.25,-1.5) {\textit{$U_2$}};
\end{scope}
%\end{tikzpicture}
%\hspace{2cm}
% \begin{tikzpicture}
\begin{scope}[xshift=16cm]
%[scale=0.65,
% thick,
% acteur/.style={
% circle,
% fill=black,
% thick,
% inner sep=2pt,
% minimum size=0.2cm,scale=0.65
% }
% ]
\node (a3) at (0,0) [acteur,label=left:\footnotesize{3}]{};
\node (a4) at (1.5,0)[acteur,label=below:\footnotesize{4}]{};
\node (a6) at (3,0) [acteur,label=below:\footnotesize{6}]{};
\node (a5) at (4.5,0) [acteur,label=right:\footnotesize{5}]{};
\node (a1) at (2.25,1.5) [acteur,label=right:\footnotesize{1}]{};
\node (a2) at (2.25,3) [acteur,label=right:\footnotesize{2}]{};
\draw (a3) -- (a4);
\draw [dashed] (a4) -- (a6);
\draw(a5) -- (a6);
\draw [dashed] (a1) -- (a4);
\draw [dashed] (a1) -- (a6);
\draw (a2) -- (a1);
\node at (2.25,-1.5) {\textit{$U_{2}^{+}$}};
\end{scope}
\end{tikzpicture}
\end{center}
\vspace{-9mm}
\caption{Here the solid edges are the matching edges.}\label{h2}
\end{figure}
\end{document}