0

I am currently preparing for a report on an assignment, it is my first time using LaTex, although I do have the basics of typesetting down I still have a hard time making the diagrams I want. Help would be much appreciated.

  • 2
    Welcome to TeX.SE! Can you please show us what you have tried so far? – Mensch Jan 07 '19 at 00:37
  • 1
    Welcome to TeX SX! The two main tools for drawings are TiKZ and pstricks. – Bernard Jan 07 '19 at 00:39
  • @Bernard I am a complete beginner. I apologize, I have nothing to show but help would be greatly appreciated – Roland Gobler Jan 07 '19 at 00:42
  • @RolandGobler, at least improve your sketch. ... now is not very clear :-( – Zarko Jan 07 '19 at 00:47
  • @Zarko Three squares lined upwards diagonally and three arrows, two dashed at the side going through as seen above. A loss and gain with arrows in respective directions on the first squares as seen above. And Pi, Pj and Pk where i, j, k are subscripted. I hope these points are enough, this is the best skecth I've managed to draw. I apologize for any inconveniences but I would really appreciate any help. Thanks – Roland Gobler Jan 07 '19 at 00:53
  • Consider accepting one of the provided answers. – Dr. Manuel Kuehner Jan 09 '19 at 12:36

3 Answers3

6

as starting point:

enter image description here

above image you can use for improve your sketch in question. by hand add missing elements which you like to have on image. the code for image is not very elementary.Used is tikz package for drawing:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                positioning}

\begin{document}
    \begin{tikzpicture}[
node distance = 0mm and 0mm,
box/.style = {draw, minimum size=22mm, outer sep=0mm,
              node contents={}  },
arr/.style = {draw=#1, semithick, -Straight Barb, shorten >=-7mm}
                        ]
\node (n1)  [box];
\node (n2)  [box, above right=of n1];
\node (n3)  [box, above right=of n2];
\path[arr=red]
    (n1.south west) -- (n3.north east);
\path[arr=blue, dashed]
    (n1.south) -- (n3.north west);
\path[arr=blue, dashed]
    (n1.west) -- (n3.south east);
    \end{tikzpicture}
\end{document}
Zarko
  • 296,517
  • Thank you so much for you help, how would I center this with the text, the normal command does not seem to work? – Roland Gobler Jan 07 '19 at 01:18
  • @RolandGobler, use figure float environment: \begin{figure}[htb] \centering <image code or includegraphics{<image name>}\caption{...}\label{...}\end{figure}. – Zarko Jan 07 '19 at 01:27
4

Here is a simple code with pst-eucl:

\documentclass[border=8pt]{standalone}
\usepackage{pst-eucl}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}(0,0)(6.8,6.8)
\pstGeonode[PointName=none, PointSymbol=none](0,0){O}(2,2){A}(4,4){B}(6,6){C}(1,0){I}(0,1){J}(6,4){D}(4,6){E}
\psframe(O)(A) \psframe(A)(B) \psframe(B)(C)
\psset{arrows=->, arrowinset=0.12, linejoin=1, nodesepB=-1}
\pstLineAB[linecolor=red]{O}{C}
\psset{linestyle=dashed, linecolor=blue}
\pstLineAB{I}{E} \pstLineAB{J}{D}
\end{pspicture}

\end{document} 

enter image description here

Bernard
  • 271,350
3

Another PSTricks solution only for fun purposes.

\documentclass[pstricks]{standalone}

\begin{document}
\pspicture[dimen=m,arrows=->](9,9)
    \multips(1,1)(2,2){3}{\psframe(2,2)}
    \psline[linecolor=red](1,1)(8,8)
    \psset{linecolor=blue,linestyle=dashed}
    \psline(1,2)(8,5.5)\psline(2,1)(5.5,8)
\endpspicture
\end{document} 

enter image description here

Display Name
  • 46,933