I have 7 classes and wanted to make a UML-diagram of these in latex. I did manage to code it but take a look at the result (I did even try to rescale and rearrange):
You can't even identify all the lines showing the relationships. The UML is very messy as you can see so I would like to know if it is possible to make this UML in Latex such that it looks more clean?
Code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[schoo,simplified]{pgf-umlcd}
\date{January 2019}
\begin{document}
\maketitle
\section{UML-diagram (se næste side)}
\newpage
\begin{tikzpicture}
\begin{package}{Chess}
\begin{class}[text width = 5cm]{chessPiece}{0,0}
\attribute{\textit{nameOfType : string}}
\attribute{color : Color}
\attribute{position : Position option with get/set = None}
\attribute{\textit{candidateRelativeMoves : Position list list}}
\attribute{}
\operation{}
\operation{ToString : unit $\rightarrow$ string}
\operation{availableMoves : Board $\rightarrow$ Position list}
\operation{isThreatened : Board : chessPiece : Position $\rightarrow$ bool}
\operation{}
\end{class}
\begin{class}[text width = 5cm]{Board}{-5.5,0}
\attribute{Item : : chessPiece option with set}
\operation{static validPositionWrap : Position $\rightarrow$ Position option}
\operation{ToString : unit $\rightarrow$ string}
\operation{move : Position : Position $\rightarrow$ unit}
\operation{getVacantNOccupied : chessPiece : Position list $\rightarrow$ unit}
\operation{getVacantNNeighbours : chessPiece : Position list $\rightarrow$ unit}
\end{class}
\end{package}
\begin{package}{Pieces}
\begin{class}[text width = 3cm]{king}{-11,-1}
\inherit{chessPiece}
\attribute{nameOfType : string= "king"}
\attribute{candidateRelativeMoves = [[(-1,0)];[(-1,1)];[(0,1)];[(1,1)];
[(1,0)];[(1,-1)];[(0,-1)];[(-1,-1)]]}
\end{class}
\begin{class}[text width = 3cm]{rook}{-11,-5}
\inherit{chessPiece}
\attribute{nameOfType : string= "rook"}
\attribute{candidateRelativeMoves = List.map (swap List.map [1..7]) indToRel}
\end{class}
\end{package}
\begin{package}{Interactives}
\begin{class}[text width = 5cm]{Player}{0,-8}
\attribute{pieceToMove : chessPiece option = None}
\operation{nextMove : Board $\rightarrow$ string}
\end{class}
\begin{class}[text width = 5 cm]{Human}{0, -11}
\inherit{Player}
\end{class}
\end{package}
\begin{class}[text width = 5cm]{Game}{-8,-10}
\attribute{player1 : Human}
\attribute{player2 : Human}
\attribute{\_board : Board}
\operation{setup : unit}
\operation{run : unit}
\operation{valid : string [] $\rightarrow$ Human $\rightarrow$ bool}
\end{class}
\unidirectionalAssociation {chessPiece}{}{}{Board}
\unidirectionalAssociation{Game}{}{}{chessPiece}
\unidirectionalAssociation{Game}{}{}{Player}
\composition{Game}{}{}{king}
\composition{Game}{}{}{rook}
\composition{Game}{}{}{Human}
\composition{Game}{}{}{Board}
\composition{Player}{}{}{chessPiece}
\end{tikzpicture}
\end{document}
Example of a way better version, with example of a modified arrow:


\documentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – samcarter_is_at_topanswers.xyz Jan 18 '19 at 12:24\end{document}are missing. – samcarter_is_at_topanswers.xyz Jan 18 '19 at 13:34