I am trying to make several nodes in my project like this:

 \Tree [.S This [.VP ] ]

I have searched with no results. I want something like this

  • What you have (blurrily) shown is not a tree, and I don't think that tree drawing packages will help you here. The TikZ graphs library might be much more appropriate. What exactly is the image you've tried to show us? What is it for or what does it represent? Can you find a better image? – Alan Munn May 19 '15 at 1:10
  • Sorry about that, i am finding the number between each prime number and i wanted to draw them in tex one by one... like say it took 1+2 = 3 3+2 = 5 the next prime number 5+2 = 7 the next like that to 100, i just need a sample of two horizontal nodes and i will be okay to do it on my own. Thank you. – Leouret May 19 '15 at 2:27
  • I've returned the question to its earlier form with your picture, otherwise your question has basically no content whatsoever. If you want to edit your question with a better picture, or with a more detailed description of what you wanted, that would be fine, but please don't delete it. – Alan Munn May 19 '15 at 16:35

Here's one way to do what you want. I've adapted the code from this answer: Produce a list of prime numbers to draw the differences between each pair of primes in the way your drawing showed.

The command will draw the differences between the primes putting 13 primes per row by default. This can be changed, as can the vertical space each row takes up.

If the first prime is not 2, then you will need to supply the value of its previous prime to draw the first node. This prime is given by the optional argument of the macro.


% command to draw the primes between two numbers and their differences
% the optional argument specifies the number of the first previous prime
% the default is 2, in which case nothing is shown; otherwise a node with
% that prime is drawn
    \setlength{\yoffset}{.75in} % vertical offset per row
    \def\displaynum{13} % number of primes per row
        \node at (-1,0) (\prevprime) {};
        \node (\prevprime) {\prevprime};
    \foreach\numb in {#2,...,#3}{%
                \node at (0,-\value{rownum}*\yoffset) (\prevprime) {\prevprime};
            \node[right of=\prevprime,inner sep=2pt] (\numb) {\numb};
                \coordinate (C) at ($(\prevprime)!0.5!(\numb)$);
                \node[ below of= C,inner sep=2pt ] (\diff) {\diff};
                \draw (\prevprime) -- (\diff) -- (\numb);



output of code

| improve this answer | |

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.