我正在为我教授的抽象代数课程准备讲义。我想绘制下面的图表,该图表来自 Zassenhaus 的蝴蝶引理。
图中 $K$ 是群 $(G'\cap H)(G\cap H')$。我没有把它写在那里,因为我觉得它会让图表变得混乱,让那些看到它并帮助我在这个网站上的人看不懂。
我不太熟悉 LaTeX。到目前为止,我的代码结构如下。
\documentclass[12pt, a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[margin=0.6in]{geometry}
\usepackage{graphicx}
\usepackage[none]{hyphenat}
\usepackage{amssymb, tikz}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{physics}
\usepackage{mathrsfs}
\usepackage{fourier-orns}
\usepackage{tikz-cd}
\usepackage{blindtext}
\usepackage{mathtools}
\usepackage{pdfrender,xcolor}
\usepackage[T1]{fontenc}
\usepackage{crimson}
\setlength{\parskip}{0.3em}
\setlength{\parindent}{2em}
\newcommand\bulletpoint[1][.5]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\bullet$}}}}}
\newcommand\proofend[1][.75]{\mathbin{\vcenter{\hbox{\scalebox{#1}{$\qed$}}}}}
\newcommand\Thicc{\fontsize{35}{50}\selectfont}
\newcommand\textbox[1]{%
\parbox{.404\textwidth}{#1}%
}
\newcommand\textbonk[1]{%
\parbox{.333\textwidth}{#1}%
}
\newcommand{\mysetminusD}{\hbox{\tikz{\draw[line width=0.6pt,line cap=round] (3pt,0) -- (0,6pt);}}}
\newcommand{\mysetminusT}{\mysetminusD}
\newcommand{\mysetminusS}{\hbox{\tikz{\draw[line width=0.45pt,line cap=round] (2pt,0) -- (0,4pt);}}}
\newcommand{\mysetminusSS}{\hbox{\tikz{\draw[line width=0.4pt,line cap=round] (1.5pt,0) -- (0,3pt);}}}
\newcommand{\mysetminus}{\mathbin{\mathchoice{\mysetminusD}{\mysetminusT}{\mysetminusS}{\mysetminusSS}}}
\DeclareSymbolFont{AMSa}{U}{msa}{m}{n}
\DeclareMathSymbol{\normal}{\mathrel}{AMSa}{"45}
\let\l\langle
\let\r\rangle
\let\phi\varphi
\let\varphi\phi
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\makeatother
\begin{document}
\emergencystretch 1em
\pdfrender{StrokeColor=black,TextRenderingMode=2,LineWidth=0.4pt}
\[\begin{tikzcd}[column sep=30pt]G\arrow[d,"\,"]&\,&H\arrow[d,"\,"]\\G'(G\cap H)\arrow[dd,"\,"]\arrow[dr,"\,"]&\,&(G\cap H)H'\arrow[dd,"\,"]\arrow[dl,"\,"]\\\,&G\cap H\arrow[dd,"\,"]&\,\\G'(G\cap H')\arrow[dr,"\,"]&\,&(G'\cap H)H'\arrow[dl,"\,"]\\\,&K&\,\end{tikzcd}\]
\end{document}
请帮我画一下。任何帮助我都会非常感激。
编辑:很抱歉,我不知道这里的社区重视在寻求帮助之前先查看原始发帖人的尝试。我根据我对 LaTeX 的有限了解,做了一些力所能及的事情。当然,我不希望它们是箭头,我希望交叉点是点,而不是组本身的符号。
答案1
我认为,使用纯 Ti 可以更好地完成此操作钾对于我来说,使用 Ztikz-cd
需要进行太多调整:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\tikzset{
node/.style={
circle,
fill,
inner sep=1.5pt
},
font=\footnotesize
}
\begin{document}
\begin{tikzpicture}
\node[node, label={above right:$G$}] (G1) at (0,0.5) {};
\node[node, label={above left:$H$}] (H1) at (3,0.5) {};
\node[node, label={left:$G'(G \cap H)$}] (G2) at (0,0) {};
\node[node, label={[label distance=5pt]above:$G \cap H$}] (GH2) at (1.5,-1) {};
\node[node, label={right:$(G \cap H)H'$}] (H2) at (3,0) {};
\node[node, label={left:$G'(G \cap H')$}] (G3) at (0,-1.5) {};
\node[node, label={below:$K$}] (GH3) at (1.5,-2.5) {};
\node[node, label={right:$(G \cap H')H'$}] (H3) at (3,-1.5) {};
\node[node, label={left:$G'$}] (G4) at (-1,-2.25) {};
\node[node, label={below:$G' \cap H$}] (G5) at (0.5,-3.25) {};
\node[node, label={right:$H'$}] (H4) at (4,-2.25) {};
\node[node, label={below:$G \cap H'$}] (H5) at (2.5,-3.25) {};
\draw
(G1) -- (G2)
(H1) -- (H2)
(G2) -- (G3) node[midway] {$=$}
(H2) -- (H3) node[midway] {$=$}
(GH2) -- (GH3) node[midway] {$=$}
(G2) -- (GH2) -- (H2)
(G3) -- (GH3) -- (H3)
(G3) -- (G4) -- (G5) -- (GH3)
(H3) -- (H4) -- (H5) -- (GH3);
\end{tikzpicture}
\end{document}
这可能还可以进一步简化。
用箭头和大头针代替标签来$K$
表达实际含义(但我不知道这种安排是否正确):
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\tikzset{
node/.style={
circle,
fill,
inner sep=1.5pt
},
font=\footnotesize,
every pin edge/.style={
very thin,
shorten <=2pt
}
}
\begin{document}
\begin{tikzpicture}
\node[node, label={above right:$G$}] (G1) at (0,0.5) {};
\node[node, label={above left:$H$}] (H1) at (3,0.5) {};
\node[node, label={left:$G'(G \cap H)$}] (G2) at (0,0) {};
\node[node, label={[label distance=5pt]above:$G \cap H$}] (GH2) at (1.5,-1) {};
\node[node, label={right:$(G \cap H)H'$}] (H2) at (3,0) {};
\node[node, label={left:$G'(G \cap H')$}] (G3) at (0,-1.5) {};
\node[node, pin={[pin distance=1.5cm]below:$(G'\cap H)(G\cap H')$}] (GH3) at (1.5,-2.5) {};
\node[node, label={right:$(G \cap H')H'$}] (H3) at (3,-1.5) {};
\node[node, label={left:$G'$}] (G4) at (-1,-2.25) {};
\node[node, label={below:$G' \cap H$}] (G5) at (0.5,-3.25) {};
\node[node, label={right:$H'$}] (H4) at (4,-2.25) {};
\node[node, label={below:$G \cap H'$}] (H5) at (2.5,-3.25) {};
\draw[->] (G1) -- (G2);
\draw[->] (H1) -- (H2);
\draw[->] (G2) -- (G3) node[midway] {$=$};
\draw[->] (H2) -- (H3) node[midway] {$=$};
\draw[->] (G2) -- (GH2);
\draw[->] (H2) -- (GH2);
\draw[->] (GH2) -- (GH3) node[midway] {$=$};
\draw[->] (G3) -- (G4);
\draw[->] (H3) -- (H4);
\draw[->] (G3) -- (GH3);
\draw[->] (H3) -- (GH3);
\draw[->] (G4) -- (G5);
\draw[->] (H4) -- (H5);
\draw[->] (GH3) -- (G5);
\draw[->] (GH3) -- (H5);
\end{tikzpicture}
\end{document}
答案2
相同的想法,但是 Jasper 更快:)
但是,Tikz
您也可以通过不同的方式实现相同的视觉效果。因此,也许您可以从这里采用其他方法。
1. 保持简单
考虑到初学者,Tikz
我不会一次性使用所有技巧:有时很难始终正确编写较短的代码。因此,我故意采用更多代码行的方法来获得更清晰的结果。
我有意专注于左半部分,因为它对称且易于完成。
将一些节点名称放入草图中可能是一个好主意:
2. 将节点设置为圆形
即通过带有空文本的节点构建您的点网络。样式dot
将定义所需的所有细节。
% ~~~ some nodes containing no text ~~~~~~~~~~
\node[dot] (A) at ( 0 , 0) {};
\node[dot] (G) at (-2 , 1) {};
...
3. 画出所有普通线条
即那些中间没有勾号的:
% ~~~ ordinary connecting lines ~~~~~~~~
\draw (G) -- (B1);
\draw (B1) -- (A);
...
4. 绘制勾线
有很多方法可以做到这一点。在这里我要求 Tikz:
draw
从A到K- 并在结束此路径之前通过
;
- 放
node
midway
一些有用的文字
% ~~~ special connecting lines ~~~~~~~~
\draw (B1) -- (C1) node[midway] {$=$};
\draw (A) -- (K) node[midway] {$=$};
5. 最后,贴上所有数学标签
没什么大不了的。剩下唯一需要解释的就是那些自定义的样式。
% ~~~ placing all those math labels ~~~~~~
\node[abv] at (A) {$G \cap H$};
\node[rgt] at (G) {$G$};
...
6. 自定义样式
这里它们在 tikzpicture 的开头用[ ]
括号括起来定义:
dot
只绘制节点的外部形状,其中有空文本,因此看起来像一个圆圈abv
并bel
用于yshift
将带有数学标签文本的节点放置得更整齐rgt
并lft
使用引用节点的左(西)侧和右(东)侧,即模仿 LaTeX 中的 raggedright 和 raggedleft
\begin{tikzpicture}[% defining some styles
dot/.style={shape=circle,% the dots
minimum size=2pt,inner sep=0,% "radius 2pt"
fill=black,draw,
},
abv/.style={yshift=3mm},% above = shifting up
bel/.style={yshift=-3mm},% below = shifting down
rgt/.style={anchor=west},% right sides are anchored
lft/.style={anchor=east},% left sides are anchored
]
结果(左半部分)
代码
\documentclass[10pt,border=3mm,tikz]{standalone}
% better class for development
% loads Tikz already, as specified
\begin{document}
\begin{tikzpicture}[% defining some styles
dot/.style={shape=circle,% the dots
minimum size=2pt,inner sep=0,% "radius 2pt"
fill=black,draw,
},
abv/.style={yshift=3mm},% above = shifting up
bel/.style={yshift=-3mm},% below = shifting down
rgt/.style={anchor=west},% right sides are anchored
lft/.style={anchor=east},% left sides are anchored
]
% ~~~ some nodes containing no text ~~~~~~~~~~
\node[dot] (A) at ( 0 , 0) {};
\node[dot] (G) at (-2 , 1) {};
\node[dot] (B1) at (-2 , .5) {};
\node[dot] (C1) at (-2 ,-1.5) {};
\node[dot] (K) at ( 0 ,-2) {};
\node[dot] (D1) at (-3 ,-3) {};
\node[dot] (E1) at (-1.5,-3.51) {};
% ~~~ ordinary connecting lines ~~~~~~~~
\draw (G) -- (B1);
\draw (B1) -- (A);
\draw (C1) -- (D1);
\draw (C1) -- (K);
\draw (D1) -- (E1);
\draw (E1) -- (K);
% ~~~ special connecting lines ~~~~~~~~
\draw (B1) -- (C1) node[midway] {$=$};
\draw (A) -- (K) node[midway] {$=$};
% ~~~ placing all those math labels ~~~~~~
\node[abv] at (A) {$G \cap H$};
\node[rgt] at (G) {$G$};
\node[bel] at (K) {$K$};
\node[lft] at (B1) {$G'(G \cap H)$};
\node[lft] at (C1) {$G'(G \cap H')$};
\node[lft] at (D1) {$G'$};
\node[bel] at (E1) {$G' \cap H$};
\end{tikzpicture}
\end{document}
PS(关于编程策略)
考虑到对称的右半部分,您现在也可以在扩展代码时很容易地反映它,例如像这样:
...
\node[dot] (G) at (-2 , 1) {}; \node[dot] (H) at ( 2 , 1) {};
...
\draw (G) -- (B1); \draw (H) -- (B2);
\draw (B1) -- (A); \draw (B2) -- (A);
...
这样,您就可以在代码中反映出图形的对称性,并且只需查看代码就可以进行一种错误预防,至少是错误最小化的控制:如果它不对称,而它应该是对称的,那么我做错了什么......
顺便说一句,defensive or reserved programming approach
我倾向于这样称呼它,它更容易用短代码行(即非复杂代码)进行编码。但这是否是一件好事取决于很多因素。
答案3
这不是“如何绘制蝴蝶图?”的确切答案,但希望可以回答一般性问题。我认为使用 GUI(图形用户界面)绘制图表更容易。
存在一些工具,例如颤动或者tikzcd-编辑器,您可以在其中以相当直观的方式绘制图表并将结果导出为 Latex 代码。
答案4
因为你没有说你想用 Ti 画这个钾Z,下面是使用该包的解决方案l3draw
(该包的功能非常基础,因此必须定义一些函数以使其方便):
\documentclass[border=10pt]{standalone}
\usepackage{l3draw}
\begin{document}
\ExplSyntaxOn
\tl_new:N \l_zassenhaus_node_size_tl
\tl_set:Nn \l_zassenhaus_node_size_tl { 3pt }
\tl_new:N \l_zassenhaus_label_distance_tl
\tl_set:Nn \l_zassenhaus_label_distance_tl { 5pt }
\tl_new:N \l_zassenhaus_pin_distance_tl
\tl_set:Nn \l_zassenhaus_pin_distance_tl { 1.5cm }
\tl_new:N \l_zassenhaus_pin_sep_tl
\tl_set:Nn \l_zassenhaus_pin_sep_tl { 5pt }
\tl_new:N \l_zassenhaus_label_pin_hpole_tl
\tl_set:Nn \l_zassenhaus_label_hpole_tl { hc }
\tl_new:N \l_zassenhaus_label_pin_vpole_tl
\tl_set:Nn \l_zassenhaus_label_vpole_tl { vc }
\cs_new:Nn \l_zassenhaus_set_label_pin_anchor:nn {
\tl_set:Nn \l_zassenhaus_label_pin_hpole_tl { #1 }
\tl_set:Nn \l_zassenhaus_label_pin_vpole_tl { #2 }
}
\cs_generate_variant:Nn \draw_coffin_use:Nnn { Nee }
\cs_new:Nn \l_zassenhaus_draw_node_label:nnnn {
\tl_new:c { l__zassenhaus_draw_node_ #1 _tl }
\tl_set:cn { l__zassenhaus_draw_node_ #1 _tl } { #2 }
\draw_scope_begin:
\draw_transform_shift:n { #2 }
\draw_path_circle:nn { 0cm , 0cm } { \l_zassenhaus_node_size_tl / 2 }
\draw_path_use_clear:n { fill }
\hcoffin_set:Nn \l_tmpa_coffin { \footnotesize #3 }
\draw_scope_begin:
\draw_transform_shift:n {
\draw_point_polar:nn { \l_zassenhaus_label_distance_tl } { #4 }
}
\draw_coffin_use:Nee \l_tmpa_coffin
{ \l_zassenhaus_label_pin_hpole_tl } { \l_zassenhaus_label_pin_vpole_tl }
\draw_scope_end:
\draw_scope_end:
}
\cs_new:Nn \l_zassenhaus_draw_node_pin:nnnn {
\tl_new:c { l__zassenhaus_draw_node_ #1 _tl }
\tl_set:cn { l__zassenhaus_draw_node_ #1 _tl } { #2 }
\draw_scope_begin:
\draw_transform_shift:n { #2 }
\draw_path_circle:nn { 0cm , 0cm } { \l_zassenhaus_node_size_tl / 2 }
\draw_path_use_clear:n { fill }
\draw_path_moveto:n { \draw_point_polar:nn { \l_zassenhaus_pin_sep_tl } { #4 } }
\draw_path_lineto:n { \draw_point_polar:nn
{ \l_zassenhaus_pin_distance_tl - \l_zassenhaus_pin_sep_tl } { #4 } }
\draw_path_use_clear:n { stroke }
\hcoffin_set:Nn \l_tmpa_coffin { \footnotesize #3 }
\draw_scope_begin:
\draw_transform_shift:n {
\draw_point_polar:nn { \l_zassenhaus_pin_distance_tl } { #4 }
}
\draw_coffin_use:Nee \l_tmpa_coffin
{ \l_zassenhaus_label_pin_hpole_tl } { \l_zassenhaus_label_pin_vpole_tl }
\draw_scope_end:
\draw_scope_end:
}
\cs_new:Nn \l_zassenhaus_draw_pin:nn {
\draw_begin:
\draw_path_moveto:n { 0cm , 0cm }
\draw_path_lineto:n { \draw_point_polar:nn { \l_zassenhaus_pin_distance_tl } { #2 } }
\draw_path_use_clear:n { stroke }
\hcoffin_set:Nn \l_tmpa_coffin { \footnotesize #1 }
\draw_scope_begin:
\draw_transform_shift:n {
\draw_point_polar:nn { \l_zassenhaus_pin_distance_tl } { #2 }
}
\draw_coffin_use:Nee \l_tmpa_coffin
{ \l_zassenhaus_label_pin_hpole_tl } { \l_zassenhaus_label_pin_vpole_tl }
\draw_scope_end:
\draw_end:
}
\cs_new:Nn \l_zassenhaus_use_node_coordinate:n {
\tl_use:c { l__zassenhaus_draw_node_ #1 _tl }
}
\cs_new:Nn \l_zassenhaus_connect_nodes:n {
\clist_set:Nn \l_tmpa_clist { #1 }
\clist_pop:NN \l_tmpa_clist \l_tmpa_tl
\draw_path_moveto:n { \l_zassenhaus_use_node_coordinate:n { \l_tmpa_tl } }
\clist_map_inline:Nn \l_tmpa_clist {
\draw_path_lineto:n { \l_zassenhaus_use_node_coordinate:n { ##1 } }
}
\draw_path_use_clear:n { stroke }
}
\cs_new:Nn \l_zassenhaus_connect_nodes_doublestruck:nn {
\draw_path_moveto:n { \l_zassenhaus_use_node_coordinate:n { #1 } }
\draw_path_lineto:n { \l_zassenhaus_use_node_coordinate:n { #2 } }
\draw_path_use_clear:n { stroke }
\draw_scope_begin:
\draw_transform_shift:n {
\draw_point_interpolate_line:nnn { 0.5 } {
\l_zassenhaus_use_node_coordinate:n { #1 }
} {
\l_zassenhaus_use_node_coordinate:n { #2 }
}
}
\draw_path_moveto:n { -4pt , 1pt }
\draw_path_lineto:n { 4pt , 1pt }
\draw_path_use_clear:n { stroke }
\draw_path_moveto:n { -4pt , -1pt }
\draw_path_lineto:n { 4pt , -1pt }
\draw_path_use_clear:n { stroke }
\draw_scope_end:
}
\draw_begin:
\l_zassenhaus_set_label_pin_anchor:nn { l } { b }
\l_zassenhaus_draw_node_label:nnnn { Ga } { 0cm , 0.5cm } { $G$ } { 45 }
\l_zassenhaus_set_label_pin_anchor:nn { r } { b }
\l_zassenhaus_draw_node_label:nnnn { Ha } { 3cm , 0.5cm } { $H$ } { 135 }
\l_zassenhaus_set_label_pin_anchor:nn { r } { vc }
\l_zassenhaus_draw_node_label:nnnn { Gb } { 0cm , 0cm } { $G'(G \cap H)$ } { 180 }
\tl_set:Nn \l_zassenhaus_label_distance_tl { 10pt }
\l_zassenhaus_set_label_pin_anchor:nn { hc } { b }
\l_zassenhaus_draw_node_label:nnnn { GHb } { 1.5cm , -1cm } { $G \cap H$ } { 90 }
\tl_set:Nn \l_zassenhaus_label_distance_tl { 5pt }
\l_zassenhaus_set_label_pin_anchor:nn { l } { vc }
\l_zassenhaus_draw_node_label:nnnn { Hb } { 3cm , 0cm } { $(G \cap H)H'$ } { 0 }
\l_zassenhaus_set_label_pin_anchor:nn { r } { vc }
\l_zassenhaus_draw_node_label:nnnn { Gc } { 0cm , -1.5cm } { $G'(G \cap H')$ } { 180 }
\l_zassenhaus_set_label_pin_anchor:nn { hc } { t }
\l_zassenhaus_draw_node_pin:nnnn { GHc } { 1.5cm , -2.5cm } { $(G'\cap H)(G\cap H')$ } { 270 }
\l_zassenhaus_set_label_pin_anchor:nn { l } { vc }
\l_zassenhaus_draw_node_label:nnnn { Hc } { 3cm , -1.5cm } { $(G \cap H')H'$ } { 0 }
\l_zassenhaus_set_label_pin_anchor:nn { r } { vc }
\l_zassenhaus_draw_node_label:nnnn { Gd } { -1cm , -2.25cm } { $G'$ } { 180 }
\l_zassenhaus_set_label_pin_anchor:nn { hc } { t }
\l_zassenhaus_draw_node_label:nnnn { Ge } { 0.5cm , -3.25cm } { $G' \cap H$ } { 270 }
\l_zassenhaus_set_label_pin_anchor:nn { l } { vc }
\l_zassenhaus_draw_node_label:nnnn { Hd } { 4cm , -2.25cm } { $H'$ } { 0 }
\l_zassenhaus_set_label_pin_anchor:nn { hc } { t }
\l_zassenhaus_draw_node_label:nnnn { He } { 2.5cm , -3.25cm } { $G \cap H'$ } { 270 }
\l_zassenhaus_connect_nodes:n { Ga , Gb , GHb , Hb , Ha }
\l_zassenhaus_connect_nodes:n { Gd , Gc , GHc , Hc , Hd , He , GHc , Ge , Gd }
\l_zassenhaus_connect_nodes_doublestruck:nn { Gb } { Gc }
\l_zassenhaus_connect_nodes_doublestruck:nn { Hb } { Hc }
\l_zassenhaus_connect_nodes_doublestruck:nn { GHb } { GHc }
\draw_end:
\ExplSyntaxOff
\end{document}