Verdrahtung von Textteilen

Verdrahtung von Textteilen

Ich versuche gerade, Textteile zu verdrahten, um Dinge wie Unix-Dateiberechtigungen oder die Ausgabe eines

ls -al

Aber ich habe keine Ahnung, wie ich so etwas erstellen kann:

Bildbeschreibung hier eingeben

Ich dachte darüber nach, \pathoder \nodevon Ti zu verwendenkZ

Aber ich habe es nicht hinbekommen, dass es geklappt hat.

Antwort1

Du meinst so etwas?

\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}

Bildbeschreibung hier eingeben

Antwort2

Ich habe im Grunde genommen JouleVs Antwort geklaut und sie überarbeitet, um relative Positionierung zu verwenden und die Knoten dichter zusammenzupacken. Genauer gesagt beträgt der Abstand zwischen dem Text zweier benachbarter Knoten 2 mal inner sep. Leider wird auch zu den Zeilen unter dem Text hinzugefügt, sodass ich dort den Abstand mithilfe von verringern und vergrößern inner sepmusste .inner xsep[right=4pt]

Übrigens ist der Standardwert 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}

Demo

verwandte Informationen