
Tengo un nodo que dibujé en tikz, así:
\node[below, text width=5cm] (SomeName) at (0,0) {
\begin{itemize}
\item line 1
\item line 2
\item line 3
\item line 4
\item line 5
\end{itemize}
}
Me gustaría dibujar una flecha desde la línea 2 hacia el lado de otro nodo que he construido. También me gustaría poder colocar un corchete alrededor de las líneas 4 y 5 para luego dibujar una flecha diferente a otro nodo.
Los elementos no son estrictamente elementos de una sola línea, por lo que me gustaría poder colocar alguna referencia dentro del texto (si es posible) para poder construir mis líneas en lugar de colocar la línea en una fracción del camino hacia abajo en el cuadro construido por mi nodo.
Para obtener una espineta de código completa que proporcionará la imagen de lo que estoy buscando:
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usepgflibrary{arrows}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.text}
\usepackage{calc}
\usepackage{enumitem}
\begin{document}
\begin{tikzpicture}
\node[below, text width=5cm] (SomeName) at (0,0) {
\begin{itemize}
\item line 1
\item line 2
\item line 3
\item line 4
\item line 5
\end{itemize}
};
\node[below, text width=2cm] (Other) at (-5,0) {
Some text will go here.
};
\node[below, text width=2cm] (Another) at (-5,-4) {
Some text will go here.
};
\draw[decorate,decoration={brace,amplitude=7pt,mirror}](-2,-2) -- (-2,-3) node[midway,left] (A) {};% A node must have a (possibly empty) label text.
\draw[-stealth] (-2,-1.5) -- (Other.east);
\draw[-stealth] (A.west) -- (Another.east);
\end{tikzpicture}
\end{document}
Me gustaría que los corchetes y las flechas que provienen de la lista detallada sean referencias de nodos en lugar de solución de problemas para ubicarlos aproximadamente en la ubicación correcta.
Respuesta1
Esta solución utilizatikzmarke implica convertir el itemize
entorno en un enumerate
uso de la label
opción deenumitem. La lista tiene el mismo aspecto, pero el número de elemento se utiliza para convertir las viñetas en subnodos a los que se puede hacer referencia más adelante en la imagen.
\documentclass[tikz, border=10pt, multi]{standalone}
\usepackage{calc,enumitem}
\usetikzlibrary{arrows.meta,decorations.pathreplacing,decorations.text,tikzmark}
\begin{document}
\begin{tikzpicture}[remember picture]
\node[below, text width=5cm] (SomeName) at (0,0) {%
\begin{enumerate}[label={\subnode{it\arabic*}{\textbullet}}]
\item line 1
\item line 2
\item line 3
\item line 4
\item line 5
\end{enumerate}%
};
\node[below, text width=2cm] (Other) at (-5,0) {Some text will go here.};
\node[below, text width=2cm] (Another) at (-5,-4) {Some text will go here.};
\draw[decorate,decoration={brace,amplitude=7pt,mirror}] (it3.north west) -- (it4.south west) node[midway,left] (A) {};
\draw[-Stealth] (it2) -- (Other.east);
\draw[-Stealth] ([xshift=-2.5pt]A.west) -- (Another.east);
\end{tikzpicture}
\end{document}
Respuesta2
Utilicé remember picture
la opción para tikzpicture
s para permitir la conexión entre node
s definidas en diferentes tikzpicture
s (cf. $17.13.1 en elmanual). Solía minipage
disponer los tres bloques, pero son posibles otras soluciones. Para superar una dificultad en el espaciamiento alrededor del node
contenedor al que $bullet$
me referíesta respuesta.
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usepgflibrary{arrows}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.text}
\usepackage{calc}
\usepackage{enumitem}
\begin{document}
\begin{minipage}{3cm}
\begin{minipage}{3cm}
\tikz[remember picture]\node (n1) {Some text will go here};
\end{minipage}
\\[1cm]
\begin{minipage}{3cm}
\tikz[remember picture]\node (n2) {Some text will go here};
\end{minipage}
\end{minipage}
\hspace{10mm}
\begin{minipage}{.5\textwidth}
\begin{itemize}
\item line 1
\item[{\tikz[remember picture]\node[inner xsep=5pt,inner ysep=0] (t2) {$\bullet\hspace{-5pt}$};}] line 2
\item[{\tikz[remember picture]\node[inner sep=0] (t3) {$\bullet$};}] line 3
\item[{\tikz[remember picture]\node[inner sep=0] (t4) {$\bullet$};}] line 4
\item line 5
\end{itemize}
\end{minipage}
\begin{tikzpicture}[overlay,remember picture]
\path[->] (n1.east) edge [out=0 , in=180] (t2.west);
\draw[decorate,decoration={brace,raise=5pt},thick] (t4.south west) -- node[left,anchor=east,inner xsep=5pt] (t34) {} (t3.north west);
\path[->] (n2.east) edge [out=0 , in=180] (t34.west);
\end{tikzpicture}
\end{document}