블록 중심이 아닌 여러 개의 화살표가 있는 TikZ 블록 다이어그램

블록 중심이 아닌 여러 개의 화살표가 있는 TikZ 블록 다이어그램

다소 간단한 다이어그램을 만들려고 하는데 노드 중앙을 벗어나지 않고 왼쪽에 있는 여러 화살표를 얻는 방법을 모르겠습니다.

내가 만들고 싶은 블록다이어그램

답변1

두 가지 옵션; 앵커와 일부 교대를 사용하고 <name>.<angle >구문을 사용합니다.

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\node[draw,minimum size=2cm] (x) {X};
\draw[->] ([yshift=-10pt]x.west) -- node[fill=white] {a} +(-1cm,0pt);
\draw[->] ([yshift=10pt]x.west) -- node[fill=white] {b} +(-1cm,0pt);
\draw[->] (x.120) -- node[fill=white] {c} +(0pt,1cm);
\draw[->] (x.60) -- node[fill=white] {d} +(0pt,1cm);
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

처럼클라우디오 피안드리노에서 언급했다그의 코멘트, 또 다른 옵션은 라이브러리를 사용하는 것이므로 calc이동이 절대적이지는 않지만 앵커 측면에서 계산할 수 있습니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node[draw,minimum size=2cm] (x) {X};
\draw[->] ([yshift=-10pt]x.west) -- node[fill=white] {a} +(-1cm,0pt);
\draw[->] ([yshift=10pt]x.west) -- node[fill=white] {b} +(-1cm,0pt);
\draw[->] (x.120) -- node[fill=white] {c} +(0pt,1cm);
\draw[->] (x.60) -- node[fill=white] {d} +(0pt,1cm);
\draw[->]
  ( $ (x.north east)!0.5!(x.east) $ ) -- 
    node[fill=white] {e} 
  +(1cm,0pt);
\draw[->] 
  ( $ (x.east)!0.5!(x.south east) $ ) -- 
    node[fill=white] {f} 
    +(1cm,0pt);
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

위의 예에서는 좌표가 와 ( $ (x.north east)!0.5!(x.east) $ )사이의 중간에 있는 지점을 의미합니다 .x.north eastx.east

답변2

PSTricks 솔루션:

\documentclass{article}

\usepackage{pstricks-add}
\usepackage{xfp}

\newcommand*\Width{\fpeval{2*\arrowLength+\boxLength}}
\newcommand*\Height{\boxLength}

\def\arrowLength{3}
\def\boxLength{3}


\begin{document}

\begin{pspicture}(\Width,\Height)
 \psset{arrows = ->}
  \psframe(\arrowLength,0)(\fpeval{\arrowLength+\boxLength},\boxLength)
  \rput(\fpeval{\arrowLength+0.5*\boxLength},\fpeval{0.5*\boxLength}){X}
  \pcline(\arrowLength,\fpeval{\boxLength/3})(0,\fpeval{\boxLength/3})
  \ncput*{a}
  \pcline(\arrowLength,\fpeval{2/3*\boxLength})(0,\fpeval{2/3*\boxLength})
  \ncput*{b}
  \pcline(\fpeval{2*\arrowLength+\boxLength},\fpeval{0.5*\boxLength})%
         (\fpeval{\arrowLength+\boxLength},\fpeval{0.5*\boxLength})
  \ncput*{c}
\end{pspicture}

\end{document}

산출

\arrowLength도면은 '자동화'되어 있으므로 사용자가 해야 할 일은 및 값을 선택하는 것뿐입니다 \boxLength.

관련 정보