
나는 다음과 같은 노드 스타일을 정의합니다 Host
(독일어 레이블은 죄송합니다):
\tikzset{Host/.style={path picture={%
\coordinate (hinten links oben) at ($(path picture bounding box.north west)!0.33!(path picture bounding box.north east)$);
\coordinate (hp1) at ($(path picture bounding box.north west)!0.66!(path picture bounding box.north east)$);
\coordinate (vorne links oben) at ($(path picture bounding box.south west)!0.66!(path picture bounding box.north west)$);
\coordinate (vorne rechts unten) at ($(path picture bounding box.south west)!0.66!(path picture bounding box.south east)$);
\coordinate (vorne rechts oben) at ($(vorne rechts unten)!0.66!(hp1)$);
\coordinate (hinten rechts unten) at ($(path picture bounding box.south east)!0.33!(path picture bounding box.north east)$);
\path (vorne links oben) edge [-] (hinten links oben);
\path (hinten links oben) edge [-] (path picture bounding box.north east);
\path (path picture bounding box.north east) edge [-] (hinten rechts unten);
\path (hinten rechts unten) edge [-] (vorne rechts unten);
\path (vorne rechts unten) edge [-] (path picture bounding box.south west);
\path (path picture bounding box.south west) edge [-] (vorne links oben);
\path (vorne links oben) edge [-] (vorne rechts oben);
\path (vorne rechts oben) edge (path picture bounding box.north east) edge (vorne rechts unten);
}},minimum width=2em, minimum height=3em}
이 스타일을 사용하면 경계 상자의 테두리를 따라 있는 선이 시각적으로 더 가늘어 보입니다. 나는 이것이 정의된 끝점을 따라 선이 "성장"하여 경계 상자에 의해 잘리기 때문이라고 생각합니다.
정렬 여백을 삽입하는 쉬운 방법이 있습니까?
답변1
빠른 수정 방법으로 경로 그림 경계 상자 내에서 현재 선폭만큼 이동하면 잘림을 방지할 수 있습니다.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\tikzset{Host/.style={path picture={%
\coordinate (ppbbnw) at ([shift={(.5\pgflinewidth,-.5\pgflinewidth)}]path picture bounding box.north west);
\coordinate (ppbbne) at ([shift={(-.5\pgflinewidth,-.5\pgflinewidth)}]path picture bounding box.north east);
\coordinate (ppbbsw) at ([shift={(.5\pgflinewidth,.5\pgflinewidth)}]path picture bounding box.south west);
\coordinate (ppbbse) at ([shift={(-.5\pgflinewidth,.5\pgflinewidth)}]path picture bounding box.south east);
\coordinate (hlo) at ($(ppbbnw)!{1/3}!(ppbbne)$);
\coordinate (hp1) at ($(ppbbnw)!{2/3}!(ppbbne)$);
\coordinate (vlo) at ($(ppbbsw)!{2/3}!(ppbbnw)$);
\coordinate (vru) at ($(ppbbsw)!{2/3}!(ppbbse)$);
\coordinate (vro) at ($(vru)!{2/3}!(hp1)$);
\coordinate (hru) at ($(ppbbse)!{1/3}!(ppbbne)$);
\draw (ppbbne) -- (hru) -- (vru) -- (ppbbsw) -- (vlo) -- (hlo) -- cycle;
\draw (vlo) --(vro) -- (ppbbne) (vro) -- (vru);
}
},minimum width=2em, minimum height=3em}
\node[Host,thick] {};
\node[Host,ultra thin] at (1,0) {};
\node[Host] at (2,0) {};
\end{tikzpicture}
\end{document}