# how to use tikz for uml diagrams

I'm new on latex and i need any documentation to guide me and help me know how to draw an uml diagram using tikz just got a book from previous answers but still dont get it i tried an example

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\begin{class}[text width=8cm]{className}{0,0}
\attribute{name : attribute type}
\attribute{name : attrribute type = default value}
\operation{name(parameter list) : type of value returned}
\operation[0]{name(parameters list) : type of value returned}
\end{class}
\end{tikzpicture}
\end{document}


• Welcome! It is not very easy to help you with this, Obviously class is not an environment defined by tikz and/or article. So your code does not run through. The screen shot seems to be from a manual. I thought it could be tikz-uml, but adding \usepackage{tikz-uml} does not make your code working either (and to the best of my knowledge tikz-uml isn't an official package either). So please provide us with all the relevant information and make sure your code can be compiled. – user194703 May 24 '20 at 18:55

The syntax you're using is from a package called pgf-umlcd. Hence, if you replace \usepackage{tikz} with \usepackage{pgf-umlcd} your example works fine. (Assuming the package is installed.)

pgf-umlcd, and its sibling package pgf-umlsd, are both on CTAN (the main repository for all things TeX) and in TeX Live and MikTeX. Their manuals can be found on http://texdoc.net/, on CTAN, or by entering e.g. texdoc pgf-umlcd in a terminal/command prompt on your computer (assuming the documentation was included when you installed TeX Live/MikTeX).

The tikz-uml package mentioned by Schrödinger's cat, is not on CTAN, but can be downloaded from the author's website (https://perso.ensta-paris.fr/~kielbasi/tikzuml/index.php).

\documentclass{article}
\usepackage{pgf-umlcd}
\begin{document}
\begin{tikzpicture}
\begin{class}[text width=8cm]{className}{0,0}
\attribute{name : attribute type}
\attribute{name : attrribute type = default value}
\operation{name(parameter list) : type of value returned}
\operation[0]{name(parameters list) : type of value returned}
\end{class}
\end{tikzpicture}
\end{document}