Senin, 28 Oktober 2024

Number Line In Latex 3

  1. type this following latex code in Latex editor for drawing a number line:
    %!TEX TS-program=pdflatex
    %!TEX encoding=UTF-8 Unicode
    %Plotting inequalities on a number line
    %* Using Relative Coordinates
    \documentclass[12pt]{article}
    \usepackage[left=0.1cm,right=0.1cm,top=0.5cm,bottom=0.5cm]{geometry}
    \usepackage{tikz}
    \usetikzlibrary{arrows}
    \begin{document}
    \begin{tikzpicture}
    %draw axes line
    \draw[latex-,thick] (-1,0) -- (9,0) ;
    \draw[-latex,thick] (-1,0) -- (9,0) ;

    %edit here for vertical lines
    \foreach \x in {0,1,2,3,4,5,6,7,8} \draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt);

    %edit here for number labels
    \foreach \x in {0,1,2,3,4,5,6,7,8} \draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] {$\mathbf{\x}$};

    %draw a node in number
    \draw[o-*] (2.9223,0) -- (5.075,0);
    %edit to sharpen the intersection line of axes
    \draw[ultra thick] (2.98,0) -- (5.02,0);

    %draw x <= 5 line
    \draw [red, thick, -stealth] (5,0) -- ++(0,0.6) -- ++(-5,0);
    %draw x >= 3 line
    \draw [blue, thick, -stealth] (3,0) -- ++(0,0.4) -- ++( 4,0);

    \end{tikzpicture}
    \end{document}

  2. Save file as plotInequal1a.tex.
  3. Typeset or Build.

Output

Number Line In Latex 3


Tidak ada komentar:

Posting Komentar

Various Other Posts