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



enter image description here




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



enter image description here



A 1.5 cm text width is smaller than the width:



enter image description here





Thank you very much; I thought that would allow the multiple lines, but it is not the case.
– ozsu
Aug 25 at 13:44





@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.

Popular posts from this blog

Greenpeace

.name

Thomas Howard, 21st Earl of Arundel