# pgf-umlcd : text width error in class diagram

Trying to draw a package classes diagram with pgf-umlcd, I have got an error because of text width parameter for the class width, I don't know which package I need to solve the problem.

Here is a sample code:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgf-umlcd}

\begin{document}

\begin{tikzpicture}
\begin{package}{Package}
\begin{class}{Class}[text width=5cm]{1 ,1}
...
\end {class}
\end{package}
\end{tikzpicture}
\end{document}


Thanks

• My recommendation: If you do not have too many class diagrams already switch to the more powerful tikz-uml package (perso.ensta-paristech.fr/~kielbasi/tikzuml). – TeXnician Feb 24 '18 at 14:30
• if you think so, I will switch them, thank you for the advice – Hind Dev Feb 24 '18 at 14:39

## 1 Answer

Helps if you put the optional argument in the correct place, i.e. immediately after \begin{class}.

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgf-umlcd}

\begin{document}

\begin{tikzpicture}
\begin{package}{Package}
\begin{class}[text width=5cm]{Class}{1 ,1}
...
\end {class}
\end{package}
\end{tikzpicture}
\end{document}