如何使用“链”绘制菱形结构?

如何使用“链”绘制菱形结构?

我正在使用chains重新绘制结构(如下所示)第二同构定理(wiki)2nd-iso-wiki

代码和结果图如下所示。

如何摆脱虚拟节点(为了对齐而添加)以及join它与节点hn和之间的不必要的线hcapn

第二次

\documentclass[tikz]{standalone}
\usetikzlibrary{chains, scopes}

\begin{document}
\begin{tikzpicture}[every on chain/.style = join, every join/.style = -, node distance = 0.8cm and 1.0cm]
  { 
    [start chain = G going below] % G chain
    \node (g) [on chain] {$G$};
    \node (hn) [on chain, below = 0.50cm of g] {$HN$}; 
    { [start branch = H going below left] % H branch
      \node (h) [on chain] {$H$};
    }
    { [start branch = N going below right] % N branch
      \node [on chain] {$N$};
    }
    \node [on chain] {}; % dummy node % continue G chain
    \node (hcapn) [on chain, join = with G/H-end, join = with G/N-end] {$H \cap N$};
    \node (e) [on chain, below = 0.50cm of hcapn] {$\{ e \}$};
  }
\end{tikzpicture}
\end{document}

答案1

带有链,但在连接宏中排除了两个节点,并且为其单独绘制连接:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{chains, positioning, shapes.geometric}
\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
    \begin{tikzpicture}[
node distance = 8mm and 10 mm,
  start chain = going below,
     N/.style = {ellipse, draw, inner sep=2pt, on chain, join=by -}]
\node (g)       [N] {$G$};
\node (hn)      [N] {$HN$};
\node (h)       [N, below left=of hn]   {$H$};
\node (hcapn)   [N, below=of h -| hn]   {$H \cap N$};
\node (e)       [N] {$\{ e \}$};
%
\node (n)       [N,suspend join,
                 below right=of hn]     {$N$};
\node [below=of hn] {$\cong$};
\draw (hn) -- (n)   (n) -- (hcapn);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

如果你想复制链接的图片,我建议这样做

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes,fit}
\usepackage{mathptmx}
\begin{document}
\begin{tikzpicture}[x=1.75cm,y=1.75cm]
\begin{scope}[every node/.style={draw,circle,minimum size=1cm}]
\node (g) at (0,2) {$G$};
\node (sn) at (0,1) {$SN$};
\node (n) at (-1,0) {$N$};
\node (s) at (1,0) {$S$};
\node[ellipse,draw,minimum height=1cm] (scn) at (0,-1) {$S\cap N$};
\node (e) at (0,-2) {$\{e\}$};
\end{scope}
\draw (g)--(sn)--(n)--(scn)--(e) (scn)--(s)--(sn);
\node[rotate=-45,ellipse,draw,dashed,inner xsep=-7mm,inner ysep=-1mm,fit=(sn)(n)] {};
\node[rotate=-45,ellipse,draw,dashed,inner xsep=-9mm,inner ysep=1mm,fit=(scn)(s)] {};
\node {$\cong$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容