2

The problem is that I cant put at the same level the captions (for example (g) and (h) or (c) and (b)). I've already tried with \caption and \subcaptionbox but I did not like the result because the captions are not aligned. enter image description here

    \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}
3

You've misunderstood a bit, don't use both the subfigure environment and \subcaptionbox, only one of them. The latter alone does what you want I think, vertically aligning the first line of adjacent subcaptions. The \labels have to added in the first argument, along with the text for the subcaption.

Other things to consider:

  • At the start of each subcaptionbox there is an interword space because of the linebreak before \begin{tikzpicture}. Add a % at the end of line to avoid that.

  • For each subfigure you set the every node style twice, once with \tikzstyle (which should be switched with \tikzset), and once in the optional argument to the tikzpicture. The latter overrides the former, so that has no effect. If you want this to be more easily manageable, add a single \tikzset at the start of the figure environment, and remove the rest.

enter image description here

\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}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.