\documentclass{article}
\usepackage{tikz}
\usepackage{graphicx} % Required for inserting images
\usepackage{pgfplots}

\title{LSG2023}
\author{Michal Moc}
\date{July 2023}

\newcommand{\rectangle}[2]{%
  \begin{tikzpicture}
    \coordinate (A) at (0, 0);
    \coordinate (B) at (#1, 0);
    \coordinate (C) at (#1, #2);
    \coordinate (D) at (0, #2);
    
    \draw (A) -- node[below] {#1} (B) -- node[right] {#2} (C) -- (D) -- cycle;
    
    \node at (A) [circle,fill,inner sep=1.5pt,label=left:A] {};
    \node at (B) [circle,fill,inner sep=1.5pt,label=right:B] {};
    \node at (C) [circle,fill,inner sep=1.5pt,label=right:C] {};
    \node at (D) [circle,fill,inner sep=1.5pt,label=left:D] {};
    %\node at (D)[label=left:D]{}
  \end{tikzpicture}
}
\begin{document}

%\maketitle

\section{Obdélník}

\rectangle{2cm}{3cm}

\section{úsečky}

%úsečka délky 3cm
\begin{tikzpicture}
  \coordinate (M) at (0,0); % Bod M
  \coordinate (N) at (3,0); % Bod N

  \draw[line width=1pt] (M) -- (N); % Úsečka mezi body M a N
\end{tikzpicture}

\begin{tikzpicture}

%to samé ale s vyznačenými body
\begin{tikzpicture}
  \coordinate (M) at (0,0); % Bod M
  \coordinate (N) at (3,0); % Bod N

  \draw[line width=1pt] (M) -- (N); % Úsečka mezi body M a N

  \foreach \pos/\label in {M/bod M, N/bod N}
    \draw (\pos) -- ++(0,-0.15) node[below] {\label}; % Čárky a popisky

\end{tikzpicture}

\draw[green, ultra thick] (2,3) -- (6,0) 
        -- (6,5) -- (2,0);

\end{tikzpicture}

\section{N úhelník}
\begin{tikzpicture}
    
\draw[orange, ultra thick] (4,10) -- (6,10) 
        -- (6,12) -- (2,11) -- cycle;

\end{tikzpicture}

\begin{center}
\begin{tikzpicture}[scale=0.8]

\begin{axis}[axis lines=middle,grid=both,
            xtick distance=3,ytick distance=3,minor tick num=2,
            x=0.5cm,y=0.5cm,xmin=-20,xmax=20,ymin=-10,ymax=10]
\end{axis}

\end{tikzpicture}
\end{center}


\begin{tikzpicture}
  \coordinate (M) at (0,0); % Bod M posunutý doleva o 0.3 cm
  \coordinate (N) at (3,0); % Bod N posunutý doprava o 0.3 cm

  \draw[line width=1pt, <->] (M) -- (N) ; % Úsečka mezi body M a N s šipkami

  \foreach \pos/\label in {M, N}
 % \foreach \pos/\label in {M/bod M, N/bod N} %když chci mít popis "bod M"
    \draw (\pos) -- ++(0,-0.15) node[below] {\label}; % Čárky a popisky

\end{tikzpicture}

\end{document}
