不同子图的标题级别存在问题

不同子图的标题级别存在问题

问题是我无法将标题放在同一级别(例如 (g) 和 (h) 或 (c) 和 (b))。我已经尝试使用 \caption 和 \subcaptionbox,但我不喜欢结果,因为标题没有对齐。 在此处输入图片描述

    \documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{tikz}
\author{R. A.}
\begin{document}
  \begin{figure*}[h]
    \centering
    \begin{subfigure}[b] {.46\linewidth}
      \centering
      \subcaptionbox{$G=K_2$ es un 1-\'arbol}[6cm]{
      \tikzstyle{every node}=[circle, draw, fill=black,
      inner sep=0pt, minimum width=4pt]
      \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
      {scale = .9,circle,draw,minimum size=1em}] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) {};
        \draw  (v1) edge (v2);
      \end{tikzpicture}
      }
      \label{fig:1}
    \end{subfigure}\hfill
    \begin{subfigure}[b]{.46\linewidth}
      \centering
            \subcaptionbox{$H$ es un subgrafo de $G$ isomorfo a $K_1$}[6cm]{
      \tikzstyle{every node}=[circle, draw, fill=black,
      inner sep=0pt, minimum width=4pt]
      \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
      {scale = .9,circle,draw,minimum size=1em}]

        \draw [dashed] (v2) ellipse (0.8 and 0.8);
        \node (v1) at (1,1) {};
        \node (v2) at (3,3)[label={[label distance=.4cm]150:$H$}] {};
        \draw  (v1) edge (v2);

      \end{tikzpicture}
}
      \label{fig:2}
    \end{subfigure}\hfill
    \begin{subfigure}[b]{.46\linewidth}
      \centering
      \subcaptionbox{Primero se agrega un nuevo v\'ertice $v_1$ a $G$}[6cm]{
      \tikzstyle{every node}=[circle, draw, fill=black,
      inner sep=0pt, minimum width=4pt]
      \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
      {scale = .9,circle,draw,minimum size=1em}] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) {};
        \draw  (v1) edge (v2);
        \node (v3) at (5,1)[label={[label distance=.15cm]0:$v_1$}] {};
      \end{tikzpicture}
    }
      \label{fig:3}

    \end{subfigure}\hfill
    \begin{subfigure}[b]{.46\linewidth}
      \centering
      \subcaptionbox{Luego se agregan aristas (en este caso una) de $v_1$ con 
        $H$ para crear una copia de $K_2$, el grafo resultante $G_1$ es un 
        1-\'arbol.}[6cm]
      {
      \tikzstyle{every node}=[circle, draw, fill=black,
      inner sep=0pt, minimum width=4pt]
      \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
      {scale = .9,circle,draw,minimum size=1em}] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) [label={[label distance=.4cm]150:$H$}] {};
        \draw  (v1) edge (v2);
        \draw [dashed] (v2) ellipse (0.8 and 0.8);
        \node (v3) at (5,1) [label={[label distance=.15cm]0:$v_1$}]{};
        \draw  (v2) edge (v3);
      \end{tikzpicture}
    }
      \label{fig:4}
    \end{subfigure}\hfill
    \begin{subfigure}[b]{.46\linewidth}
    \centering
    \subcaptionbox{Se elige un subgrafo $H_1$ de $G_1$ isomorfo a $K_1$
    }[6cm]{
    \tikzstyle{every node}=[circle, draw, fill=black,
    inner sep=0pt, minimum width=4pt]
    \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
    {scale = .9,circle,draw,minimum size=1em}] % color=red,%
    \node (v1) at (1,1) {};
    \node (v2) at (3,3) {};
    \draw  (v1) edge (v2);

    \node (v3) at (5,1) [label={[label distance=.4cm]0:$H_1$}] {};
    \draw  (v2) edge (v3);
    \draw  [dashed] (v3) ellipse (0.8 and 0.8);

    \end{tikzpicture}

}
    \label{fig:5}
    \vspace{-.45cm}
    \end{subfigure}\hfill
    \centering
    \begin{subfigure}[b]{.46\linewidth}
    \centering
      \subcaptionbox{Se agrega un nuevo v\'ertice $v_2$ a $G_1$
      }[6cm]{
    \tikzstyle{every node}=[circle, draw, fill=black,
    inner sep=0pt, minimum width=4pt]
    \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
    {scale = .9,circle,draw,minimum size=1em}] % color=red,%
    \node (v1) at (1,1) {};
    \node (v2) at (3,3) {};
    \draw  (v1) edge (v2);
    \node (v3) at (5,1) {};
    \draw  (v2) edge (v3);
    \node (v4) at (7,3)[label={[label distance=.15cm]30:$v_2$}] {}; 

    \end{tikzpicture}
}
\label{fig:6}
    %\vspace{4ex}
    \end{subfigure}\hfill
    \centering
    \begin{subfigure}[b]{.46\linewidth}
    \centering
        \subcaptionbox{Se a\~{n}aden aristas entre los v\'ertices de $H_1$ y $v_2$ para crear una copia 
          de $K_2$, el grafo resultante $G_2$ es un 1-\'arbol.}[6cm]{
    \tikzstyle{every node}=[circle, draw, fill=black,
    inner sep=0pt, minimum width=4pt]
    \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
    {scale = .9,circle,draw,minimum size=1em}] % color=red,%

    \node (v1) at (1,1) {};

    \node (v2) at (3,3) {};

    \draw  (v1) edge (v2);



    \node (v3) at (5,1)[label={[label distance=.4cm]0:$H_1$}] {};

    \draw  (v2) edge (v3);
    \draw [dashed] (v3) ellipse (0.8 and 0.8);

    \node (v4) at (7,3)[label={[label distance=.15cm]30:$v_2$}] {};
    \draw (v3) edge (v4);
    %\useasboundingbox(0.6,0.2) rectangle (9.8,5.4);


    \end{tikzpicture}
}
\label{fig:7}
    %\vspace{4ex}
    \end{subfigure}\hfill
    \centering
    \begin{subfigure}[b]{.46\linewidth}
    \centering
        \subcaptionbox{Grafo resultante de aplicar la definici\'on X.X eligiendo $H,H_1,H_2$ y $H_3$ 
          isomorfos a $K_1$ y agregando nuevos v\'ertices $v_1,v_2,v_3$ y $v_4$ a los 
          grafos resultantes.}[6cm]{
    \tikzstyle{every node}=[circle, draw, fill=black,
    inner sep=0pt, minimum width=4pt]
    \begin{tikzpicture}[scale = .65,thick,auto=left,every node/.style=
    {scale = .9,circle,draw,minimum size=1em}] % color=red,%

    \node (v1) at (1,1) {};
    \node (v2) at (3,3)[label={[label distance=.25cm]150:$H,H_2$}] {};
    \draw  (v1) edge (v2);
    \draw [dashed] (v2) ellipse (0.8 and 0.8);
    \node (v3) at (5,1)[label={[label distance=.4cm]0:$H_1$}][label={[label distance=.4cm]90:$v_1$}] {};
    \draw  (v2) edge (v3);
    \draw [dashed] (v3) ellipse (0.8 and 0.8);
    \node (v4) at (7,3)[label={[label distance=.4cm]30:$v_2$}] [label={[label distance=.4cm]90:$H_3$}]{};
    \draw (v3) edge (v4);
    \node (v5)at (5,5) [label={[label distance=.15cm]180:$v_3$}]{};
    \node (v6)at (9,1) [label={[label distance=.15cm]30:$v_4$}] {};
    \draw (v2)edge(v5);
    \draw (v4)edge(v6);
    \draw [dashed] (v4) ellipse (0.8 and 0.8);  
  %\useasboundingbox(0.6,0.2) rectangle (9.8,5.4);
    \end{tikzpicture}
}
\label{fig:8}
    %\vspace{4ex}
    \end{subfigure}\hfill
    \caption{Procedimiento}
    \label{fig:ch3_procedureA}
  \end{figure*}
