有人能帮我让这个交换图看起来更美观吗?
% compile with LaTeX
\documentclass{article}
\usepackage{pictexwd,dcpic}
\begin{document}
\begindc{\commdiag}[500]
\obj(0,0){$F(V)$}
\obj(2,0){$F(W)$}
\obj(-1,1){$F'(U_1)$}
\obj(3,1){$F'(U_3)$}
\obj(1,2){$F'(U_2)$}
\mor(-1,1)(1,2){}
\mor(-1,1)(3,1){}
\mor(-1,1)(0,0){}
\mor(-1,1)(2,0){}
\mor(3,1)(2,0){}
\mor(1,2)(0,0){}
\mor(1,2)(2,0){}
\mor(1,2)(3,1){}
\mor(3,1)(0,0){}
\mor(3,1)(2,0){}
\mor(0,0)(2,0){}
\enddc
\end{document}
答案1
下面的示例通过具有正五边形多边形形状的节点设置五角星的角:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\node[
regular polygon,
regular polygon sides=5,
minimum width=30mm,
] (PG) {}
(PG.corner 1) node (PG1) {$F'(U_2)$}
(PG.corner 2) node (PG2) {$F'(U_1)$}
(PG.corner 3) node (PG3) {$F(V)$}
(PG.corner 4) node (PG4) {$F(W)$}
(PG.corner 5) node (PG5) {$F'(U_3)$}
;
\foreach \S/\E in {
1/3, 1/4, 1/5,
2/1, 2/3, 2/4, 2/5,
3/4,
5/3, 5/4%
} {
\draw[->] (PG\S) -- (PG\E);
}
\end{tikzpicture}
\end{document}
可以通过指定以下项来降低高度yscale
:
\node[..., yscale=.75] (PG) {}
线条
(PG.corner 1) node (PG1) {$F'(U_2)$}
...
(PG.corner 5) node (PG5) {$F'(U_3)$}
也可以写成:
\foreach \t [count=\i] in {F'(U_2), F'(U_1), F(V), F(W), F'(U_3)} {
(PG.corner \i) node (PG\i) {$\t$}
}
答案2
我只能提供两个解决方案tikz-cd:
% arara: pdflatex
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\newlength{\edgelentgh}
\setlength{\edgelentgh}{3cm}
\[
\begin{tikzcd}[row sep={0cm,between origins},column sep={0cm,between origins}] % setting seperators to zero for easier manipulation
&[.3090169944\edgelentgh]
&[.5\edgelentgh] % above value times golden ratio
F'(U_2)\arrow{ddl}\arrow{ddr}\arrow{drr}
&[.5\edgelentgh]
&[.3090169944\edgelentgh]
\\[.5877852523\edgelentgh]
F'(U_1)\arrow{urr}\arrow{rrrr}\arrow{dr}\arrow{drrr}
&&&&
F'(U_3) \arrow{dlll}\arrow{dl}
\\[.9510565163\edgelentgh] % above value times golden ratio
&
F(V)\arrow{rr}
&&
F(W)
&
\end{tikzcd}
\]
% This example is given in the tikz-cd manual:
\begin{tikzpicture}[commutative diagrams/every diagram]
\node (P0) at (90:.8506508084\edgelentgh) {$F'(U_2)$};
\node (P1) at (90+72:.8506508084\edgelentgh) {$F'(U_1)$} ;
\node (P2) at (90+2*72:.8506508084\edgelentgh) {$F(V)$};
\node (P3) at (90+3*72:.8506508084\edgelentgh) {$F(W)$};
\node (P4) at (90+4*72:.8506508084\edgelentgh) {$F'(U_3)$};
%
\path[commutative diagrams/.cd, every arrow, every label]
(P0) -- (P4) edge (P3)
(P0) edge (P3)
(P0) edge (P2)
(P1) edge (P0)
(P1) edge (P4)
(P1) edge (P3)
(P1) -- (P2) edge (P3)
(P4) edge (P2);
\end{tikzpicture}
\end{document}
答案3
AMetaPost解决方案使用boxes
包,包含在LuaLaTeX程序中,以便于排版。
不同的节点通过这个link
宏链接起来:
def link(suffix a, b) =
drawarrow a.c -- b.c cutbefore bpath a cutafter bpath b
enddef;
正如其语法所示,在绘制实际箭头之前,它会删除第一个节点边界之前和第二个节点边界之后的线的部分。
\documentclass[border=2mm]{standalone}
\usepackage{luamplib}
\mplibtextextlabel{enable}
\everymplib{input boxes;
def link(suffix a, b) =
drawarrow a.c -- b.c cutbefore bpath a cutafter bpath b
enddef;
beginfig(1);}
\everyendmplib{endfig;}
\begin{document}
\begin{mplibcode}
u := 1.75cm;
boxit.fv("$F(V)$"); fv.c = origin;
boxit.fw("$F(W)$"); fw.c = (2u, 0);
boxit.fpu1("$F'(U_1)$"); fpu1.c = (-u, u);
boxit.fpu2("$F'(U_2)$"); fpu2.c = (u, 2u);
boxit.fpu3("$F'(U_3)$"); fpu3.c = (3u, u);
drawunboxed(fv, fw, fpu1, fpu2, fpu3);
forsuffixes a = fv, fw, fpu3, fpu2: link(fpu1, a); endfor
forsuffixes a = fv, fw, fpu3: link(fpu2, a); endfor
link(fv, fw); link(fpu3, fv); link(fpu3, fw);
\end{mplibcode}
\end{document}
输出:
答案4
并且仅在普通的 Metapost 中,就有漂亮的线条交叉。
我切换F(V)
了F(W)
以使循环更简单。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
numeric R; R = 120;
picture t[];
t1=thelabel(btex $F'(U_1)$ etex, (0,R) rotated 72);
t2=thelabel(btex $F'(U_2)$ etex, (0,R));
t3=thelabel(btex $F'(U_3)$ etex, (0,R) rotated -72);
t4=thelabel(btex $F(V)$ etex, (0,R) rotated -144);
t5=thelabel(btex $F(W)$ etex, (0,R) rotated +144);
path arc;
bboxmargin := 5;
for i=1 upto 5:
draw t[i];
for j=i+1 upto 5:
arc := center t[i] -- center t[j]
cutbefore bbox t[i] cutafter bbox t[j];
undraw arc withpen pencircle scaled 4;
drawarrow arc;
endfor
endfor
endfig;
end.