¿Cómo puedo centrar una imagen tikz sin centrar el elemento que la contiene?

¿Cómo puedo centrar una imagen tikz sin centrar el elemento que la contiene?

Tengo un ejercicio particular en el que quiero que un diagrama que creé tikzpictureesté centrado, pero también quiero que la etiqueta \itemque lo contiene se deje sola y permanezca en línea con los otros enumeradores en su nivel. He logrado encontrar soluciones para muchos otros problemas que he tenido (este es mi primer documento LaTeX), pero no importa qué respuesta haya probado, la \itemetiqueta (en este caso, a (b)) parece déjate llevar por el viaje, así:

![secuestro de elementos de etiqueta central

Aquí hay algunos ejemplos de lo que he probado:

\begin{center}
  \begin{tikzpicture}
  ....
  \end{tikzpicture}
\end{center}

{\centering

  \begin{tikzpicture}
  ....
  \end{tikzpicture}

}

\begin{figure}
   \begin{center}
     \begin{tikzpicture}
      ....
     \end{tikzpicture}
   \end{center}
\end{figure}

\begin{tikzpicture}
  \centering

  ....
\end{tikzpicture}

...etcétera. Obtengo los "mejores" resultados con los dos primeros, que me parecen idénticos. (b) se desplaza hacia el centro y no hay un espacio vertical adecuado entre tikzpicturey el texto debajo. Sin embargo, los diagramas posteriores (que son todos iguales \itemque el primero) no tienen este problema de espaciado. Me parece extraño que \begin{center}incluya algo que debería estar fuera de su alcance, pero estoy seguro de que hay una explicación sencilla. Aquí hay un ejemplo de trabajo mínimo (más o menos) (tengo la intención de refactorizarlo para minimizar la repetición):

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,bm,enumitem,tikz}

\usetikzlibrary{calc,positioning,shapes}

\tikzset{
    between/.style args={#1 and #2}{
         at = ($(#1)!0.5!(#2)$)
    }
}

\tikzstyle{mydot}=[circle,fill,inner sep=2pt]
\tikzstyle{myellipse}=[ellipse,draw=cyan,thick,minimum width=60pt,minimum height=110pt,inner sep=0pt]
\tikzstyle{every edge}=[draw=cyan,thick]
\tikzstyle{relarrow}=[->, shorten >= 0pt, shorten <= 0pt, out=25, in=155]

\begin{document}

\begin{enumerate}
    \item
    \begin{enumerate}
        \item $R=\{(5,5),(6,5),(6,6)\}$,\\
              $S=\{(4,6),(5,5),(5,7),(6,6)\}$

        \item % Relation R
             \begin{center}
             \begin{tikzpicture}[
             >=latex,
             shorten >= 3pt,
             shorten <= 3pt,
             baseline={([yshift=-1em] current bounding box.north)}
             ]

             \node[mydot,label={left:4}] (a1) {}; 
             \node[mydot,below=of a1,label={left:5}] (a2) {}; 
             \node[mydot,below=of a2,label={left:6}] (a3) {}; 

             \node[mydot,right=5cm of a1,label={right:5}] (b1) {}; 
             \node[mydot,below=of b1,label={right:6}] (b2) {}; 
             \node[mydot,below=of b2,label={right:7}] (b3) {}; 

             \path[->] (a2) edge (b1);
             \path[->] (a3) edge (b1)
                 edge(b2);

             \node[myellipse,label={above:A}] at (a2.center) (c1) {};
             \node[myellipse,label={above:B}] at (b2.center) (c2) {};

             \node at (2.5, 0.75) (r1) {$R$};
             \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);

             \end{tikzpicture}
             \end{center}

             $R$ is not a function because it fails both 
             properties (1) and (2) of the definition of a function.
             $4\in A$, but there is no $(4,y)\in R$ for any 
             $y\in B$.
             Also, \mbox{$(6,5)\in R$} and $(6,6)\in R\text{, but }
             5\neq6$.

             % Relation S
             \begin{center}
             \begin{tikzpicture}[
             >=latex,
             shorten >= 3pt,
             shorten <= 3pt,
             baseline={([yshift=-1em] current bounding box.north)}
             ]

             \node[mydot,label={left:4}] (a1) {}; 
             \node[mydot,below=of a1,label={left:5}] (a2) {}; 
             \node[mydot,below=of a2,label={left:6}] (a3) {}; 

             \node[mydot,right=5cm of a1,label={right:5}] (b1) {}; 
             \node[mydot,below=of b1,label={right:6}] (b2) {}; 
             \node[mydot,below=of b2,label={right:7}] (b3) {}; 

             \path[->] (a1) edge (b2);
             \path[->] (a2) edge (b1)
                 edge (b3);
             \path[->] (a3) edge (b2);

             \node[myellipse,label={above:A}] at (a2.center) (c1) {};
             \node[myellipse,label={above:B}] at (b2.center) (c2) {};

             \node at (2.5, 0.75) (r1) {$S$};
             \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);

             \end{tikzpicture}
             \end{center}

             $S$ is not a function because it fails property 
             (2) of the definition of a function.
             $(5,5)\in S\text{ and }(5,7)\in S\text{, but }
             5\neq7$.

    \end{enumerate}
