Math & ScienceCreating a number line

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
omccny
Posts: 4
Joined: Wed Jun 17, 2009 8:04 pm

Creating a number line

Post by omccny »

Hi. I am pretty new to Latex, and have an assignment to typeset a calculus textbook. I am using TeXnicCenter. So how do I go about creating a number line (from -2 to 2 with 1/4 intervals)?

Thanks
Olga

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bozack
Posts: 117
Joined: Wed Feb 06, 2008 4:21 pm

Creating a number line

Post by Bozack »

You can use PSTricks, by using the code

Code: Select all

\psset{yunit=0.5cm,xunit=3cm}
\begin{pspicture}(-2,-1)(2,1)
	\psline[linewidth=2pt,linecolor=red](-2,0)(2,0)
	\multido{\n=-2.00+0.25}{17}{
		\psline[linewidth=1pt,linecolor=red](\n,0.5)(\n,-0.5)
		\rput{90}(\n,-1.5){\scriptsize \n}}
\end{pspicture}
and add

Code: Select all

\usepackage{pstricks}
\usepackage{multido}
to your preamble.

You can read about PSTricks at CTAN: http://tug.ctan.org/tex-archive/graphic ... t-user.pdf
And you can also read about the multido package at CTAN: http://mirrors.dotsrc.org/ctan/macros/g ... ultido.pdf
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
omccny
Posts: 4
Joined: Wed Jun 17, 2009 8:04 pm

Re: Creating a number line

Post by omccny »

thank you
Post Reply