텍스트 부분 연결하기

텍스트 부분 연결하기

저는 현재 Unix 파일 권한이나 파일의 출력과 같은 내용을 설명하기 위해 텍스트 부분을 연결하려고 합니다.

ls -al

하지만 어떻게 이런 것을 만들 수 있는지 전혀 모르겠습니다.

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

Ti를 사용 \path하거나 Ti를 사용하려고 생각하고 있었습니다.\node케이

그러나 나는 그것을 해결하지 못했습니다.

답변1

이런 뜻인가요?

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[blue]
\node (a) at (0,0) {-};
\node (b) at (1,0) {rwx};
\node (c) at (2,0) {rw-};
\node (d) at (3,0) {r-\--};
\draw (a.south west)--(a.south east);
\draw (b.south west)--(b.south east);
\draw (c.south west)--(c.south east);
\draw (d.south west)--(d.south east);
\draw (d.south)--($(d.south)+(0,-1)$)--($(d.south)+(1,-1)$) node[right,align=left,font=\scriptsize\sffamily] {Read, write and execute\\permissions for all other users};
\draw (c.south)--($(c.south)+(0,-2)$)--($(c.south)+(2,-2)$) node[right,align=left,font=\scriptsize\sffamily] {Read, write and execute permissions for\\members of the group owning the file};
\draw (b.south)--($(b.south)+(0,-3)$)--($(b.south)+(3,-3)$) node[right,align=left,font=\scriptsize\sffamily] {Read, write and execute permissions\\for the owner of the file};
\draw (a.south)--($(a.south)+(0,-4)$)--($(a.south)+(4,-4)$) node[right,align=left,font=\scriptsize\sffamily] {File type: ``---'' means a file.\\``d'' means a directory};
\end{tikzpicture}
\end{document}

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

답변2

나는 기본적으로 JouleV의 답변을 훔쳐서 상대 위치 지정을 사용하고 노드를 더 가깝게 묶도록 수정했습니다. 구체적으로, 인접한 두 노드의 텍스트 사이의 간격은 2배입니다 inner sep. 불행히도 텍스트 아래 줄에도 이 추가되었으므로 를 사용하여 구분을 inner sep줄이고 늘려야 했습니다 .inner xsep[right=4pt]

그런데 기본값은 inner sep0.333em입니다.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[blue]
\begin{scope}[every node/.style={inner xsep=0pt, inner ysep=2pt}]
  \node (a) {-};
  \node[right=4pt] (b) at (a.east) {rwx};
  \node[right=4pt] (c) at (b.east) {rw-};
  \node[right=4pt] (d) at (c.east) {r-\--};
\end{scope}
\begin{scope}[every node/.style={below right, align=left, font=\scriptsize\sffamily}]
  \node (e) at (d.south east) {Read, write and execute\\permissions for all other users};
  \node (f) at (e.south west) {Read, write and execute permissions for\\members of the group owning the file};
  \node (g) at (f.south west) {Read, write and execute permissions\\for the owner of the file};
  \node (h) at (g.south west) {File type: ``---'' means a file.\\``d'' means a directory};
\end{scope}
\draw (a.south west)--(a.south east)
  (b.south west)--(b.south east)
  (c.south west)--(c.south east)
  (d.south west)--(d.south east)
  (a.south) |- (h.west)
  (b.south) |- (g.west)
  (c.south) |- (f.west)
  (d.south) |- (e.west);
\end{tikzpicture}
\end{document}

데모

관련 정보