我需要使用 xypics 表示如下图所示的图形。它们以有限半群(特别是有限左正则带)的格林序哈斯图的形式出现,其支撑格具有同态性。我知道如何绘制线条和放置点的基本知识,但我不知道如何围绕大量点绘制椭圆形,如下图所示。另外,我宁愿它们不是椭圆形。
感谢您的时间!
答案1
可以使用,但ellipse
最好使用rectangle
和。rounded corners
fit
\documentclass[11pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}[y=1.5cm,
every fit/.style={inner sep=4mm,orange,dashed,rounded corners=4mm,draw,line width=0.6mm}]
\path (3,8) coordinate (s0)
(1,6) coordinate (s1) (5,6) coordinate (s2)
(1,4) coordinate (s3) (3,4) coordinate (s4) (5,4) coordinate (s5)
(0,2) coordinate (s6) (1,2) coordinate (s7) (2,2) coordinate (s8) (3,1.5) coordinate (s9)
(4,2.5) coordinate (s10) (6,2) coordinate (s11);
\node[fit=(s0)] (f1){}; \node[fit=(s1)(s2)](f2){}; \node[fit=(s3)(s5)](f3){};
\node[fit=(s6)(s9)(s10)(s11)](f4){};
\node[right] at (f1.east) {$A$}; \node[right] at (f2.east) {$B$}; \node[right] at (f3.east) {$C$};
\node[right] at (f4.east) {$D$};
\draw[thick] (s0) -- (s1) -- (s3) -- (s6)
(s1) -- (s4) -- (s7) (s4) -- (s8) (s4) -- (s9)
(s0) -- (s2) -- (s5) -- (s11)
(s5) -- (s10);
\draw[thick,double=black,draw=white] (s2) -- (s3) (s2) to[out=-100 ,in=10] (s6);
\foreach \i in {0,...,11} \draw[fill=blue!40] (s\i) circle (2pt);
\draw[->] (6,5) -- node [above]{$\theta$} (8,5);
\path (9,8) coordinate (t0)
(9,6) coordinate (t1)
(9,4) coordinate (t2)
(9,2) coordinate (t3) ;
\draw[thick] (t0) -- (t1) -- (t2) -- (t3);
\foreach \i in {0,...,3} \draw[fill=red!40] (t\i) circle (2pt);
\end{tikzpicture}
\end{document}
答案2
使用xy-pic正如您所标记的。
代码:
\documentclass[border=8]{standalone}
\usepackage[all]{xy}
\begin{document}
\xymatrix{
&&& *=0{\xy(-3,-4);(5,4) **\frm<44pt>{.}\endxy \bullet} \ar@{-}[dl] \ar@{-}[dr] & \ar@{}[l]_{A} &&&&*=0{\bullet} \ar@{-}[d] \\
&& *=0{\xy(-2,-2);(24,2) **\frm<44pt>{.}\endxy \bullet} \ar@{-}[dr] |!{[d];[rr]}\hole \ar@{-}[d]
&& *=0{\bullet} \ar@/^1.7pc/@{}[dddlll] \ar@{-}[dll] & \ar@{}[l]_{B} &&&*=0{\bullet} \ar@{-}[d] \\
&& *=0{\xy(-2,-2);(24,2) **\frm<44pt>{.}\endxy \bullet} \ar@{-}[ddl] & *=0{\bullet} \ar@{-}[ddl] |!{[dd];[lll]}\hole \ar@{-}[dd] |\hole \ar@{-}[ddr] |!{[dd];[uur]}\hole & *=0{\bullet} \ar@{-}[ddr] \ar@{-}[ddrr] & \ar@{}[l]_{C} & \ar@(r,l)[r]_{\theta} &&*=0{\bullet}\ar@{-}[dd]\\
& *=0{}\\
& *=0{\xy(-2,-2);(56,2) **\frm<44pt>{.}\endxy \bullet} & *=0{\bullet} & *=0{\bullet} & *=0{\bullet} & *=0{\bullet} & *=0{\bullet} & \ar@{}[l]_>>>>>{D} &*=0{\bullet}\\
}
\end{document}
输出:
答案3
Asymptote
使用非常自然的方法来构建这种图表,请参阅下面的代码。此图表是通过或多或少的手动定位调整构建的,但如果有必要,它可以更加自动化。
gr.tex
:
\documentclass[10pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage[inline]{asymptote}
\begin{document}
\begin{figure}
\begin{asy}
unitsize(12mm);
pair d=(1,1.3); // next level offset
pair dout=(0.2,0.2); // offset for the outline
pair[] A={(0,0)};
pair[] B={
(-d.x,-d.y),(d.x,-d.y)
};
pair[] C={
(-d.x,-2d.y),(0,-2d.y),(d.x,-2d.y)
};
pair[] D={
(-1.5d.x,-3d.y),
( -d.x,-3d.y),
(-0.4d.x,-3d.y),
( 0,-3d.y-0.2d.y),
( 0.2d.x,-3d.y+0.2d.y),
( 1.2d.x,-3d.y),
};
real qx=2.5d.x;
pair[] q={
(qx,A[0].y),
(qx,B[0].y),
(qx,C[0].y),
(qx,D[0].y),
};
pen dashed=linetype(new real[] {4,3}); // set up dashed pattern
real pw=0.8pt;
real gapw=3pw;
pen lpen=darkblue+pw;
pen dpen=orange+dashed+pw;
void Dot(pair v, pen p=currentpen){
dot(v,p,UnFill);
}
void Dots(pair[] P){
for(int i=0;i<P.length;++i){
Dot(P[i]);
}
}
void outline(pair[] v,pair dout=(0.2,0.2), string s="",pen p=dpen){
pair l=v[0], r=v[v.length-1];
pair c=0.5(l+r);
guide g=
(r+(dout.x,0))
..(r+(0,dout.y))
--(l+(0,dout.y))
..(l+(-dout.x,0))
..(l+(0,-dout.y))
--(r+(0,-dout.y))
..cycle
;
draw(g,p);
label(s,r+dout,NE);
}
outline(A,"$A$");
outline(B,"$B$");
outline(C,"$C$");
outline(D,dout=(0.2,0.5),"$D$");
draw(B[0]--A[0]--B[1],lpen);
draw(C[0]--B[0]--C[1],lpen);
draw(C[0]--B[1],white+gapw);
draw(C[0]--B[1]--C[2],lpen);
draw(C[0]--D[0],lpen);
draw(C[1]--D[1],lpen);
draw(C[1]--D[2],lpen);
draw(C[1]--D[3],lpen);
draw(C[2]--D[4],lpen);
draw(C[2]--D[5],lpen);
guide g=B[1]..0.5(C[1]+C[2])..D[0];
draw(subpath(g,1,2),white+gapw);
draw(g,lpen);
draw(q[0]--q[1]--q[2]--q[3],lpen);
for(int i=0;i<q.length;++i){
fill(circle(q[i],0.1),white);
}
Dots(A);Dots(B);Dots(C);Dots(D);Dots(q);
pair rarrowCenter=0.5(B[0]+C[0])+(3d.x,0);
label("$\theta \atop \longrightarrow$",rarrowCenter);
\end{asy}
%
\hsize8cm
\caption{Graph}
\end{figure}
\end{document}
为了处理它latexmk
,请创建文件latexmkrc
:
sub asy {return system("asy '$_[0]'");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");
然后运行latexmk -pdf gr.tex
。
或者您可以将内容保存在文件\begin{asy}
\end{asy}
中g.asy
,运行asy -f pdf g.asy
并获取独立的文件g.pdf
,可以将其作为图形文件包含在内。
答案4
这是我在 TikZ 中尝试的一个非常基本的示例。我安装的 Tikz 不知道ellipse
拟合的密钥,但如上所述,最近的安装应该知道它。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}
\node at (0,0) (a) {o};
\node at (-0.5,-1) (b1) {o};
\node at (0.5,-1) (b2) {o};
\draw [->] (a) -- (b1);
\draw [->] (a) -- (b2);
\node at (-0.75,-2) (c1) {o};
\node at (0,-2) (c2) {o};
\node at (0.75,-2) (c3) {o};
\draw [->] (b1) -- (c1);
\draw [->] (b1) -- (c2);
\draw [->] (b2) -- (c1);
\draw [->] (b2) -- (c3);
\node at (-1,-3) (d1) {o};
\node at (-0.5,-3) (d2) {o};
\node at (0,-3) (d3) {o};
\node at (0.25,-2.75) (d4) {o};
\node at (0.5,-3.25) (d5) {o};
\node at (1,-3) (d6) {o};
\draw [->] (c1) -- (d1);
\draw [->] (b2) to[out=-120,in=60] (d1);
\draw [->] (c2) -- (d2);
\draw [->] (c2) -- (d3);
\draw [->] (c2) -- (d4);
\draw [->] (c3) -- (d5);
\draw [->] (c3) -- (d6);
\node [draw=red,fit=(a),label=0:A] {};
\node [draw=blue,fit=(b1) (b2),label=0:B] {};
\node [draw=green,fit=(c1) (c2) (c3),label=0:C] (C) {};
\node [draw=cyan,fit=(d1) (d2) (d3) (d4) (d5) (d6),label=0:D] (D) {};
\node at (3,0) (e) {o};
\node at (3,-1) (f) {o};
\node at (3,-2) (g) {o};
\node at (3,-3) (h) {o};
\draw [->] (e) -- (f);
\draw [->] (f) -- (g);
\draw [->] (g) -- (h);
\draw [->] (2,-2) -- (2.5,-2) node [midway,above] {\(\theta\)};
\end{tikzpicture}
\end{document}