I am transferring a professor's .doc files to LaTeX so that we can do more sophisticated formatting and I ran across a problem.

I would like to recreate this number line in LaTeX.

number line

Help with which package to use and which commands to study would be a great help.


2 Answers 2


You can use TikZ; the manual is great and contains numerous examples; in the following example, the basic constructs are \node and \draw:



% a straight line segment
\draw (0.5,0) -- (10.5,0);
% the ticks and their labels
\foreach \x  in {1,...,10}
  \draw[xshift=\x cm] (0pt,2pt) -- (0pt,-1pt) node[below,fill=white] {\the\numexpr\x +112\relax};
% the thicker segment
\draw[ultra thick] (2.06,0) -- (8.94,0);
% the labels
\node[fill=white,draw=black,circle,inner sep=2pt,label=above:{$L_1=114.06$}] at (2.12,0) {};
\node[fill=white,draw=black,circle,inner sep=2pt,label=above:{$L_1=119.94$}] at (8.9,0) {};
\node at (5.5,-0.8) {$\mu$};


enter image description here

And here's a variation using pgfplots (which internally uses TikZ and is very useful for plots):



  axis y line=none,
  axis lines=left,
  axis line style={-},
  restrict y to domain=0:1,
\addplot table [y expr=0,meta index=1, header=false] {
114.06 o
119.94 o
\node[coordinate,label=above:{$L_1=114.06$}] at (axis cs:114.06,0.05) {};
\node[coordinate,label=above:{$L_2=119.94$}] at (axis cs:119.94,0.05) {};


enter image description here

  • What do the ymin and ymax do?
    – soandos
    Commented Aug 21, 2012 at 4:06
  • @soandos >.>, the produced graph has a lower bound of 112.5 and an upper bound of 121.5, let's play "pin the tail on the observable." Commented Aug 21, 2012 at 4:30
  • @JeffLangemeier As far as I can tell it slightly changes the height of L1 and L2 (tried 10,100,1000 for ymax)
    – soandos
    Commented Aug 21, 2012 at 5:12
  • @soandos, And now I get red on my face, yes, the y bound handles the vertical, but since a line graph has no vertical it doesn't really do squat. Tired-dyslexia causes y and x confusion tonight, stellar. Commented Aug 21, 2012 at 5:36
  • @JeffLangemeier don't sweat it
    – soandos
    Commented Aug 21, 2012 at 5:38

You don't really need any extra packages for that kind of diagram, LaTeX can do that unaided:

enter image description here








You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .