4

I have to insert greek letters in place of V_0 and C_t but nothing seems to work. Any hint?

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

The problem is (\testosopra) in the \draw macro. I think (not knowing tikz) that this is a node's internal label, and the conclusion is that internal labels can not be greek macros. Here, I substitute (\x) for (\testosopra), since internal labels like "0" and "7" are permitted.

Doing this, I have no problem then replacing V_0 with \alpha and C_t with \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}

enter image description here

  • @Elisa You are welcome. If it wholly addresses your issue in an optimal way, consider clicking the check mark to the left of my question. That way, others will know that this is the optimal answer and I will get "credit" for it. – Steven B. Segletes Mar 23 '16 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.