![dibujar un soporte redondo/rectangular que abarque nodos en tikz](https://rvso.com/image/298819/dibujar%20un%20soporte%20redondo%2Frectangular%20que%20abarque%20nodos%20en%20tikz.png)
Sé cómo dibujar una llave con el siguiente código:
\draw[decorate,decoration={brace,amplitude=5},-] (0.8,-0.75) -- (0.8,0.75);
Pero ahora quiero dibujar un soporte redondo o rectangular. ¿Alguien puede decir cómo puedo hacer esto? ¿Es posible hacer esto cambiando "llave" por otros valores?
El resultado debería verse así: (algunas imágenes)
pero no {algunas fotos}
Respuesta1
A continuación defino los estilos.
square left brace
,square right brace
,round left paren
, yround right paren
que rinden:
Notas:
- Esto es simplemente una adaptación del
ncbar
estilo de¿Existe un TikZ equivalente al comando PSTricks \ncbar?.
Código:
\documentclass[landscape]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
%% https://tex.stackexchange.com/questions/55068/is-there-a-tikz-equivalent-to-the-pstricks-ncbar-command
\tikzset{
ncbar angle/.initial=90,
ncbar/.style={
to path=(\tikztostart)
-- ($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)
-- ($(\tikztotarget)!($(\tikztostart)!#1!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztotarget)$)!\pgfkeysvalueof{/tikz/ncbar angle}:(\tikztostart)$)
-- (\tikztotarget)
},
ncbar/.default=0.5cm,
}
\tikzset{square left brace/.style={ncbar=0.5cm}}
\tikzset{square right brace/.style={ncbar=-0.5cm}}
\tikzset{round left paren/.style={ncbar=0.5cm,out=120,in=-120}}
\tikzset{round right paren/.style={ncbar=0.5cm,out=60,in=-60}}
\begin{document}
\begin{tikzpicture}
\draw [red, thick] (0,0) to [square left brace ] (0,4);
\draw [red, thick] (1,0) to [square right brace] (1,4);
\draw [blue, thick] (3,0) to [round left paren ] (3,4);
\draw [blue, thick] (4,0) to [round right paren] (4,4);
\end{tikzpicture}
\end{document}
Respuesta2
Desafortunadamente , no existe un equivalente brace
para paréntesis y corchetes definido en la biblioteca TikZ decorations.pathreplacing
.
Depende de cuál sea su caso de uso si la siguiente recomendación es sensata o no, pero una forma posible de lograr algo como lo que desea es hacer uso de\vphantom
trucoy el hecho de que (
y [
sondelimitadores.
Aquí, pongo \left(
y \right)
en sus propios node
mensajes de correo electrónico que se colocan en relación con el principal node
usando la biblioteca TikZ positioning
.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{graphicx}
\usepackage{mwe}
\begin{document}
\begin{tikzpicture}
\node (picture) at (0,0) {\includegraphics[width=.5\textwidth]{image-a}};
\node (left-paren) [left = of picture] {$\left(\vphantom{\includegraphics[width=.25\textwidth]{image-a}}\right.$};
\node (right-paren) [right = of picture] {$\left.\vphantom{\includegraphics[width=.25\textwidth]{image-a}}\right)$};
\end{tikzpicture}
\end{document}