替换复杂交换图的箭头

替换复杂交换图的箭头

我有以下复杂的五边形图:

\begin{tikzpicture}[column sep=large, row sep=large]
\node(P0) at (90:2.6cm){$h(g(fe))$};
\node(P1) at (90+72:2.5cm){$h((gf)e)$} ;
\node(P2) at (90+2*72:2.5cm){\makebox[5ex][r]{$(h(gf))e$}};
\node(P3) at (90+3*72:2.5cm){\makebox[5ex][l]{$((hg)f)e$}};
\node(P4) at (90+4*72:2.5cm){$(hg)(fe)$};

\path[commutative diagrams/.cd,every arrow,every label]
(P0) edgenode [swap] {$\operatorname{id}_h,\alpha_{(e,f,g)}$} (P1)
(P1) edgenode [swap] {$\alpha_{(e,gf,h)}$} (P2)
(P2) edgenode [swap] {$\alpha_{(f,g,h)}, \operatorname{id}_e$} (P3)
(P4) edgenode {$\alpha_{(hg,f,e)}$} (P3)
(P0) edgenode {$\alpha_{(fe, g,h)}$} (P4);
\end{tikzpicture}

现在我想用 $\Rightarrow$ 替换此图中的每个箭头 $\rightarrow$。最简单的方法是什么?

答案1

使用

every edge/.append style={/tikz/commutative diagrams/Rightarrow},

如同

\documentclass[tikz,border=3mm]{standalone}
\usepackage{amsmath}
\usetikzlibrary{cd}
\begin{document}
\begin{tikzpicture}
\node(P0) at (90:2.6cm){$h(g(fe))$};
\node(P1) at (90+72:2.5cm){$h((gf)e)$} ;
\node(P2) at (90+2*72:2.5cm){\makebox[5ex][r]{$(h(gf))e$}};
\node(P3) at (90+3*72:2.5cm){\makebox[5ex][l]{$((hg)f)e$}};
\node(P4) at (90+4*72:2.5cm){$(hg)(fe)$};

\path[every edge/.append style={/tikz/commutative diagrams/Rightarrow},
    commutative diagrams/.cd,every arrow,every label]
(P0) edgenode [swap] {$\operatorname{id}_h,\alpha_{(e,f,g)}$} (P1)
(P1) edgenode [swap] {$\alpha_{(e,gf,h)}$} (P2)
(P2) edgenode [swap] {$\alpha_{(f,g,h)}, \operatorname{id}_e$} (P3)
(P4) edgenode {$\alpha_{(hg,f,e)}$} (P3)
(P0) edgenode {$\alpha_{(fe, g,h)}$} (P4);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

直接使用即可tikzcd,输入更加简单。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzcd}[arrows=Rightarrow]
\node(P0) at (90:2.6cm){h(g(fe))};
\node(P1) at (90+72:2.5cm){h((gf)e)} ;
\node(P2) at (90+2*72:2.5cm){\makebox[5ex][r]{$(h(gf))e$}};
\node(P3) at (90+3*72:2.5cm){\makebox[5ex][l]{$((hg)f)e$}};
\node(P4) at (90+4*72:2.5cm){(hg)(fe)};

\arrow[from=P0,to=P1,"{\operatorname{id}_h,\alpha_{(e,f,g)}}"']
\arrow[from=P1,to=P2,"{\alpha_{(e,gf,h)}}"']
\arrow[from=P2,to=P3,"{\alpha_{(f,g,h)}, \operatorname{id}_e}"']
\arrow[from=P4,to=P3,"{\alpha_{(hg,f,e)}}"]
\arrow[from=P0,to=P4,"{\alpha_{(fe, g,h)}}"]
\end{tikzcd}

\end{document}

在此处输入图片描述

相关内容