为什么所有标签都绘制在原点而不是指定的位置?
\documentclass[tikz,border=0.25mm]{standalone}
\usepackage{amsfonts}
\begin{document}
\begin{tikzpicture}[line join=round,scale=3.5]
\draw[->, thin] (-0.1,0) -- (1.1,0) node[anchor=west, inner sep=2pt] {$x$};
\foreach \i in {1/9,2/8,1/3,2/3,7/9,8/9} {
\draw (\i,-.01)--(\i,.01);
\node[below] (\i,0) {$\small{\i}$};
}
\end{tikzpicture}
\end{document}
答案1
后续行动我自己的评论:
- 关键是缺少
at
了\node[...] <missing at> (\i,0) {...};
。 - 我还发现选项
anchor=west, rotate=-75, font=\tiny
可以提供更好的输出。
\documentclass[tikz,border=0.25mm]{standalone}
\usepackage{amsfonts}
\begin{document}
\begin{tikzpicture}[line join=round,scale=3.5]
\draw[->, thin]
(-0.1,0) -- (1.1,0) node[anchor=west, inner sep=2pt] {$x$};
\foreach \i in {1/9,2/8,1/3,2/3,7/9,8/9} {
\draw (\i,-.01)--(\i,.01);
\node[anchor=west, rotate=-75, font=\tiny] at (\i,0) {$\small{\i}$};
}
\end{tikzpicture}
\end{document}