## Node shape trapezium in TikZ

**Trapezium shape is a part of the shapes.geometric TikZ library**, so to work with this shape, we need to declare the library. We need to add the following piece of code after the TikZ package declaration:

\usetikzlibrary{shapes.geometric}

**A trapezium shape can be drawn by using the option trapezium to the \node command.** Following line creates a trapezium node named (t) at coordinate (0,0).

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium] (t) at (0,0) {}; \end{tikzpicture} \end{document}

Compiling this line of code displays nothing. **The trapezium node will be drawn only if we provide draw option to the node command** as follows:

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium,draw] (t) at (0,0) {}; \end{tikzpicture} \end{document}

## Add text to the trapezium node

The previous code creates a trapezium node with empty content. **Text can be added inside the trapezium node by putting it between the curly braces {} **as follows:

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium,draw] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

To fit the text inside the shape, this code yields to a trapezium with a size depends on its content:

## Change text color of the trapezium node

In the previous section, we have added content to the trapezium node and now we **would like to change the text color. This can be achieved by providing the option text = <color> to the \node command**:

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw, text = brown] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

## Add filling color to a node

**The trapezium node can be filled with any color using the option fill = <color>**. Here is an illustrative example of a light teal filling with our brown text:

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw, text = brown, fill = teal!20] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

## Change the border line color of trapezium

**The trapezium border color can be modified (default is black) by providing the color name to the draw option draw = <color>**. Here is an example of a trapezium filled with light teal, has brown text and blue borders:

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw = blue!80, text = brown, fill = teal!20] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

## Change the size of a trapezium node

We mentioned above that the size of a trapezium depends on its content. This is always true and we can set only the minimum size of a trapezium.

We can arrange a minimum size for its bottom width with **minimum width** option, and similarly, we can set its height by using **minimum height** option.

Below, we set the stretch option to true, minimum width value to 4 cm and the minimum height value to 3 cm.

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw = blue!80, text = brown, fill = teal!20, trapezium stretches = true, minimum width = 3cm, minimum height = 1.5cm] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

## Change trapezium angles

We can also change the lower internal angles of the trapezium using **trapezium left angle** and t**rapezium right angle** options. **However, to enforce these angles, we need to remove the trapezium stretches option**, and therefore, remove one of the minimum size options.

Here is an example of a trapezium with a minimum width value of 3 cm, a 120degrees left internal angle and a 60degrees right internal angle. (Since the angles are adding up to 180degrees, our shape is also a parallelogram.)

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw = blue!80, text = brown, fill = teal!20, minimum width = 3cm, trapezium left angle = 120, trapezium right angle = 60] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

**If we need both of the lower internal angles to be the same, we can use trapezium angle** option. Here is an example of a trapezium with 45degrees lower internal angles.

\documentclass[border=0.2cm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node[trapezium, draw = blue!80, text = brown, fill = teal!20, minimum width = 3cm, trapezium angle = 45] (t) at (0,0) {Trapezium}; \end{tikzpicture} \end{document}

## Anchors of a trapezium node

The advantage of using a **node trapezium is that it defines a set of anchors that we can use to get coordinates of the node borders or to position nodes with accuracy with respect to given coordinates**. By default, node center is positioned at the provided coordinates ((0,0) for the previous examples).

(t.west) represents the coordinates of the point located at the west of the trapezium node where t is the node name. We can also use angles where (t.0) is the coordinates of the point located at the east of the trapezium node.

Adding anchor = south will place the node point (t.south) at the provided coordinate (0,0). Check this post: how to annotate an image in LaTeX (Positioning Nodes using Anchors section).

## Outer separation

The above anchors can be moved outside the node border by adding **outer sep = <value>** to the node command. Here is an example of anchors moved outside the node border with 10pt.