\end{enumerate}

\end{document}

Respuesta1

Consideraría estos diagramas como presentaciones matemáticas, aunque sería mejor agregar algún texto introductorio.

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry} 
\usepackage{amsmath,amsthm,amssymb,bm,enumitem,tikz}

\usetikzlibrary{calc,positioning,shapes}

\tikzset{
  between/.style args={#1 and #2}{at = ($(#1)!0.5!(#2)$)},
  mydot/.style={circle,fill,inner sep=2pt},
  myellipse/.style={
    ellipse,
    draw=cyan,
    thick,
    minimum width=60pt,
    minimum height=110pt,
    inner sep=0pt
  },
  every edge/.style={draw=cyan,thick},
  relarrow/.style={->, shorten >= 0pt, shorten <= 0pt, out=25, in=155},
}

\begin{document}

\begin{enumerate}
\item
  \begin{enumerate}
  \item $R=\{(5,5),(6,5),(6,6)\}$,\\
        $S=\{(4,6),(5,5),(5,7),(6,6)\}$

  \item % Relation R
    \[
    \begin{tikzpicture}[
      >=latex,
      shorten >= 3pt,
      shorten <= 3pt,
      baseline={([yshift=-1em] current bounding box.north)}
    ]

    \node[mydot,label={left:4}] (a1) {}; 
    \node[mydot,below=of a1,label={left:5}] (a2) {}; 
    \node[mydot,below=of a2,label={left:6}] (a3) {}; 

    \node[mydot,right=5cm of a1,label={right:5}] (b1) {}; 
    \node[mydot,below=of b1,label={right:6}] (b2) {}; 
    \node[mydot,below=of b2,label={right:7}] (b3) {}; 

    \path[->] (a2) edge (b1);
    \path[->] (a3) edge (b1) edge(b2);

    \node[myellipse,label={above:$A$}] at (a2.center) (c1) {};
    \node[myellipse,label={above:$B$}] at (b2.center) (c2) {};

    \node at (2.5, 0.75) (r1) {$R$};
    \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);

    \end{tikzpicture}
    \]
    $R$ is not a function because it fails both 
    properties (1) and (2) of the definition of a function.
    $4\in A$, but there is no $(4,y)\in R$ for any $y\in B$.
    Also, $(6,5)\in R$ and $(6,6)\in R$, but~$5\neq6$.

  \item % Relation S
    \[
    \begin{tikzpicture}[
      >=latex,
      shorten >= 3pt,
      shorten <= 3pt,
      baseline={([yshift=-1em] current bounding box.north)}
    ]

    \node[mydot,label={left:4}] (a1) {}; 
    \node[mydot,below=of a1,label={left:5}] (a2) {}; 
    \node[mydot,below=of a2,label={left:6}] (a3) {}; 

    \node[mydot,right=5cm of a1,label={right:5}] (b1) {}; 
    \node[mydot,below=of b1,label={right:6}] (b2) {}; 
    \node[mydot,below=of b2,label={right:7}] (b3) {}; 

    \path[->] (a1) edge (b2);
    \path[->] (a2) edge (b1) edge (b3);
    \path[->] (a3) edge (b2);

    \node[myellipse,label={above:$A$}] at (a2.center) (c1) {};
    \node[myellipse,label={above:$B$}] at (b2.center) (c2) {};

    \node at (2.5, 0.75) (r1) {$S$};
    \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);

    \end{tikzpicture}
    \]
    $S$ is not a function because it fails property (2) of
    the definition of a function.
    $(5,5)\in S$ and $(5,7)\in S$, but~$5\neq7$.

  \end{enumerate}
\end{enumerate}

\end{document}

