![tikzpicture 中的虚线箭头](https://linux22.com/image/355160/tikzpicture%20%E4%B8%AD%E7%9A%84%E8%99%9A%E7%BA%BF%E7%AE%AD%E5%A4%B4.png)
我绘制了以下交换图tikz
(我无法使用,tikz-cd
因为它不在我的 LaTeX 版本上;我试图安装它,但似乎不起作用)
\documentclass[11pt]{beamer}
\usetheme{default}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{tikz-cd}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}
\begin{center}
\begin{tikzpicture}[scale=2]
\node (X) at (1,1){$X$};
\node (A) at (0,0){$A$};
\node (B) at (2,0){$B$};
\node (axb) at (1,0){$A \times B$};
\path[->,font=\scriptsize,>=angle 90]
(axb) edge node[below]{$x_1$} (A)
(axb) edge node[below]{$p_B$} (B)
(X) edge node[above]{$p_A$} (A)
(X) edge node[above]{$p_B$} (B)
(X) edge node[left]{$w$} (axb);
\end{tikzpicture}
\end{center}
我需要让 w 箭头呈虚线,我该怎么做?
答案1
编辑:
虚线已解决阿博阿马尔在我回答之前稍微评论一下...所以我添加了一些主题问题。使用该库,\quotes
您可以使您的代码更简洁,还可以更好地定位边缘标签:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[scale=2]
\node (X) at (1,1){$X$};
\node (A) at (0,0){$A$};
\node (B) at (2,0){$B$};
\node (axb) at (1,0){$A \times B$};
\path[-angle 90,font=\scriptsize]
(axb) edge ["$x_1$"] (A)
(axb) edge ["$p_B$" '] (B)
(X) edge edge ["$p_A$" '] (A)
(X) edge ["$p_B$"] (B)
(X) edge[dotted,% <-- added
"$w$" '] (axb);
\end{tikzpicture}
\end{document}