Aligning text on edge
Aligning text on edge
I cannot figure out why the text on the edge is not entered. What am I doing wrong?
documentclass[margin=1mm]standalone
usepackagetikz
usetikzlibrarypositioning
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
1 Answer
1
Remove text width
setting:
text width
documentclass[margin=1mm]standalone
usepackagetikz
usetikzlibrarypositioning
begindocument
begintikzpicture
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);
endtikzpicture
enddocument
A 1.5 cm text width is smaller than the width:
@ozsu You're welcome, you can do that, but you need to have the enough length set for
text width
, and the \[-3pt]
won't be needed for line breaking.– jak123
Aug 25 at 14:54
text width
\[-3pt]
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Thank you very much; I thought that would allow the multiple lines, but it is not the case.
– ozsu
Aug 25 at 13:44