【发布时间】:2020-10-27 16:54:29
【问题描述】:
我有这样一个graphviz dot 文件test.dot,包含一个带有TABLE 标签的节点:
digraph {
node [shape=none, fontname="Courier New, Courier"]
edge [fontname="Courier New, Courier"]
graph [fontname="Courier New, Courier"]
id2765 [label=<<TABLE CELLBORDER="1" CELLSPACING="0" BORDER="0">
<TR><TD PORT="cell756">literal</TD><TD PORT="cell757" ALIGN="LEFT">"""--- multiple line string literal with unicode ---
here we begin with some comments \\u0020 \\U00000000 \\u1234 \\u20AC \\U00008000:
multiple string literal begins and ends with triple quotes \\"\\"\\",
then newline are enabled in it.
here we test back slask \\r\\n \\' \\" \\? \\a \\b \\f \\n \\r \\t \\v \\\\.
"""</TD></TR>
</TABLE>>]
}
请注意我希望节点包含多行文本文字:
"""--- multiple line string literal with unicode ---
here we begin with some comments \\u0020 \\U00000000 \\u1234 \\u20AC \\U00008000:
multiple string literal begins and ends with triple quotes \\"\\"\\",
then newline are enabled in it.
here we test back slask \\r\\n \\' \\" \\? \\a \\b \\f \\n \\r \\t \\v \\\\.
"""
用dot -Tpng test.dot -o test.dot.png编译,它的输出:
您可以看到文本文字中没有换行。所以我用ALIGN="LEFT"和<BR/>更新了test.dot:
digraph {
node [shape=none, fontname="Courier New, Courier"]
edge [fontname="Courier New, Courier"]
graph [fontname="Courier New, Courier"]
id2765 [label=<<TABLE CELLBORDER="1" CELLSPACING="0" BORDER="0">
<TR><TD PORT="cell756">literal</TD><TD PORT="cell757" ALIGN="LEFT">"""--- multiple line string literal with unicode ---<BR/>here we begin with some comments \\u0020 \\U00000000 \\u1234 \\u20AC \\U00008000:<BR/> multiple string literal begins and ends with triple quotes \\"\\"\\",<BR/> then newline are enabled in it.<BR/> here we test back slask \\r\\n \\' \\" \\? \\a \\b \\f \\n \\r \\t \\v \\\\.<BR/> """</TD></TR>
</TABLE>>]
}
再次编译,它的输出:
有新的换行符,但文本居中对齐,而我想左对齐。
如何在graphviz点节点的TABLE标签中左对齐多行文本文字?
【问题讨论】: