# How can I draw the integers with labels?

I want to draw a representation of the integers with numbers below the marks. So far my code is this:

\begin{tikzpicture}
\foreach \x in  {-5,-4,-3,-2,-1,0,1,2,3,4,5}
\draw[shift={(\x,0)},color=black] (\x,0) circle (1pt);
\foreach \x in {-5,-4,-3,-2,-1,0,1,2,3,4,5}
\draw[shift={(\x,0)},color=black, opacity=0] (0pt,0pt) -- (0pt,-3pt)
node[below]
{$\x$};
\end{tikzpicture}


What I get is a succession of points but not the numbers below; also the width of the picture is too long, I'd like to make it shorter and I don't know how to do it.

If possible, I'd like to repeat the drawing to compare the integers with the rationals, so I'd like a lot of evenly separated point, but more of them, with the same width and the same labels as before.

Also if possible: how can I put ellipsis (...) at each end of the drawing to give the idea of "and so on"? It's for a non-technical audience to illustrate the notion of infinity.

I don't know how to include the output so I apologize for that.

Thank you very much.

I am not sure if I understood correctly. Something like this? The code:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x=7mm]
\draw[<->] (-6,0) -- (6,0);
\foreach \x in {-5,...,5}
{
\draw[shift={(\x,0)}]
(0pt,3pt) -- (0pt,-3pt) node[below,font=\small] {$\x$};
}
\node[below] at (-5.8,-5pt) {$\cdots$};
\node[below] at (5.6,-5pt) {$\cdots$};
\end{tikzpicture}\par\bigskip

\begin{tikzpicture}[x=7mm]
\draw[<->] (-6,0) -- (6,0);
\foreach \x in {-5,...,5}
{
\node[circle,fill,inner sep=1.2pt,label=below:$\x$] at (\x,0) {};
}
\node[below] at (-5.8,-5pt) {$\cdots$};
\node[below] at (5.6,-5pt) {$\cdots$};
\end{tikzpicture}\par\bigskip

\begin{tikzpicture}[x=7mm]
\draw[<->] (-6,0) -- (6,0);
\foreach \x in {-5,-4.75,...,5}
{
\node[circle,fill,inner sep=1.2pt] at (\x,0) {};
}
\node[below] at (-5.8,-5pt) {$\cdots$};
\node[below] at (5.6,-5pt) {$\cdots$};
\end{tikzpicture}

\end{document}


You were not getting anything with the second loop since you had opacity=0.

• This is quite succint and elegant, muchas gracias Gonzalo. – Óscar Guajardo Jul 2 '15 at 6:36
• @ÓscarGuajardo De nada. – Gonzalo Medina Jul 2 '15 at 15:41