Graphics, Figures & Tables ⇒ Number line
Number line
I am trying to create a number line such as those on page six of this paper I have looked at coordsys package but it's hard to control the interval and the length of the number line. Do you have any other suggestions?
Please help.
Thank You,
John
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
-
- Posts: 162
- Joined: Wed Jun 17, 2009 10:18 pm
Number line
Code: Select all
\begin{tikzpicture}[font=\Large]
\draw (0,0) -- (12.5,0);
\foreach \x in {0,3,6,9,12}
\draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,0pt);
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12}
\draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below]
{$\frac{\x}{3}$};
\draw (0,0) node[above]{$0$};
\draw (3,0) node[above]{$1$};
\draw (6,0) node[above]{$2$};
\draw (9,0) node[above]{$3$};
\draw (12,0) node[above]{$4$};
\end{tikzpicture}
- Attachments
-
- numbers.pdf
- (20.67 KiB) Downloaded 1604 times
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Number line
Code: Select all
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[thick]
\draw(0,0)--(12.5,0);
\foreach \x/\xtext in {0/0,3/1,6/2,9/3,12/4}
\draw(\x,0pt)--(\x,3pt) node[above] {\xtext};
\foreach \x in {0,1,...,12}
\draw(\x,0pt)--(\x,-3pt) node[below] {$\frac{\x}{3}$};
\end{tikzpicture}
\end{document}
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10