\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{tikz}
\usepackage{caption}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\tikzstyle{every node}=[circle, draw, fill=black!100,
inner sep=0pt, minimum width=6pt]
\begin{tikzpicture}[thick,scale=0.8]%
\draw(0,0)node[label={[yshift=0cm]270:{$1$}}](1){};
\draw(0,4)node[label={[yshift=0cm]90:{$2$}}](2){};
\draw(4,4)node[label={[yshift=0cm]90:{$3$}}](3){};
\draw(4,0)node[label={[yshift=0cm]270:{$4$}}](4){};
\draw[->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](1)--(2);
\draw[dashed, ->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](2)--(3);
\draw[densely dotted,->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](3)--(4);
\draw[densely dashdotdotted, ->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](4)--(1);
\end{tikzpicture}
{\captionof{figure}{4 types of arcs.}}
In Figure 1, there are 4 types of arcs, namely the solid $<display Solid Line Here>$, dashed $<display Dashed Line Here>$, densely dotted $<display Densely Dotted Line Here>$, and densely dashdotdotted $<display Densely Dashdotdotted Line Here>$.
\noindent\par The best I can do is
In Figure 1, there are 4 types of arcs, namely the solid $<display Solid Line Here>$, dashed $<--->$, densely dotted $<\cdots>$, and densely dashdotdotted $<display Densely Dashdotdotted Line Here>$
\end{document}
谢谢
答案1
您可以在文档中的几乎任意位置插入 TikZ 图片。甚至还有\tikz...;
带有单一路径的内联图片的简写符号。
为了使线条居中,我使用了baseline=-\the\fontdimen22\textfont2
数学模式下运算符居中的高度。另请参阅不同的 \fontdimen<num> 代表什么意思
\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{tikz}
\usepackage{caption}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{center}
\begin{tikzpicture}[
thick,
scale=0.8,
every node/.style={
circle,
draw,
fill=black!100,
inner sep=0pt,
minimum width=6pt
}]
\draw(0,0)node[label={[yshift=0cm]270:{$1$}}](1){};
\draw(0,4)node[label={[yshift=0cm]90:{$2$}}](2){};
\draw(4,4)node[label={[yshift=0cm]90:{$3$}}](3){};
\draw(4,0)node[label={[yshift=0cm]270:{$4$}}](4){};
\draw[->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](1)--(2);
\draw[dashed, ->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](2)--(3);
\draw[densely dotted,->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](3)--(4);
\draw[densely dashdotdotted, ->, line width=0.3mm, >=latex, shorten <= 0.2cm, shorten >= 0.15cm](4)--(1);
\end{tikzpicture}
\captionof{figure}{\label{fig:arcs}4 types of arcs.}
\end{center}
\newcommand*\lineexample[1]{%
#1~(\tikz[baseline=-\the\fontdimen22\textfont2]\draw[#1](0,0)--(1.618em,0);)%
}
In Figure~\ref{fig:arcs}, there are 4 types of arcs, namely the
\lineexample{solid}, \lineexample{dashed}, \lineexample{densely dotted}, and
\lineexample{densely dashdotdotted}.
\end{document}
只是为了好玩,这里再次使用相同的例子\graph
。
\documentclass[12pt,a4paper,onecolumn]{article}
\usepackage{tikz}
\usetikzlibrary{graphs}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
thick,
scale=0.8,
every node/.style={
circle,
draw,
fill=black!100,
inner sep=0pt,
minimum width=6pt
}]
\node[label={below:$1$}](1) at (0,0) {};
\node[label={above:$2$}](2) at (0,4) {};
\node[label={above:$3$}](3) at (4,4) {};
\node[label={below:$4$}](4) at (4,0) {};
\graph [use existing nodes,edges={>=latex,shorten <=0.2cm,shorten >=0.15cm}] {
1 ->[solid] 2 ->[dashed] 3 ->[densely dotted] 4 ->[densely dashdotted] 1
};
\end{tikzpicture}
\caption{\label{fig:arcs}4 types of arcs.}
\end{figure}
\newcommand*\lineexample[1]{%
#1~(\tikz[baseline=-\the\fontdimen22\textfont2]\draw[#1](0,0)--(1.618em,0);)%
}
In Figure~\ref{fig:arcs}, there are 4 types of arcs, namely the
\lineexample{solid}, \lineexample{dashed}, \lineexample{densely dotted}, and
\lineexample{densely dashdotted}.
\end{document}