
O MWE é o seguinte (estou usando o ConTeXt)
\usemodule[tikz]
\usetikzlibrary{positioning}
\usetikzlibrary{shapes}
\usetikzlibrary{calc}
\tikzset{arrow/.style={-stealth, thick, draw=black!70!white}}
\starttext
\starttikzpicture[ampersand replacement=\&]
% \draw[help lines](0,-5) grid (10,5);
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (3,0) (S) {SSS};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (3,3) (C) {CCC};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (6,1.5) (I) {III};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (10,1.5) (P) {PPP};
\path[arrow]
(S) edge (I.south west)
(C) edge (I.north west)
(I) edge (P)
(C) -- (10,3) -| (P.north)
(S) -- (10,0) -| (P.south)
;
\stoptikzpicture
\stoptext
Minha intenção é colocar a seta no final do caminho do CCC ao PPP (no norte do PPP), mas ela não aparece. Por favor ajude. Obrigado.
Responder1
As setas são colocadas apenas no primeiro e no último subcaminho de um caminho, consultehttps://tikz.dev/tikz-arrows#sec-16.2.
No seu exemplo (C) -- (10,3) -| (P.north)
e (S) -- (10,0) -| (P.south)
há dois subcaminhos (separados por operações de movimentação para caminho), portanto, a seta é adicionada apenas ao arquivo (S) -- (10,0) -| (P.south)
.
Em vez de dividi-lo em vários caminhos, você pode continuar usando edge
para adicionar várias setas a um único caminho, com algumas opções extras:
(node a) edge[to path={-| (\tikztotarget)}] (node b)
veja a resposta de @Scz paraBordas em ângulo reto Tikz entre nós | TeX-SX#48397.
Exemplo adaptado completo:
- As setas são coloridas da mesma cor das linhas, usando
-{Stealth[black!70]}
aarrows.meta
biblioteca carregada. - As novas chaves de estilo são nomeadas
to path hv
eto path vh
, porque o uso|
do nome da chave termina com erros.
ConTeXt define catcode de|
12 (outro) para 13 (ativo), que deduzo ser a causa. Nunca sendo um usuário regular do ConTeXt, apenas contornei isso. Veja tambémQuais símbolos precisam ser escapados no ConTeXt? | TeX-SX#48933.
Atualização: funciona mas a expressividade se perde:to path -\|/.style={...}
.
% !TeX TS-program = context %.tex
\usemodule[tikz]
\usetikzlibrary{arrows.meta, calc, positioning, shapes}
\tikzset{
arrow/.style={-{Stealth[black!70]}, thick, draw=black!70},
% based on https://tex.stackexchange.com/a/250515
to path hv/.style={to path={-| (\tikztotarget)}},
to path vh/.style={to path={|- (\tikztotarget)}}
}
\starttext
\starttikzpicture[ampersand replacement=\&]
% \draw[help lines](0,-5) grid (10,5);
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (3,0) (S) {SSS};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (3,3) (C) {CCC};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (6,1.5) (I) {III};
\node[rectangle, rounded corners, draw, fill=white!90!black, minimum height=1cm] at (10,1.5) (P) {PPP};
\path[arrow]
(S) edge (I.south west)
(C) edge (I.north west)
(I) edge (P)
(C) edge[to path hv] (P.north)
(S) edge[to path hv] (P.south)
;
\stoptikzpicture
\stoptext