1

enter image description here

Hi I am beginner in Latex, my question is that, Is it possible to draw figures given in file by using latex?

  • 2
    Yes, it is possible. Have a look at TikZ and/or tikz-euclide. – Johannes_B Oct 12 '15 at 7:22
  • And also welcome to TeX.SE – Romain Picot Oct 12 '15 at 7:35
  • Another solution is to use pstricksand one of the packages of the family (pst-plot, pst-eucl,&c.) – Bernard Oct 12 '15 at 8:05
5

Your question is already answered in the comments ;-). Hence this is not exactly the answer for the questions but some typing practice. :-)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds,intersections}
\begin{document}
  \begin{tikzpicture}
    \draw[thick,latex-latex] (-2,0) -- (5,0)node[right]{$x$};
    \draw[thick,latex-latex] (0,-2) -- (0,5)node[above]{$y$};
    \node at (-0.2,-0.2) {O};
    \begin{scope}[on background layer]
    \fill[red!30,opacity=0.4] (-0.5,4.5) -| (4.5,-0.5) -- cycle;
    \end{scope}
    \node at (3,3.5) {$x + y - 4 \geq 0$};
    \foreach \x in {-1,1,2,3}{
     \node[fill,circle,inner sep=1.5pt,label=below:$\x$] at (\x,0) {};
     \node[fill,circle,inner sep=1.5pt,label=left:$\x$] at (0,\x) {};
     }
     \draw[thick,stealth-stealth, ] (-0.5,4.5) -- (4.5,-0.5) 
                                                        node[pos=0.5,below,sloped] {$x+y-4=0$};
     \foreach \x/\y in {1/3,3/1}{
      \node[fill,circle,inner sep=1.5pt,label={right:($\x, \y$)}] at (\x,\y) {};
      }
  \end{tikzpicture}

\begin{tikzpicture}
    \draw[thick,latex-latex] (-2,0) -- (6,0)node[right]{$x$};
    \draw[thick,latex-latex] (0,-2) -- (0,6)node[above]{$y$};
    \node at (-0.2,-0.2) {O};    
     \draw[thick,stealth-stealth, shorten >= -1cm, shorten <= -5mm,name path =a ] (0,5) -- (3,0)
                                                        node[pos=1.15,below] {$5x+3y-15=0$};
     \draw[thick,stealth-stealth, shorten >= -1cm, shorten <= -5mm,name path =b ] (0,4) -- (5,0)
                                                        node[pos=0.65,above,sloped] {$4x+5y-20=0$};
     \path [name intersections={of=a and b, by=c}];
     \foreach \x/\y/\pos in {0/5/right,5/0/{below left}}{
      \node[fill,circle,inner sep=1.5pt,label={[inner sep=0pt]\pos:($\x, \y$)}] at (\x,\y) {};
      }
      \foreach \x/\y/\name in {0/4/C,3/0/A}{
      \node[fill,circle,inner sep=1.5pt,label={[inner sep=0pt]below left:\name($\x, \y$)}] at (\x,\y) {};
      }
      \node[fill,circle,inner sep=1.5pt,label={right:$B\left(\frac{15}{13},\frac{40}{13}\right)$}] 
                  at (c) {};
      \begin{scope}[on background layer]
        \fill[blue!30!green,opacity=0.4] (c) -- (0,4) |- (3,0) -- cycle;
      \end{scope}
  \end{tikzpicture}

\end{document}

enter image description here

Next time please show some effort and post the code you have tried so that we need not start from scratch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.