Tikz 图片出现以下示例

Tikz 图片出现以下示例

我有以下代码在示例中生成 tikz 图像。

\documentclass{article}

\usepackage{tikz}
\usepackage{amsmath}
\newtheorem{example}{Example}

\begin{document}

\begin{example}
    \begin{figure}[h]
        \begin{tikzpicture}[thick,scale=0.85, every node/.style={scale=0.85}]
        \draw [help lines,white!20!white] (-3,-2) grid (10,6);
        \draw[white,dashed] 
        (-2+2,0.5) coordinate(A)
        -- (0.8+2,2) coordinate (B) 
        -- (0.2+2,4) coordinate (C) 
        -- (-2+2,2) coordinate (D) -- cycle
        (A)--(C) (B)--(D);
        \draw (A) .. controls (B) and (C) .. (D);
        \filldraw[black] (0.15+2,3.15) circle(2pt) node[anchor=west] {$b_2$};
        \filldraw[black] (-0.1+2,2.6) circle(2pt) node[anchor=west] {$b_1$};


        \draw [help lines,white!20!white] (0,-3) grid (10,7);
        \draw[white,dashed] 
        (4+0.5,5.5) coordinate(A)
        -- (-1+3,3.5) coordinate (B) 
        -- (-1+2,2.1) coordinate (C) 
        -- (4,4.25) coordinate (D) -- cycle
        (A)--(C) (B)--(D);
        \draw (A) .. controls (B) and (C) .. (D);

        \draw(3.3,5)--(7,3);
        \draw(3.05,4)--(7.25,0.5+1);  
        \filldraw[black] (4.25,4.48648) circle(2pt) node[anchor=west] {$b_3$};
        \filldraw[black] (5,2.8392855) circle(2pt) node[anchor=west] {$b_4$};
        \filldraw[black] (5.75,3.675671) circle(2pt) node[anchor=west] {$b_5$};
        \filldraw[black] (6.5,1.94642) circle(2pt) node[anchor=west] {$b_6$};
        \filldraw[black] (6.85,3.0810772) circle(2pt) node[anchor=west] {$b_7$};

        \draw(4.25,1.25+1)--(1,-2+1);
        \filldraw[black] (0.35+1.9,-1.46+1.8*0.995-0.08) circle(2pt) node[anchor=west] {$a_2$};
        \filldraw[black] (-0.1+1.91,-1.875+1.91*0.995-0.2) circle(2pt) node[anchor=west] {$a_1$};

        \draw(3.25,1.25+1)--(7.25,-2.25+1);
        \filldraw[black] (4.25,1.375) circle(2pt) node[anchor=west] {$a_3$};
        \filldraw[black] (5,0.71875) circle(2pt) node[anchor=west] {$a_4$};
        \filldraw[black] (5.75,0.0625) circle(2pt) node[anchor=west] {$a_5$};
        \filldraw[black] (6.5,-0.59375) circle(2pt) node[anchor=west] {$a_6$};
        \filldraw[black] (6.85,-0.9) circle(2pt) node[anchor=west] {$a_7$};

        \node[anchor=west,text width=6.5cm] (note1) at (8,3) {
            We have the following Hurwitz correspondence, where the map has degree 2 and where the points are sent as follows:
            \\
            \centering
            $a_{1}\overset{2}\rightarrow b_{1}$\\
            $a_{2}\overset{2}\rightarrow b_{2}$\\
            $a_{3}\rightarrow b_{3}$\\
            $a_{4}\rightarrow b_{4}$\\
            $a_{5}\rightarrow b_{5}$\\
            $a_{6}\rightarrow b_{6}$\\
            $a_{7}\rightarrow b_{7}$\\
        };
        \end{tikzpicture}
        \caption{In this picture we see a Hurwitz correspondence represented by the squaring map. In the picture, we see the ramification (rm) is the following $rm(a_1)=rm(a_2)=2$ and $rm(a_i)=1$ for $i=3,4,5,6,7$. We say that this map has 2 special points, $a_1$ and $a_2$.} \label{fig:M1}
    \end{figure}
\end{example}


\end{document}

但是,我的图片出现在示例标签“示例 6”上方。在此处输入图片描述

有人知道为什么会发生这种情况吗?

答案1

