
Estoy intentando crear diagramas como los de la siguiente imagen en TikZ (he incluido algunos ejemplos diferentes). Actualmente cambio manualmente los nodos a lo largo del eje x para que encajen un poco, pero esto obviamente no funciona muy bien. Además de probar diferentes valores hasta que funciona con esfuerzo, los nodos ni siquiera están alineados correctamente. El último ejemplo muestra esto muy bien ( a_0
y a_n
debería estar arriba b_0
y b_n
respectivamente).
Este es mi enfoque actual, MWE para los ejemplos proporcionados:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node (a) at (0, 0) {$(p, \bar{u}) = c_1$};
\node[rotate=90] (leq1) at (0.6, -0.35) {$\leq$};
\node (b) at (1.2, -0.7) {$(p, \bar{u}') = c_1' \longrightarrow c_2' = (q, \bar{v}')$};
\node[rotate=90] (leq2) at (1.7, -1.05) {$\leq$};
\node (c) at (2.4, -1.4) {$c_2 = (q, \bar{v})$};
\end{tikzpicture}
\begin{tikzpicture}
\node (a) at (0, 0) {$(p, \bar{v})$};
\node[rotate=90] (leq1) at (0, -0.35) {$\leq$};
\node (b) at (0.9, -0.7) {$(p, \bar{v}') \longrightarrow (q, \bar{w}')$};
\node[rotate=90] (leq2) at (1.7, -1.05) {$\leq$};
\node (c) at (1.7, -1.4) {$(q, \bar{w})$};
\end{tikzpicture}
\begin{tikzpicture}
\node (a) at (0, 0) {$(p, u)$};
\node[rotate=90] (leq1) at (0, -0.35) {$\leq$};
\node (b) at (-0.3, -0.7) {$A \ni (p, u')$};
\node[rotate=90] (leq2) at (0, -1.05) {$\leq$};
\node (c) at (0, -1.4) {$(p, u'')$};
\node[rotate=90] (leq2) at (0, -1.75) {$\leq$};
\node (d) at (0.75, -2.1) {$B \ni (p, u''') \longrightarrow (q, v) \in C$};
\end{tikzpicture}
\begin{tikzpicture}
\node (a) at (0, 0) {$\circ \longrightarrow^* \circ$};
\node[rotate=90] (leq1) at (-0.5, -0.35) {$\leq$};
\node[rotate=90] (leq2) at (0.5, -0.35) {$\leq$};
\node (b) at (0.5, -0.7) {$\circ \longrightarrow \circ \longrightarrow^* \circ$};
\node[rotate=90] (leq3) at (1.5, -1.05) {$\leq$};
\node (c) at (1.9, -1.4) {$\circ \in A$};
\end{tikzpicture}
\begin{tikzpicture}
\node (a) at (0, 0) {$a = a_0 \longrightarrow^* a_1 \longrightarrow^* a_2 \longrightarrow^* \ldots \longrightarrow^* a_n$};
\node[rotate=90] (leq1) at (-2.1, -0.35) {$\leq$};
\node[rotate=90] (leq2) at (2.6, -0.35) {$\leq$};
\node (b) at (0, -0.7) {$b = b_0 \longrightarrow b_1 \longrightarrow b_2 \longrightarrow \ldots \longrightarrow b_n$};
\end{tikzpicture}
\end{document}
¿Cómo puedo crear este tipo de diagramas correctamente?
Respuesta1
¿Por qué necesitas dibujar estas ecuaciones? Parece que es más sencillo escribirlos como matrices. Por ejemplo, para sus dos últimos ejemplos en cuestión:
\documentclass{article}
\usepackage{adjustbox}
\begin{document}
\[\setlength\arraycolsep{1pt}
\begin{array}{ccc cccc c}
\circ & \longrightarrow^* & \circ & & & & \\
\adjustbox{rotate=90}{$\leq$}
& & \adjustbox{rotate=90}{$\leq$} & & & & \\
\circ & \longrightarrow^* & \circ
& \longrightarrow^* & \circ & & \\
& & & & \adjustbox{rotate=90}{$\leq$} & & & & \\
& & & & \circ & \in & A \\
\end{array}
\]
\bigskip
\[\setlength\arraycolsep{1pt}
\begin{array}{rclcl clcl cl}
a & = & a_0
& \longrightarrow^* & a_1 & \longrightarrow^* & a_2
& \longrightarrow^* & \ldots & \longrightarrow^* & a_n \\
&& \adjustbox{rotate=90}{$\leq$} && &&&& && \adjustbox{rotate=90}{$\leq$} \\
b & = & b_0
& \longrightarrow & b_1 & \longrightarrow & b_2
& \longrightarrow & \ldots & \longrightarrow & b_n
\end{array}
\]
\end{document}
Si por alguna razón desea tener esas matrices en tikz
la imagen, solo necesita insertarlas en el contenido de los nodos:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{adjustbox}
\begin{document}
\begin{tikzpicture}[node distance=2mm and 0mm,
every node/.style = {fill=cyan!15}
]
\setlength\arraycolsep{1pt}
\node (n1) {$\begin{array}{ccc ccc c}
\circ & \longrightarrow^* & \circ & & & & \\
\adjustbox{rotate=90}{$\leq$}
& & \adjustbox{rotate=90}{$\leq$} & & & & \\
\circ & \longrightarrow^* & \circ
& \longrightarrow^* & \circ & & \\
& & & & \adjustbox{rotate=90}{$\leq$} & & \\
& & & & \circ & \in & A
\end{array}$};
\node (n2) [below right=of n1.south west]
{$\begin{array}{rclcl clcl cl}
a & = & a_0
& \longrightarrow^* & a_1 & \longrightarrow^* & a_2
& \longrightarrow^* & \ldots & \longrightarrow^* & a_n \\
&& \adjustbox{rotate=90}{$\leq$} && &&&& && \adjustbox{rotate=90}{$\leq$} \\
b & = & b_0
& \longrightarrow & b_1 & \longrightarrow & b_2
& \longrightarrow & \ldots & \longrightarrow & b_n
\end{array}$};
\end{tikzpicture}
\end{document}
(para ver mejor los nodos, fill=cyan!15
se agrega al estilo de los nodos)
Respuesta2
Estos diagramas se pueden hacer muy cómodamente con tikz-cd
. La flecha con la estrella es deaquí. Los signos rotados \ge
se pueden obtener con \arrow[d,draw=none,"\ge" marking]
.
\documentclass{article}
\usepackage{tikz-cd}
\usepackage{mathtools}
\usetikzlibrary{arrows.meta}
\newcommand{\mysym}{\vphantom{\to}^{*}}
\begin{document}
\tikzset{% https://tex.stackexchange.com/a/492664
startip/.tip={Glyph[glyph math command=mysym]},
Rightarrow*/.style={double equal sign distance,>={Implies},->.startip},
to*/.style={->.startip}}
%Diagram 1
\begin{tikzcd}[cramped,row sep=0.8em,every label/.style={font=\normalsize}]
|[label={[xshift=4pt]left:(p, \bar{u})=}]| c_1
\arrow[d,draw=none,"\ge" marking] & \\
|[label={[xshift=4pt]left:(p, \bar{u}')=}]| c_1' \arrow[r]
& |[label={[xshift=-4pt]right:= (q, \bar{v}')}]| c_2'
\arrow[d,draw=none,"\ge" marking] \\
& |[label={[xshift=-4pt]right:= (q, \bar{v})}]| c_2 \\
\end{tikzcd}
\bigskip
%Diagram 2
\begin{tikzcd}[cramped,row sep=0.8em,every label/.style={font=\normalsize}]
(p,\bar v)\arrow[d,draw=none,"\ge" marking] & \\
(p,\bar v) \arrow[r]& (q,\bar w')\arrow[d,draw=none,"\ge" marking] \\
& (q,\bar w) \\
\end{tikzcd}
\bigskip
%Diagram 3
\begin{tikzcd}[cramped,row sep=0.8em,every label/.style={font=\normalsize}]
(p,u)\arrow[d,draw=none,"\ge" marking] & \\
|[label={[xshift=4pt]left:A\ni}]|(p,u')\arrow[d,draw=none,"\ge" marking] & \\
(p,u'')\arrow[d,draw=none,"\ge" marking] & \\
|[label={[xshift=4pt]left:B\ni}]|(p,u''')\arrow[r]&
(q,v)\in C\\
\end{tikzcd}
\bigskip
%Diagram 4
\begin{tikzcd}[cramped,row sep=0.8em,every label/.style={font=\normalsize}]
\circ\arrow[r,to*]\arrow[d,draw=none,"\ge" marking] &
\circ\arrow[d,draw=none,"\ge" marking] &\\
\circ \arrow[r] & \circ \arrow[r,to*] & \circ\arrow[d,draw=none,"\ge" marking]\\
& & \circ \mathrlap{\,\in A}\\
\end{tikzcd}
\bigskip
%Diagram 5
\begin{tikzcd}[cramped,row sep=0.8em,every label/.style={font=\normalsize}]
|[label={[xshift=4pt]left:a=}]|a_0 \arrow[d,draw=none,"\ge" marking]\arrow[r,to*] & a_1 \arrow[r,to*] & a_2 \arrow[r,to*]
&\dots \arrow[r,to*]& a_n\arrow[d,draw=none,"\ge" marking] \\
|[label={[xshift=4pt]left:b=}]|b_0 \arrow[r,to*] & b_1 \arrow[r,to*] & b_2 \arrow[r,to*]
&\dots \arrow[r,to*]& b_n \\
\end{tikzcd}
\end{document}