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.

wanna thing

I want to make the number line as above. How could I make this for TeX?

Thanks in advance.

share|improve this question
5  
Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. –  mvkorpel Jul 9 at 11:49
1  
TikZ / PGF is a package capable of producing such pictures. –  mvkorpel Jul 9 at 11:52

2 Answers 2

A much shorter solution

\documentclass[tikz]{standalone}

\begin{document}
  \begin{tikzpicture}[
      letter/.style={circle, minimum size=3pt, inner sep=0, outer sep=0, fill=black, label=below:#1},
      number/.style={fill=white, pos=.5}
  ]
      \draw (0,0) --
              node(A)[letter=A,pos=.2]{}
              node(C)[letter=C,pos=.6]{}
              node(B)[letter=B,pos=.8]{}
            (8,0)
      ;

      \draw[dashed]
          (A) to[bend left]      node[number]{2} (C)
          (C) to[bend right=50]     node[number]{1} (B)
          (A) to[bend left=50] node[number]{3} (B)
      ;
  \end{tikzpicture}
\end{document}

enter image description here

First you draw a line between two arbitrary points, here I choose (0,0) and (8,0) (horizontal line of length 8). While doing so you create the three nodes A B and C at some percentage of the length (20, 60 and 80 in our case). You name them (A) (B) and (C). Then to draw the dashed lines you connect them with a to path specifying that you want them dashed and bent. While you do that you also create a node midway with the number label.

share|improve this answer

number line with tikz

\documentclass{article}
\usepackage{pgf,tikz}
\pagestyle{empty}

\begin{document}
\begin{tikzpicture}[x=1.0cm,y=1.0cm]
\clip(-2.5,-1) rectangle (11.5,2.5);
\draw (-2,0)-- (3,0);
\draw (5,0)-- (10,0);
\draw [dash pattern=on 2pt off 2pt](-1,0)..controls (0.25,1) and (1,1) .. (2,0)  ;
\draw [dash pattern=on 2pt off 2pt](-1,0)..controls (-0.25,0.4) and (0.25,0.4) .. (1,0)    ;
\draw [dash pattern=on 2pt off 2pt](1,0)..controls (1.25,-0.35) and (1.75,-0.35) .. (2,0)  ;
\draw [dash pattern=on 2pt off 2pt](6,0)..controls (7,-1) and (8,-1) .. (9,0)  ;
\draw [dash pattern=on 2pt off 2pt](7,0)..controls (7.75,0.8) and (8.25,0.8) .. (9,0)    ;
\draw [dash pattern=on 2pt off 2pt](6,0)..controls (6.25,0.35) and (6.75,0.35) .. (7,0)  ;

\draw [fill=black] (-1,0) circle (1.5pt);
\draw[color=black] (-1,-0.3) node {$A$};
\draw [fill=black] (2,0) circle (1.5pt);
\draw[color=black] (2,-0.3) node {$C$};
\draw [fill=black] (1,0) circle (1.5pt);
\draw[color=black] (1,-0.3) node {$B$};
\draw [fill=black] (6,0) circle (1.5pt);
\draw[color=black] (6,-0.3) node {$C$};
\draw [fill=black] (7,0) circle (1.5pt);
\draw[color=black] (7,-0.3) node {$A$};
\draw [fill=black] (9,0) circle (1.5pt);
\draw[color=black] (9,-0.3) node {$B$};

\draw (0.6,0.75) node [fill=white]
{$3$};
\draw (0,0.32) node [fill=white]
{$2$};
\draw (1.5,-0.3) node [fill=white]
{$1$};
\draw (7.5,-0.75) node [fill=white]
{$5$};
\draw (8,0.6) node [fill=white]
{$3$};
\draw (6.5,0.25) node [fill=white]
{$2$};
\end{tikzpicture}

\end{document}

and the result enter image description here

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.