## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ number line help Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Phooey
Posts: 5
Joined: Sun Sep 29, 2019 4:18 pm

### number line help

Hi Guys,

I am brand new to this forum and LaTeX in general. But I have now been tasked with writing the assessment materials for my employer so decided LaTeX was the way to go.

So I need to create this diagram. Please, I have spent all weekend trying to make sense of the google results I get. Can someone please suggest a simple piece of code with some brief explanation as to what is happening.

It is just the number line with the arrow. I am ok with the text and formatting.
Attachments
numberline.jpg (41.89 KiB) Viewed 91 times

Ijon Tichy
Posts: 120
Joined: Mon Dec 24, 2018 10:12 am
Please can you show us, what you already have tried. The figure is so simple, that you even could make it with the standard picture environment:
\documentclass{article} \begin{document}\setlength{\unitlength}{2mm}\begin{picture}(60,10)(0,-10)  \put(0,0){\line(1,0){60}}%  \multiput(0,0)(1,0){61}{\line(0,-1){1}}%  \multiput(0,0)(5,0){13}{\line(0,-1){2}}%  \put(0,-2.5){\makebox(0,0)[ct]{0}}%  \put(10,-2.5){\makebox(0,0)[ct]{10}}%  \put(20,-2.5){\makebox(0,0)[ct]{20}}%  \put(30,-2.5){\makebox(0,0)[ct]{30}}%  \put(40,-2.5){\makebox(0,0)[ct]{40}}%  \put(50,-2.5){\makebox(0,0)[ct]{50}}%  \put(60,-2.5){\makebox(0,0)[ct]{60}}%  \put(37,-10){\vector(0,1){8}}%\end{picture}\end{document}

The picture environment that should be explained in every complete LaTeX introduction, so please read one. You won't become happy with latex only using google search instead of reading a good introduction.

However, I would recommend to use pgf/TikZ instead of picture even for simple figures. Because it would be a good choice to learn TikZ step by step.

Phooey
Posts: 5
Joined: Sun Sep 29, 2019 4:18 pm
That is absolutely perfect. Thank you so much.

I haven't saved anything that I have tried but essentially, I have tried drawing vertical and then horizontal lines and adding numbers - a complete mess!

I tried nodes but only managed to get a line with numbers and couldn't work out how to get the gradations.

I will look for a decent tikz tutorial book. I've managed to get some basics from YouTube vids but only managed to put together a simple document, a document that looks nice but very little in the way of graphics.

Oddly, I could managed to put together a calculus paper - my next job - but making 'pictures' isn't so easy.

Thank you again. I really appreciate you taking the time.