我有以下使用裝飾命令製作的 TikZ 圖片
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{decorations.fractals}
\begin{document}
\begin{tikzpicture}[decoration=Cantor set,line width=2mm]
\draw (0,0) -- (12,0);
\draw decorate{ (0,-.5) -- (12,-.5) };
\draw decorate{ decorate{ (0,-1) -- (12,-1) }};
\draw decorate{ decorate{ decorate{ (0,-1.5) -- (12,-1.5) }}};
\draw decorate{ decorate{ decorate{ decorate{ (0,-2) -- (12,-2) }}}};
\draw decorate{ decorate{ decorate{ decorate{ decorate{ (0,-2.5) -- (12,-2.5) }}}}};
\draw decorate{ decorate{ decorate{ decorate{ decorate{ decorate{ (0,-3) -- (12,-3) }}}}}};
\end{tikzpicture}
\end{document}
我想添加標籤在既在每行的末尾,也I_{n,j}位於特定子區間的旁邊或下方。
編輯:在下面添加節點時,如何增加線之間的距離以適應它們?
答案1
這說明如何將包含標籤的節點 (1) 放在線的末尾,(2) 放在線段旁邊(子間隔?),以及 (3) 放在線段下方。
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{decorations.fractals}
\begin{document}
\begin{tikzpicture}[decoration=Cantor set,line width=2mm]
\draw (0,0) -- (12,0) node [right] {$I_n$};
\draw decorate{ (0,-.5) -- (12,-.5)node [pos=.35,right] {$I_{n,j}$} }node [right] {$I_n$};
\draw decorate{ decorate{ (0,-1) -- (12,-1) }};
\draw decorate{ decorate{ decorate{ (0,-1.5) -- (12,-1.5) }}};
\draw decorate{ decorate{ decorate{ decorate{ (0,-2) -- (12,-2) }}}};
\draw decorate{ decorate{ decorate{ decorate{ decorate{ (0,-2.5) -- (12,-2.5) }}}}};
\draw decorate{ decorate{ decorate{ decorate{ decorate{ decorate{ (0,-3) -- (12,-3) node [pos=0.1,below] {$I_{n,j}$} }}}}}};
\end{tikzpicture}
\end{document}
[由於 X 上的 Okular 錯誤,視覺輔助工具目前正在罷工。