[Tex/LaTex] Help to draw a trapezoid

tikz-pgf

I would draw the isosceles trapezoid from the picture but I have a problem. Could you help me and write what I should write in latex?

enter image description here

Best Answer

Something like this, perhaps?

trapezium

\documentclass[border=5pt, multi, tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
  \node [trapezium, trapezium angle=60, minimum width=50mm, draw, thick, label=above:8cm, label=below:16cm, label=right:8cm, label=left:8cm] {};
\end{tikzpicture}
\end{document}

EDIT

You asked about annotating the diagram. There are various tools for this. If we name our trapezium node with (a), we can use the node anchors to place coordinates and draw dashd vertical lines in for the height

  \draw [densely dashed] (a.north west) coordinate (a nw) -- (a nw |- a.south) node [midway,right] {$h$} coordinate (a1) (a.north east) coordinate (a ne) -- (a ne |- a.south) node [midway,left] {$h$} coordinate (a2);

and little solid lines to mark the right angles

  \draw (a nw |- a.south) ++(0,1.5mm) -| ++(-1.5mm,-1.5mm) (a ne |- a.south) ++(0,1.5mm) -| ++(1.5mm,-1.5mm);

We can also name a couple more coordinates we need to mark further angles.

  \coordinate (a blc) at (a.bottom left corner);
  \coordinate (a brc) at (a.bottom right corner);

Loading the angles library, we can use its angle pic to add some additional markings

  \pic [my angle, "$\alpha$"] {angle=a1--a blc--a nw};
  \pic [my angle, "$\alpha$"] {angle=a ne--a brc--a1};
  \pic [my angle, "$\beta$"] {angle=a blc--a nw--a1};
  \pic [my angle, "$\beta$"] {angle=a2--a ne--a brc};

which use a common style for consistency, my angle, which we can define for the tikzpicture environment

\begin{tikzpicture}[my angle/.style={font=\scriptsize, draw, angle eccentricity=1.75, angle radius=3mm}]

with the following result

annotated trapezium

If you play around with the code and see what changes you can make and what does what, you will start to get a sense of how to modify it yourself and be in a better position to draw new diagrams or to modify existing examples, as well. Then you can ask specific, focused questions if you get stuck. The TikZ manual is large but very good. You don't need to read all of it! Instead, treat it as a reference and look up the things you need. The section covering TikZ's standard libraries, for example, includes a short section on shapes.geometric with full details of how to draw and modify trapezium-shaped nodes (among others) and the section on the angles library explains how to draw in angles.

Complete code:

\documentclass[border=5pt, multi, tikz]{standalone}
\usetikzlibrary{shapes.geometric,angles,quotes}
\begin{document}
\begin{tikzpicture}[my angle/.style={font=\scriptsize, draw, angle eccentricity=1.75, angle radius=3mm}]
  \node (a) [trapezium, trapezium angle=60, minimum width=50mm, draw, thick, label=above:8cm, label=below:16cm, label=right:8cm, label=left:8cm] {};
  \draw [densely dashed] (a.north west) coordinate (a nw) -- (a nw |- a.south) node [midway,right] {$h$} coordinate (a1) (a.north east) coordinate (a ne) -- (a ne |- a.south) node [midway,left] {$h$} coordinate (a2);
  \draw (a nw |- a.south) ++(0,1.5mm) -| ++(-1.5mm,-1.5mm) (a ne |- a.south) ++(0,1.5mm) -| ++(1.5mm,-1.5mm);
  \coordinate (a blc) at (a.bottom left corner);
  \coordinate (a brc) at (a.bottom right corner);
  \pic [my angle, "$\alpha$"] {angle=a1--a blc--a nw};
  \pic [my angle, "$\alpha$"] {angle=a ne--a brc--a1};
  \pic [my angle, "$\beta$"] {angle=a blc--a nw--a1};
  \pic [my angle, "$\beta$"] {angle=a2--a ne--a brc};
\end{tikzpicture}
\end{document}
Related Question