\documentclass{amsart}
%\documentclass[11pt]{article}
\usepackage[dvips]{graphicx}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{caption}
\usepackage[b5paper,twoside,top=20mm,right=18mm,left=22mm,bottom=15mm,bindingoffset=0mm,nomarginpar]{geometry}
%\usepackage{ccfonts}
\usepackage{epsfig}
\usepackage[T1]{fontenc}
\paperheight=240mm
\paperwidth=170mm
\textwidth=136mm
\textheight=205mm
\addtolength{\oddsidemargin}{-2mm}
\addtolength{\evensidemargin}{-3.5mm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{algorithm}
\usepackage{algorithmic}
\algsetup{linenosize=\small}
\usepackage[font=small]{caption}
\usepackage{booktabs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{center}
\begin{figure}[h!]
\centering
\begin{tikzpicture}[%
back line/.style={densely dotted},
cross line/.style={preaction={draw=white, -,line width=8pt}}]
\node (A) {$8$};
\node (B)[below of=A] {$1$};
\node (C) [node distance=1.5cm, right of=B, below of=B]{$2$};
\node (D) [node distance=1.5cm, left of=C, below of=B]{$7$};
\node (E) [node distance=1.5cm, below of=C]{$3$};
\node (F) [node distance=3.0cm, left of=E]{$6$};
\node (G) [node distance=0.8cm, left of=E, below of=E]{$4$};
\node (H) [node distance=0.8cm, right of=G, below of=F]{$5$};
\draw[cross line] (B) -- (C);
\draw[cross line] (C) -- (E);
\draw[cross line] (E) -- (G);
%\draw[cross line] (G) -- (H);
\draw[cross line] (H) -- (F);
\draw[cross line] (F) -- (D);
\draw[cross line] (D) -- (B);
\draw[<->, dashed] (C) to node {} (D);
\draw[<->, dashed] (F) to node {} (E);
\draw[<->, dashed] (G) to node {} (H);
\draw[<->, dashed] (A) to node {} (B);
\end{tikzpicture}
\caption{Polygon method for $n$ = 8.}
%Figure 1: Polygon method for $n$ = 8.
\end{figure}
\end{center}
答案1
如果我修复了序言中的错误(参见代码中的注释),你的 tikz 就可以正常工作了。
\documentclass{amsart}
%\documentclass[11pt]{article}
\usepackage
% no[dvips]
{graphicx}
% no (mathtools loads this) \usepackage{amsmath}
\usepackage{mathtools}
% no! you load this later with different options \usepackage{caption}
\usepackage[b5paper,twoside,top=20mm,right=18mm,left=22mm,bottom=15mm,bindingoffset=0mm,nomarginpar]{geometry}
%\usepackage{ccfonts}
%NO! \usepackage{epsfig}
\usepackage[T1]{fontenc}
%No! use geometry
%\paperheight=240mm
%\paperwidth=170mm
%\textwidth=136mm
%\textheight=205mm
%\addtolength{\oddsidemargin}{-2mm}
%\addtolength{\evensidemargin}{-3.5mm}
\usepackage{amssymb}
%no already loaded above \usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{algorithm}
\usepackage{algorithmic}
\algsetup{linenosize=\small}
\usepackage[font=small]{caption}
\usepackage{booktabs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%no! \begin{center}
\begin{figure}[htp]% no![h!]
\centering
\begin{tikzpicture}[%
back line/.style={densely dotted},
cross line/.style={preaction={draw=white, -,line width=8pt}}]
\node (A) {$8$};
\node (B)[below of=A] {$1$};
\node (C) [node distance=1.5cm, right of=B, below of=B]{$2$};
\node (D) [node distance=1.5cm, left of=C, below of=B]{$7$};
\node (E) [node distance=1.5cm, below of=C]{$3$};
\node (F) [node distance=3.0cm, left of=E]{$6$};
\node (G) [node distance=0.8cm, left of=E, below of=E]{$4$};
\node (H) [node distance=0.8cm, right of=G, below of=F]{$5$};
\draw[cross line] (B) -- (C);
\draw[cross line] (C) -- (E);
\draw[cross line] (E) -- (G);
%\draw[cross line] (G) -- (H);
\draw[cross line] (H) -- (F);
\draw[cross line] (F) -- (D);
\draw[cross line] (D) -- (B);
\draw[<->, dashed] (C) to node {} (D);
\draw[<->, dashed] (F) to node {} (E);
\draw[<->, dashed] (G) to node {} (H);
\draw[<->, dashed] (A) to node {} (B);
\end{tikzpicture}
\caption{Polygon method for $n$ = 8.}
%Figure 1: Polygon method for $n$ = 8.
\end{figure}
% no! \end{center}
\end{document}