答案1
答案2
答案3
纯 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}
带有循环的较短版本\foreach
:[PS:类似于下面@marmot 的回答]
\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}
答案4
pstricks
带有和 的简短代码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}