我有以下使用装饰命令制作的 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}
我想添加标签在在每行末尾以及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 错误,视觉辅助工具目前正在停止使用。对于由此造成的任何失望,我们深表歉意。]