Algunos puntos a tener en cuenta:

  1. \tikzstylees obsoleto

  2. Los nombres de los conjuntos deben estar en modo matemático: label={above:$A$}funciona para esto

  3. El texto

    Also, \mbox{$(6,5)\in R$} and $(6,6)\in R\text{, but } 5\neq6$.
    

    debiera ser

    Also, $(6,5)\in R$ and $(6,6)\in R$, but~$5\neq6$.
    
  4. Del mismo modo, el texto

    $(5,5)\in S\text{ and }(5,7)\in S\text{, but } 5\neq7$.
    

    debiera ser

    $(5,5)\in S$ and $(5,7)\in S$, but~$5\neq7$.
    
  5. No dejes líneas en blanco entre \]y el siguiente texto.

ingrese la descripción de la imagen aquí

Respuesta2

Solo necesita agregar \mbox{}algo de texto para llevar la etiqueta del artículo.

ingrese la descripción de la imagen aquí

\begin{document}

\begin{enumerate}
    \item
    \begin{enumerate}
        \item $R=\{(5,5),(6,5),(6,6)\}$,\\
              $S=\{(4,6),(5,5),(5,7),(6,6)\}$

        \item \mbox{}
             \begin{center}
             \begin{tikzpicture}[

Respuesta3

Como esto:

ingrese la descripción de la imagen aquí

La solución es bastante simple. después \itempara bsimplemente agregar ~o \mbox{}. El MWE completo es que (después de pequeños cambios) es:

\documentclass[12pt]{article}

\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb,bm}
\usepackage{enumitem,tikz}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,shapes}

\tikzset{          >=latex,
           shorten >=3pt,
           shorten <=3pt,
between/.style args ={#1 and #2}{at = ($(#1)!0.5!(#2)$)},
      mydot/.style  ={circle,fill,inner sep=2pt},
  myellipse/.style  ={ellipse,draw=cyan,thick,
                      minimum width=60pt,minimum height=110pt,
                      inner sep=0pt},
 every edge/.style  ={draw=cyan,thick},
   relarrow/.style  ={->, out=25, in=155}
        }

\begin{document}

\begin{enumerate}
    \item
    \begin{enumerate}
        \item $R=\{(5,5),(6,5),(6,6)\}$,\\
              $S=\{(4,6),(5,5),(5,7),(6,6)\}$

        \item \mbox{}% <-- added      (Relation R  )
             \begin{center}
             \begin{tikzpicture}[
             baseline={([yshift=-1em] current bounding box.north)}
                                ]
             \node[mydot,label={left:4}] (a1) {};
             \node[mydot,below=of a1,label={left:5}] (a2) {};
             \node[mydot,below=of a2,label={left:6}] (a3) {};

             \node[mydot,right=5cm of a1,label={right:5}] (b1) {};
             \node[mydot,below=of b1,label={right:6}] (b2) {};
             \node[mydot,below=of b2,label={right:7}] (b3) {};

             \path[->] (a2) edge (b1);
             \path[->] (a3) edge (b1) edge (b2);

             \node[myellipse,label={above:A}] at (a2.center) (c1) {};
             \node[myellipse,label={above:B}] at (b2.center) (c2) {};

             \node at (2.5, 0.75) (r1) {$R$};
             \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);
             \end{tikzpicture}
             \end{center}

     $R$ is not a function because it fails both properties (1) and (2) of the definition of a function. $4\in A$, but there is no $(4,y)\in R$ for any $y\in B$. Also, $(6,5)\in R$ and $(6,6)\in R$, but $5\neq6$.

             % Relation S
             \begin{center}
             \begin{tikzpicture}[
             baseline={([yshift=-1em] current bounding box.north)}
                                ]
             \node[mydot,label=left:4] (a1) {};
             \node[mydot,below=of a1,label=left:5] (a2) {};
             \node[mydot,below=of a2,label=left:6] (a3) {};

             \node[mydot,right=5cm of a1,label=right:5] (b1) {};
             \node[mydot,below=of b1,label=right:6] (b2) {};
             \node[mydot,below=of b2,label=right:7] (b3) {};

             \path[->] (a1) edge (b2);
             \path[->] (a2) edge (b1)
                 edge (b3);
             \path[->] (a3) edge (b2);

             \node[myellipse,label=above:A] at (a2.center) (c1) {};
             \node[myellipse,label=above:B] at (b2.center) (c2) {};

             \node at (2.5, 0.75) (r1) {$S$};
             \path[relarrow] (2.1, 0.4) edge (2.95, 0.35);
             \end{tikzpicture}
             \end{center}

             $S$ is not a function because it fails property (2) of the definition of a function. $(5,5)\in S$ and $(5,7)\in S$, but $5\neq7$.
    \end{enumerate}
\end{enumerate}
\end{document}

información relacionada