Text wrapping with dot (graphviz)

前端 未结 2 1637
一整个雨季
一整个雨季 2021-02-05 00:42

I used the code below to create a graphic using dot (graphviz).

digraph
{
  node [color=Blue,shape=box]

  1.1 [label=\"Frequency of t exceeds upper threshold\"]         


        
2条回答
  •  清歌不尽
    2021-02-05 00:55

    Although graphviz does not support text wrapping by itself, dot2tex (latex+graphviz) does. The dot2texi latex package gives an all-in-one solution, with (from the users point of view) a single call to a single tool to build the graph.

    A short example:

    \documentclass{standalone}
    \usepackage{dot2texi}
    \usepackage{tikz}
    \usetikzlibrary{shapes,arrows}
    \begin{document}
    \begin{dot2tex}[dot]
    digraph G {                                             
    d2toptions ="--autosize"
    node    [lblstyle="text width=10em,align=center"]
    a       [texlbl="This text will be automatically wrapped, for example at a fixed width."]
    b       [texlbl="Manual linebreaks from past century can be avoided!"]
    a -> b
    }
    \end{dot2tex}                                               
    \end{document}
    

    This can be compiled invoking for example: pdflatex --shell-escape myFile.tex, the text will be automatically wrapped at the prescribed fixed width.

    As a side note, this tool seems a handy workaround for graphviz' limited typesetting control of the nodes contents.

提交回复
热议问题