\end{document}

答案1

您有点误解了,不要同时使用环境subfigure\subcaptionbox,只使用其中之一。我认为后者单独就可以实现您想要的功能,即垂直对齐相邻子标题的第一行。\label必须在第一个参数中添加 s,以及子标题的文本。

其他需要考虑的事项:

  • 由于 之前有换行符,因此每个单词的开头subcaptionbox都有一个单词间空格。在行末\begin{tikzpicture}添加可避免这种情况。%

  • 对于每个子图,您需要设置every node两次样式,一次使用\tikzstyle(应使用 切换\tikzset),一次在 的可选参数中tikzpicture。后者覆盖前者,因此没有效果。如果您希望这更容易管理,请在环境\tikzset开始时添加一个figure,然后删除其余的。

在此处输入图片描述

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{tikz}

\begin{document}
  \begin{figure*}
    \centering
    \tikzset{every node/.style={
        %circle, draw, fill=black, inner sep=0pt, minimum width=4pt
        scale = .9,circle,draw,minimum size=1em}}
      \subcaptionbox{$G=K_2$ es un 1-\'arbol\label{fig:1}}[0.46\textwidth]{%      
      \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) {};
        \draw  (v1) edge (v2);
      \end{tikzpicture}%
      }\hfill
         \subcaptionbox{$H$ es un subgrafo de $G$ isomorfo a $K_1$\label{fig:2}}[0.46\textwidth]{%
      \begin{tikzpicture}[scale = .65,thick,auto=left]

        \draw [dashed] (v2) ellipse (0.8 and 0.8);
        \node (v1) at (1,1) {};
        \node (v2) at (3,3)[label={[label distance=.4cm]150:$H$}] {};
        \draw  (v1) edge (v2);

      \end{tikzpicture}
}      \subcaptionbox{Primero se agrega un nuevo v\'ertice $v_1$ a $G$\label{fig:3}}[0.46\textwidth]{%
      \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) {};
        \draw  (v1) edge (v2);
        \node (v3) at (5,1)[label={[label distance=.15cm]0:$v_1$}] {};
      \end{tikzpicture}%
    }\hfill
      \subcaptionbox{Luego se agregan aristas (en este caso una) de $v_1$ con 
        $H$ para crear una copia de $K_2$, el grafo resultante $G_1$ es un 
        1-\'arbol.\label{fig:4}}[0.46\textwidth]
      {%
      \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%
        \node (v1) at (1,1) {};
        \node (v2) at (3,3) [label={[label distance=.4cm]150:$H$}] {};
        \draw  (v1) edge (v2);
        \draw [dashed] (v2) ellipse (0.8 and 0.8);
        \node (v3) at (5,1) [label={[label distance=.15cm]0:$v_1$}]{};
        \draw  (v2) edge (v3);
      \end{tikzpicture}%
    }
    \subcaptionbox{Se elige un subgrafo $H_1$ de $G_1$ isomorfo a $K_1$\label{fig:5}}[0.46\textwidth]{%
    \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%
    \node (v1) at (1,1) {};
    \node (v2) at (3,3) {};
    \draw  (v1) edge (v2);

    \node (v3) at (5,1) [label={[label distance=.4cm]0:$H_1$}] {};
    \draw  (v2) edge (v3);
    \draw  [dashed] (v3) ellipse (0.8 and 0.8);
    \end{tikzpicture}%
}\hfill
      \subcaptionbox{Se agrega un nuevo v\'ertice $v_2$ a $G_1$\label{fig:6}
      }[0.46\textwidth]{%
    \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%
    \node (v1) at (1,1) {};
    \node (v2) at (3,3) {};
    \draw  (v1) edge (v2);
    \node (v3) at (5,1) {};
    \draw  (v2) edge (v3);
    \node (v4) at (7,3)[label={[label distance=.15cm]30:$v_2$}] {}; 

    \end{tikzpicture}%
}
        \subcaptionbox{Se a\~{n}aden aristas entre los v\'ertices de $H_1$ y $v_2$ para crear una copia 
          de $K_2$, el grafo resultante $G_2$ es un 1-\'arbol.\label{fig:7}}[0.46\textwidth]{%
    \begin{tikzpicture}[scale = .65,thick,auto=left] % color=red,%

    \node (v1) at (1,1) {};
    \node (v2) at (3,3) {};
    \draw  (v1) edge (v2);
    \node (v3) at (5,1)[label={[label distance=.4cm]0:$H_1$}] {};
    \draw  (v2) edge (v3);
    \draw [dashed] (v3) ellipse (0.8 and 0.8);
    \node (v4) at (7,3)[label={[label distance=.15cm]30:$v_2$}] {};
    \draw (v3) edge (v4);
    %\useasboundingbox(0.6,0.2) rectangle (9.8,5.4);


    \end{tikzpicture}
}\hfill
        \subcaptionbox{Grafo resultante de aplicar la defi\-nici\'on X.X eligiendo $H,H_1,H_2$ y $H_3$ 
          isomorfos a $K_1$ y agregando nuevos v\'ertices $v_1,v_2,v_3$ y $v_4$ a los 
          grafos resultantes.\label{fig:8}}[0.46\textwidth]{%
    \begin{tikzpicture}[scale = .55,thick,auto=left] % color=red,%

    \node (v1) at (1,1) {};
    \node (v2) at (3,3)[label={[label distance=.25cm]150:$H,H_2$}] {};
    \draw  (v1) edge (v2);
    \draw [dashed] (v2) ellipse (0.8 and 0.8);
    \node (v3) at (5,1)[label={[label distance=.4cm]0:$H_1$}][label={[label distance=.4cm]90:$v_1$}] {};
    \draw  (v2) edge (v3);
    \draw [dashed] (v3) ellipse (0.8 and 0.8);
    \node (v4) at (7,3)[label={[label distance=.4cm]30:$v_2$}] [label={[label distance=.4cm]90:$H_3$}]{};
    \draw (v3) edge (v4);
    \node (v5)at (5,5) [label={[label distance=.15cm]180:$v_3$}]{};
    \node (v6)at (9,1) [label={[label distance=.15cm]30:$v_4$}] {};
    \draw (v2)edge(v5);
    \draw (v4)edge(v6);
    \draw [dashed] (v4) ellipse (0.8 and 0.8);  
  %\useasboundingbox(0.6,0.2) rectangle (9.8,5.4);
    \end{tikzpicture}
}
    \caption{Procedimiento}
    \label{fig:ch3_procedureA}
  \end{figure*}
\end{document}

相关内容