我不明白为什么边缘上的文本没有输入。我做错了什么?
\documentclass[margin=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[rectangle,draw,minimum width=1cm, minimum height=1cm] (r1) {};;
\node[rectangle,draw,minimum width=1cm, minimum height=1cm, right=3cm of r1] (r2) {} edge[<-,thick] node[above,text width=1.5cm, align=center] {Asynchronous\\[-3pt]replication} (r1);
\end{tikzpicture}
\end{document}
答案1
删除text width
设置:
\documentclass[margin=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[rectangle,draw,minimum width=1cm, minimum height=1cm] (r1) {};;
\node[rectangle,draw,minimum width=1cm, minimum height=1cm, right=3cm of r1] (r2) {} edge[<-,thick] node[above, align=center] {Asynchronous\\[-3pt]replication} (r1);
\end{tikzpicture}
\end{document}
1.5 厘米的文本宽度小于以下宽度: