0

Hi everyone I am trying to draw in latex but it is hard. I want to make a grid and a rectangle shape inside the grid with few labels. I would really appreciate some help!! enter image description here

  • Welcome! What have you got so far? Questions should generally include the code you've got so that we can better understand what you're having trouble with. Do-it-for-me questions sometimes get answered, sometimes not. But answers may not be very useful to you, and people are less inclined to answer depending on whether your question is a sufficiently intriguing/challenging/appealing/attractive/etc. one. – cfr Mar 28 '16 at 0:48
  • I am sorry, I totally would but I do not know how to even make the grid of dots. The hardest picture I have made so far was a complete graph of 6 vertices, but this much harder for me. I apologize I am not sure where to start. – Gidy Mar 28 '16 at 0:59
  • You can always post the 6 - then people know you have the basics and, also, they don't have to construct a new document from scratch. Also, knowing how you do the 6 makes it possible to build on that approach e.g. using the same package for drawing or whatever, which is usually easier and more helpful. – cfr Mar 28 '16 at 1:05
0

For example, the points of the grid can be set as empty circle nodes. Then the connecting lines will connect to the circle leaving the inner of the circle intact. The grid can be drawn via nested \foreach loop for the two dimensions:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \foreach \x in {0, ..., 5} {
    \foreach \y in {0, ..., 3} {
      \node[
        circle,
        minimum size=3pt,
        draw,
        inner sep=0pt,
      ] (n\x_\y) at (\x, \y) {};
    }
  }
  \draw
    (n0_0) -- (n1_0) -- (n2_0) -- (n3_0) -- (n4_0) -- (n5_0)
    (n0_0) -- (n3_1)
    (n1_0) -- (n3_1)
    (n2_0) -- (n3_1)
    (n3_0) -- (n3_1)
    (n4_0) -- (n3_1)
    (n4_0) -- (n4_1)
    (n5_0) -- (n4_1)
    (n5_0) -- (n5_1)
    (n3_1) -- (n4_1) -- (n5_1)
  ;
  \node[below] at (n0_0) {$(0, 0)$};
  \node[above] at (n3_1) {$(a, 1)$};
  \node[above right] at (n5_1) {$(a + b, 1)$};
  \node[left=1ex] at (n0_3) {$v$};
  \node[below=1ex] at (n5_0) {$t$};
\end{tikzpicture}
\end{document}

Result

0

Her is a short code with pstricks. You can compile with pdflatex if the switch --enable-write18 (MiKTeX) or -shell-escape (TeX Live, MacTeX) is set:

\documentclass[a4paper,11pt,x11names]{article}
\usepackage{pst-node, multido}
\usepackage{auto-pst-pdf}

\begin{document}%

\psset{xunit =1.5, nodesep=2pt, linecolor=IndianRed3}
\footnotesize
\begin{pspicture}
    \multido{\Ix=0 + 1}{6}{\multido{\Iy=0 + 1}{4}{\dotnode(\Ix, \Iy){A\Ix\Iy}}}
    \multido{\Ix=0 + 1}{5}{\ncline{A\Ix0}{A31}}
    \multido{\I=0 + 1, \In=1 + 1}{5} {\ncline{A\I0}{A\In0}}
    \ncline{A31}{A40}
    \ncline{A41}{A31}\ncline{A41}{A51}\ncline{A41}{A40}\ncline{A41}{A50}\ncline{A50}{A51}
    \uput[dl](A00){$ (0,0) $}\uput[dr](A50){$ t $}\uput[l](A03){$ V $}
    \uput[ur](A31){$ (a, 1) $}\uput[ur](A51){$ (a + b, 1) $}
\end{pspicture}

\end{document}

enter image description here

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.