
MWE는 다음과 같습니다(저는 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
내 의도는 CCC에서 PPP로 가는 경로의 끝(PPP 북쪽)에 화살표를 가져오는 것이지만 표시되지 않습니다. 도와주세요. 감사해요.
답변1
화살표는 경로의 첫 번째 및 마지막 하위 경로에만 배치됩니다.https://tikz.dev/tikz-arrows#sec-16.2.
귀하의 예에서는 (C) -- (10,3) -| (P.north)
과 (S) -- (10,0) -| (P.south)
두 개의 하위 경로(경로 이동 작업으로 구분됨)가 있으므로 화살표는 (S) -- (10,0) -| (P.south)
.
여러 경로로 분할하는 대신 edge
몇 가지 추가 옵션을 사용하여 단일 경로에 여러 화살표를 계속 추가할 수 있습니다.
(node a) edge[to path={-| (\tikztotarget)}] (node b)
@Scz의 답변을 참조하세요.노드 사이의 Tikz 직각 가장자리 | TeX-SX#48397.
완전한 적응 예:
- 라이브러리가 로드된
-{Stealth[black!70]}
상태 에서 화살표는 선과 동일한 색상으로 표시됩니다 .arrows.meta
- 을(를 ) 사용하면 키 이름이 오류로 끝나므로 새 스타일 키의 이름은
to path hv
and 로 지정됩니다. ConTeXt는 다음의 catcode를 설정합니다.to path vh
|
|
, 이것이 원인이라고 추론합니다. 저는 일반 ConTeXt 사용자가 아니어서 그냥 문제를 해결했습니다. 또한 참조하십시오ConTeXt에서 어떤 기호를 이스케이프해야 합니까? | TeX-SX#48933.
업데이트: 작동하지만 표현력이 손실됩니다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