TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
see this: tex.stackexchange.com/questions/45006/… – alfC Aug 20 '12 at 22:59
up vote 16 down vote accepted

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

share|improve this answer
What do the ymin and ymax do? – soandos Aug 21 '12 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." – Jeff Langemeier Aug 21 '12 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 Aug 21 '12 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. – Jeff Langemeier Aug 21 '12 at 5:36
@JeffLangemeier don't sweat it – soandos Aug 21 '12 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







share|improve this answer

Your Answer


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.