# Hasse diagram on Latex [closed]

I think I should be using the tikzcd package but having trouble getting understanding how it works.

• Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
– Community Bot
May 24 at 21:39

I propose this short code to make the diagram with pstricks:

    \documentclass[border=12pt, svgnames]{standalone}%
\usepackage{pst-node}

\begin{document}

\psset{unit=2cm}
\begin{pspicture}(-0.5,-1.5)(3,1.5)
\dotnodes(0,0){A}(1.4,0){B}(2.8,0){C}(1; 45){D}(2.1,0.7){E}(2;45){F}(0,-1){G}(1.4,-1){H}(2.8,-1){I}
\psline(A)(F)(E)(B)(D)
\psline(A)(G)\psline(B)(H)\psline(C)(I)
\uput[l](A){6} \uput[r](B){10} \uput[r](C){14}
\uput[ul](D){30}\uput[ur](E){20}\uput[ur](F){60}
\uput[dl](G){3}\uput[d](H){5}\uput[d](I){7}
\end{pspicture}

\end{document}


Here is a TikZ solution:

Make a style called dot that takes a label as an option, e.g., dot={45:60} places the label 60 at an angle of 45 degrees from the dot.

Then use positioning to place the nodes relative to the root node (which I named root. Finally, \draw the edges.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}

\tikzset{dot/.style={fill, circle, inner sep=1.5pt, outer sep=0pt, label=#1}}

\begin{document}

\begin{tikzpicture}[node distance=2cm]
\node[dot={45:60}] (root){};
\node[dot={135:30}, below left=of root](a){};
\node[dot={45:20}, below right=of root](b){};
\node[dot={180:6}, below left=of a](c){};
\node[dot={0:10}, below right=of a](d){};
\node[dot={0:14}, below right=of b](e){};
\node[dot={270:3}, below=of c](f){};
\node[dot={270:5}, below=of d](g){};
\node[dot={270:7}, below=of e](h){};
\draw[thick](root)--(a)--(c)--(f) (a)--(d)--(g) (root)--(b)--(d) (e)--(h);
\end{tikzpicture}

\end{document}