我必须插入希腊字母来代替 V_0 和 C_t,但似乎没有任何效果。有什么提示吗?
\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
% tikzstyle è deprecato:
% http://tex.stackexchange.com/q/52372/13304
\tikzset{bag/.style={text width=2em, text centered}}% align=center
\begin{document}
\begin{tikzpicture}
\draw[|-stealth] (0,0) -- (8,0) node[right]{$t$};
\foreach \x/\testosopra/\testosotto in {0/V_0/{0},7/C_t/t}{
\draw(\x,0.1)--(\x,-0.1);
\node[above,font=\scriptsize]at (\x,0.1) (\testosopra) {$\testosopra$};
\node[below,font=\scriptsize]at (\x,-0.1) {$\testosotto$};
}
\end{tikzpicture}
\end{document}
答案1
问题出(\testosopra)
在\draw
宏中。我认为(不知道tikz
)这是一个节点的内部标签,结论是内部标签不能是希腊宏。在这里,我替换了(\x)
,(\testosopra)
因为允许使用“0”和“7”等内部标签。
V_0
这样做之后,我用\alpha
和C_t
替换就没有问题了\beta
。
\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
% tikzstyle è deprecato:
% http://tex.stackexchange.com/q/52372/13304
\tikzset{bag/.style={text width=2em, text centered}}% align=center
\begin{document}
\begin{tikzpicture}
\draw[|-stealth] (0,0) -- (8,0) node[right]{$t$};
\foreach \x/\testosopra/\testosotto in {0/\alpha/{0},7/\beta/t}{
\draw(\x,0.1)--(\x,-0.1);
\node[above,font=\scriptsize]at (\x,0.1) (\x) {$\testosopra$};
\node[below,font=\scriptsize]at (\x,-0.1) {$\testosotto$};
}
\end{tikzpicture}
\end{document}