LaTeX forum ⇒ Graphics, Figures & Tablesnumber 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

Postby Phooey » Sun Sep 29, 2019 4:34 pm

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
numberline.jpg (41.89 KiB) Viewed 90 times

User avatar
Ijon Tichy
Posts: 120
Joined: Mon Dec 24, 2018 10:12 am

Postby Ijon Tichy » Sun Sep 29, 2019 6:06 pm

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:
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{article}
  2.  
  3. \begin{document}
  4. \setlength{\unitlength}{2mm}
  5. \begin{picture}(60,10)(0,-10)
  6. \put(0,0){\line(1,0){60}}%
  7. \multiput(0,0)(1,0){61}{\line(0,-1){1}}%
  8. \multiput(0,0)(5,0){13}{\line(0,-1){2}}%
  9. \put(0,-2.5){\makebox(0,0)[ct]{0}}%
  10. \put(10,-2.5){\makebox(0,0)[ct]{10}}%
  11. \put(20,-2.5){\makebox(0,0)[ct]{20}}%
  12. \put(30,-2.5){\makebox(0,0)[ct]{30}}%
  13. \put(40,-2.5){\makebox(0,0)[ct]{40}}%
  14. \put(50,-2.5){\makebox(0,0)[ct]{50}}%
  15. \put(60,-2.5){\makebox(0,0)[ct]{60}}%
  16. \put(37,-10){\vector(0,1){8}}%
  17. \end{picture}
  18. \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

Postby Phooey » Sun Sep 29, 2019 6:21 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.

Edit: I will download the resource you suggested!


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests