enter image description here

How to draw this figure in LaTeX?

I am new to LaTeX figure drawing. Here I see two round headed rectangles and two circles. Also I am eager to know that can I draw this in Overleaf?


One out of many possibilities.

\begin{tikzpicture}[bullet/.style={fill,circle,inner sep=2pt}]
\node[rounded rectangle,draw,minimum width=3cm,minimum height=4mm,rotate=20](A) at (0,0){};
\node[rounded rectangle,draw,minimum width=3cm,minimum
at ([xshift=-1mm]A.south east){};
\node[bullet,shift={(200:2mm)}] at (A.east){};
\node[bullet,shift={(20:2mm)}] at (A.west){};

enter image description here

  • 1
    The figure reminds me of a toy called "Metallbaukasten" (de.wikipedia.org/wiki/Metallbaukasten). It would be interesting if there is a package for this.
    – Stefan
    Jan 22 '19 at 11:55
  • @Stefan I am not aware of such a package. (And I guess kids will prefer the real thing anyway. ;-)
    – user121799
    Jan 22 '19 at 15:38
  • I had thought of the usage for simulation purposes.
    – Stefan
    Jan 23 '19 at 6:07

Just another solution.


\fill circle(2pt) coordinate(a) ++(20:2cm) circle(2pt) coordinate(b); 
\draw (a)++(110:2mm) arc (110:290:2mm)--++(20:2cm) arc (-70:110:2mm)--cycle;
\draw (b)++(170:2mm) arc (170:350:2mm)--++(80:2cm) arc (-10:170:2mm)--cycle;


enter image description here


Run with xelatex




enter image description here


Another option: this one is in Metapost using the mplib package, so you need to use lualatex to compile it. In Overleaf, click on "Menu" at the top left and choose "LuaLaTeX" as the compiler.

A drawing of some semaphore arms.

    vardef arm(expr extent, radius, mark_start, mark_end) =
        save P, A; 
        picture P; path A;
        A = halfcircle scaled 2 radius rotated 90 
         -- halfcircle scaled 2 radius rotated -90 shifted (extent, 0)
         -- cycle;
        P = image(draw A;
            if mark_start > 0:
                fill fullcircle scaled 2 mark_start;
            if mark_end > 0:
                fill fullcircle scaled 2 mark_end shifted (extent, 0);
        ); P
    draw arm(200, 16, 0, 6) rotated 200;
    draw arm(200, 16, 6, 0) rotated 60;

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.