您可以figure按照 cfr 的建议省略环境,或者使用float包并h用 替换选项H

在您的示例中,只有图形并没有起到什么作用。例如,即使我通过~图形添加了一个空格,它也会显示在您想要的位置。

另外,下次请发布 MWE。

\documentclass{article}

\usepackage{tikz}
\usepackage{amsmath}
\newtheorem{example}{Example}

\begin{document}

\begin{example}~
    \begin{figure}[h]
        \begin{tikzpicture}[thick,scale=0.85, every node/.style={scale=0.85}]
        \draw [help lines,white!20!white] (-3,-2) grid (10,6);
        \draw[white,dashed] 
        (-2+2,0.5) coordinate(A)
        -- (0.8+2,2) coordinate (B) 
        -- (0.2+2,4) coordinate (C) 
        -- (-2+2,2) coordinate (D) -- cycle
        (A)--(C) (B)--(D);
        \draw (A) .. controls (B) and (C) .. (D);
        \filldraw[black] (0.15+2,3.15) circle(2pt) node[anchor=west] {$b_2$};
        \filldraw[black] (-0.1+2,2.6) circle(2pt) node[anchor=west] {$b_1$};


        \draw [help lines,white!20!white] (0,-3) grid (10,7);
        \draw[white,dashed] 
        (4+0.5,5.5) coordinate(A)
        -- (-1+3,3.5) coordinate (B) 
        -- (-1+2,2.1) coordinate (C) 
        -- (4,4.25) coordinate (D) -- cycle
        (A)--(C) (B)--(D);
        \draw (A) .. controls (B) and (C) .. (D);

        \draw(3.3,5)--(7,3);
        \draw(3.05,4)--(7.25,0.5+1);  
        \filldraw[black] (4.25,4.48648) circle(2pt) node[anchor=west] {$b_3$};
        \filldraw[black] (5,2.8392855) circle(2pt) node[anchor=west] {$b_4$};
        \filldraw[black] (5.75,3.675671) circle(2pt) node[anchor=west] {$b_5$};
        \filldraw[black] (6.5,1.94642) circle(2pt) node[anchor=west] {$b_6$};
        \filldraw[black] (6.85,3.0810772) circle(2pt) node[anchor=west] {$b_7$};

        \draw(4.25,1.25+1)--(1,-2+1);
        \filldraw[black] (0.35+1.9,-1.46+1.8*0.995-0.08) circle(2pt) node[anchor=west] {$a_2$};
        \filldraw[black] (-0.1+1.91,-1.875+1.91*0.995-0.2) circle(2pt) node[anchor=west] {$a_1$};

        \draw(3.25,1.25+1)--(7.25,-2.25+1);
        \filldraw[black] (4.25,1.375) circle(2pt) node[anchor=west] {$a_3$};
        \filldraw[black] (5,0.71875) circle(2pt) node[anchor=west] {$a_4$};
        \filldraw[black] (5.75,0.0625) circle(2pt) node[anchor=west] {$a_5$};
        \filldraw[black] (6.5,-0.59375) circle(2pt) node[anchor=west] {$a_6$};
        \filldraw[black] (6.85,-0.9) circle(2pt) node[anchor=west] {$a_7$};

        \node[anchor=west,text width=6.5cm] (note1) at (8,3) {
            We have the following Hurwitz correspondence, where the map has degree 2 and where the points are sent as follows:
            \\
            \centering
            $a_{1}\overset{2}\rightarrow b_{1}$\\
            $a_{2}\overset{2}\rightarrow b_{2}$\\
            $a_{3}\rightarrow b_{3}$\\
            $a_{4}\rightarrow b_{4}$\\
            $a_{5}\rightarrow b_{5}$\\
            $a_{6}\rightarrow b_{6}$\\
            $a_{7}\rightarrow b_{7}$\\
        };
        \end{tikzpicture}
        \caption{In this picture we see a Hurwitz correspondence represented by the squaring map. In the picture, we see the ramification (rm) is the following $rm(a_1)=rm(a_2)=2$ and $rm(a_i)=1$ for $i=3,4,5,6,7$. We say that this map has 2 special points, $a_1$ and $a_2$.} \label{fig:M1}
    \end{figure}
\end{example}


\end{document}

相关内容