我想画一个通勤立方体,其中所有边也都标记了。下面是我的立方体,但我不知道该怎么做,因为似乎stackrel
不起作用。
\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[margin= 1.1 in]{geometry}
\usepackage{natbib}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\usetikzlibrary{matrix}
\tikzset{node distance=2cm, auto}
\title{Essays}
\begin{document}
\begin{tikzpicture}[
back line/.style={densely dotted},
cross line/.style={preaction={draw=white, -,
line width=6pt}}]
\matrix (m) [matrix of math nodes,
row sep=3em, column sep=3em,
text height=1.5ex,
text depth=0.25ex]{
& S\left(a,b\right) & & S'\left(a,b\right) \\
S\left(a',b\right) & & S'\left(a',b\right) \\
& S\left(a,b'\right) & & S'\left(a,b'\right) \\
S\left(a',b'\right) & & S'\left(a',b'\right) \\
};
\path[->]
(m-1-2) edge (m-1-4)
edge (m-2-1)
edge [back line] (m-3-2)
(m-1-4) edge (m-3-4)
edge (m-2-3)
(m-2-1) edge [cross line] (m-2-3)
edge (m-4-1)
(m-3-2) edge [back line] (m-3-4)
edge [back line] (m-4-1)
(m-4-1) edge (m-4-3)
(m-3-4) edge (m-4-3)
(m-2-3) edge [cross line] (m-4-3);
\end{tikzpicture}
\end{document}
答案1
总体而言,该tikz-cd
包有助于比tikz
直接绘制交换图更轻松地绘制交换图。以下是基于您的图表的一些代码,旨在说明一些选项:
\documentclass[12pt]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[back line/.style={densely dotted}, row sep=3em, column sep=3em]
& S(a,b) \ar{dl}[swap]{\psi(a',b)} \ar{rr}{\bar{\psi}(a,b)} \ar[back line]{dd}[near end]{\psi(a,b')}
& & S'(a,b) \ar{dd}{\psi'(a,b')} \ar{dl}[swap,sloped,near start]{\psi'(a',b)} \\
S(a',b) \ar[crossing over]{rr}[near start]{\bar{\psi}(a',b)} \ar{dd}[swap]{\psi(a',b')}
& & S'(a',b) \\
& S(a,b') \ar[back line]{rr} \ar[back line]{dl}
& & S'(a,b') \ar{dl} \\
S(a',b') \ar{rr} & & S'(a',b') \ar[crossing over, leftarrow]{uu}
\end{tikzcd}
\end{document}
结果: