Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As much as I love TikZ, its trouble producing consistent output on different computers is getting to me. At the moment, I'm having trouble because when I use the to command, and nodes inside the draw command, the fonts sizes are all wrong, and the nodes often misplaces labels. This seems to be a quirk of my current computer, and some code I wrote on another computer now doesn't compile right (incidentally, I just checked; this compiles fine on my old laptop). For example, the code

\[
\epsilon=\tikz[baseline,very thick,scale=2.5]{ 
\draw[<-] (.2,.1) to[out=-120,in=-60] (-.2,.1)  
node[at end,above left,scale=.8]{$i$}
node[at start,above right,scale=.8]{$i$};
\node[scale=.8] at (0,.3){$\lambda$}; 
\node[scale=.8] at (0,-.2){$\lambda+\alpha_i$};}\qquad \qquad
\epsilon'=\tikz[baseline,very thick,scale=2.5]{
\draw[->] (.2,.1)to[out=-120,in=-60] (-.2,.1) 
node[at end,above left,scale=.8]{$i$} 
node[at start,above right,scale=.8]{$i$};
\node[scale=.8] at(0,.3){$\lambda$}; 
\node[scale=.8] at (0,-.2){$\lambda-\alpha_i$};}
\]

produces

enter image description here

What's with the crazy big i's? Is there something I can do to fix this?

As reference, if I make the nodes free-standing and change the code to

\[
\epsilon=\tikz[baseline,very thick,scale=2.5]{\draw[<-] (.2,.1)
  to[out=-120,in=-60] (-.2,.1);  \node at (.2,.2) [scale=.8]{$i$};
  \node at (-.2,.2)[scale=.8]{$i$};\node[scale=.8] at
  (0,.3){$\lambda$}; \node[scale=.8] at (0,-.2){$\lambda+\alpha_i$};}\qquad \qquad
\epsilon'=\tikz[baseline,very thick,scale=2.5]{\draw[->] (.2,.1)
  to[out=-120,in=-60] (-.2,.1); \node at (.2,.2) [scale=.8]{$i$};
  \node at (-.2,.2)[scale=.8]{$i$};\node[scale=.8] at
  (0,.3){$\lambda$}; \node[scale=.8] at (0,-.2){$\lambda-\alpha_i$};}
\]

I get basically what I intended.

enter image description here

share|improve this question
2  
Ben, you can format blocks of code by selecting it and clicking on the {} icon. This indents every line by 4 spaces, and is preferable to using backticks (which are mainly for inline code). I've fixed this for you. It would also be helpful to turn at least one of your code fragments into a complete compilable example for people to play with. Especially since you seem to have some personal macros in it. –  Alan Munn Apr 3 '12 at 3:02
    
I think I expanded the macros. I fear that other people compiling on their machines is unlikely to help much; the first code looks fine on some (most?) machines. –  Ben Webster Apr 3 '12 at 3:24
    
This seems to be caused be how the scale attribute is applied. –  Caramdir Apr 3 '12 at 3:29
    
I tried reading the relevant bits of the TikZ code, but there is nothing obvious I see why the scale is ignored after a to. Maybe you should report this behavior as a bug. –  Caramdir Apr 3 '12 at 3:59
    
I think node must be placed before the last point. –  Alain Matthes Apr 3 '12 at 6:54

1 Answer 1

I think that the good syntax is \draw (a) to node {} (b); like in the example of the pgfmanual :

\begin{tikzpicture}
  \draw (0,0) .. controls (6,1) and (9,1) ..
    node[near start,sloped,above] {near start}
    node {midway}
    node[very near end,sloped,below] {very near end} (12,0);
\end{tikzpicture}

In your case :

\documentclass{article}
\usepackage{tikz}

\begin{document} 

 $\epsilon$=
\tikz [baseline,
       very thick,
       scale=2.5]{%                   
\draw[<-] (.2,.1) to [out=-120,in=-60]  
      node [at end,above left]     {$i$}
      node [at start,above right]  {$i$}
      (-.2,.1)   ;
\node at (0,.3){$\lambda$}; 
\node at (0,-.2){$\lambda+\alpha_i$};  
} 
\end{document} 

enter image description here

Remark : I don't understand scale=.8 inside the options of node ! perhaps you want to reduce the size of the text ? but it's this case, I think you reduce the size of the node too. I think it's preferable to avoid this and to use something like font=\scriptsize.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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