# How do they draw this in Latex? [duplicate]

How do they draw this in Latex ?

## marked as duplicate by Henri Menke tikz-pgf StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 2 at 22:58

• Search here for trees. – Sigur Mar 2 at 17:13
• Package tikz-cd should do it very simply. – Bernard Mar 2 at 17:19
• Although you already have an answer, your question is still a just-do-it-for-me question, and we overall dislike those questions. Next time make sure that you will add an MWE showing what you've tried. We prefer fixing to creating. – user156344 Mar 2 at 17:24
• @JouleV I don't know this. But the user was removed? – Sebastiano Mar 2 at 17:30
• @Sebastiano Well, I don't know why but I'm now a bit uncomfortable when reading just-do-it-for-me questions. Maybe I'm becoming allergic to such questions after a series of 7 questions I saw yesterday. – user156344 Mar 2 at 17:36

With tikz-cd:

\documentclass[10pt]{article}
\usepackage{tikz-cd}

\begin{document}
\begin{tikzcd}[row sep= .7cm, column sep=.5cm]
& 1 \arrow[ld, no head] &\\
& 3 \arrow[ru, no head] &
\end{tikzcd}
\end{document}


Loops can help avoid repetition and polar coordinates help to make things more symmetric.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \X in {1,...,4} {\node (\X) at (\X*90:1) {\X};}
\foreach \X [remember=\X as \LastX (initially 4)] in {1,...,4}
{\draw (\LastX) -- (\X);}
\end{tikzpicture}
\end{document}


Pure tikz?

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
\node (1) {1};
\node (2) [below left=of 1] {2};
\node (3) [below right=of 2] {3};
\node (4) [below right=of 1] {4};
\draw (1)--(2) (1)--(4) (2)--(3) (3)--(4);
\end{tikzpicture}

\end{document}


A shorter version with a \foreach loop: [PS: similar to @marmot's answer below]

\begin{tikzpicture}
\foreach \i in {1,...,4}
\node (\i) at (90*\i:1cm) {\i};
\draw (1)--(2) (1)--(4) (2)--(3) (3)--(4);
\end{tikzpicture}


A short code with pstricks and multido:

\documentclass{article}

\usepackage{pst-node, multido}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{psmatrix}[rowsep=1cm, colsep=1.25cm]
& 1 \\ 2 & & 4 \\ & 3
\end{psmatrix}
\multido{\ir=1+2}{2}{\multido{\ic=1+2}{2}{\ncline[nodesep=4pt, linewidth=0.5pt]{\ir,2}{2,\ic}}}

\end{document}