How could I create these aligned images intelligently and with millimeter dimensions?

enter image description here

I used GeoGebra to generate the code shown below.


    \draw (0mm,0mm) ellipse (50mm and 20mm);

    \draw (150mm,0mm) circle (20mm);

    \draw (-50mm,-72.5mm)-- (50mm,-72.5mm);
    \draw (-50mm,-107.50mm)-- (50mm,-107.50mm);
    \draw (-50mm,-72.5mm)-- (-50mm,-107.50mm);
    \draw (50mm,-107.50mm)-- (50mm,-72.5mm);

    \draw (110mm,-72.5mm)-- (190mm,-72.5mm);
    \draw (110mm,-107.50mm)-- (190mm,-107.50mm);
    \draw (110mm,-72.5mm)-- (110mm,-107.50mm);
    \draw (190mm,-107.50mm)-- (190mm,-72.5mm);

I would like to improve the code by defining the positions of the geometries using the centers as reference. Having the center of the ellipse in position (0,0).

Dimensions do not have to be displayed. They are just for setting profile sizes.

The link in this video demonstrates what I'm trying to learn. I'm Brazilian and so it's in Portuguese.


2 Answers 2


You can use positioning to set the ceneter points, and then calc to draw the shapes. I have scaled it to half size to get a better fit on a normal page size, but you can get the true size by setting x=1mm,y=1mm.

    \begin{tikzpicture}[x=0.5mm,y=0.5mm]% Set the scale (default x and y is 1cm)
    \coordinate (a11);
    \coordinate[right=150 of a11](a12);
    \coordinate[below=90 of a11](a21);
    \coordinate[right=150 of a21](a22);
    \draw[ultra thick] (a11) circle (50 and 20);
    \draw[dash dot] ($(a11)-(50+10,0)$) -- +($2*(50+10,0)$);
    \draw[dash dot] ($(a11)-(0,20+10)$) -- +($2*(0,20+10)$);
    \draw[ultra thick] (a12) circle (20);
    \draw[dash dot] ($(a12)-(20+10,0)$) -- +($2*(20+10,0)$);
    \draw[dash dot] ($(a12)-(0,20+10)$) -- +($2*(0,20+10)$);
    \draw[ultra thick] ($(a21)-(50,17.5)$) rectangle +(50*2,17.5*2);
    \draw[dash dot] ($(a21)-(50+10,0)$) -- +($2*(50+10,0)$);
    \draw[dash dot] ($(a21)-(0,17.5+10)$) -- +($2*(0,17.5+10)$);
    \draw[ultra thick,rounded corners=8] ($(a22)-(50,17.5)$) rectangle +(50*2,17.5*2);
    \draw[dash dot] ($(a22)-(50+10,0)$) -- +($2*(50+10,0)$);
    \draw[dash dot] ($(a22)-(0,17.5+10)$) -- +($2*(0,17.5+10)$);



Here's a start.

  • There is a lot of unnecessary stuff (for a MWE) in your example (\pagestyle{empty} and the strange color definitions and -5.428299960530308 for example).
  • Did you generate the code with another software?
  • I removed everything and use article as the "better" MWE document class for most cases.



\begin{tikzpicture}[node distance=30mm]
\node[circle,draw,minimum width = 20mm,anchor=center] (n1) {Circle};
\node[ellipse,draw,minimum width = 20mm,minimum height = 10mm,anchor=center,below=20mm of n1] (n2) {Ellipse};
\node[rectangle,draw,minimum width = 20mm,minimum height = 10mm,anchor=center,right=20mm of n2] (n3) {Rectangle};


enter image description here

  • Maybe add this information to your question. You claim to have generated a minimal example which I strongly disagree. Commented Jul 17, 2017 at 22:22
  • I'm a beginner and I did not even know how to start. To have at least one minimal example, I had to do against it.
    – LCarvalho
    Commented Jul 17, 2017 at 22:25
  • Still, just tell that the people here in your question: "I used GeoGebra to generate the code shown below." This is independent of if you are a beginner or not. I tried to understand the code first which was a waste of time. Commented Jul 17, 2017 at 22:28
  • I only ask to mention that you used GeoGebra to generate the code. Nothing else. Commented Jul 18, 2017 at 5:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .