Dear Dmitrii, dear list,
Following Dmitrii hints, I tried latex(H). It turns out that the curved
edges are a feature, not a bug (a better look at the GraphLatex page showed
me explicit documentation about this). This design choice seems embedded in
the source code for latex generation of directed graphs, and there exist
(currently) no option for changing it (no sage-settable parameter for
edge_style and arrowheads). Too bad the result is ugly as sin...
I could hack a new style for DiGraphs. I could also hack the code and make
these parameters tunable. Both of these options are lengthy, and my
RealLife(TM) constraints make them a bit difficult. It seems faster to
either a) hack convenient parameters to ....DiGraph.plot and generate a PDF
or b) directly generate tikz code from the graph specifications.
This bit of ad-hockery is probably the only way I can cope with my current
problem. Bit I think a better solution would be to rewrite (part of) the
GraphLatex specification to give them more degree of freedom.
Looking at the Trac tickets for this subject hnted that such a task is
probably not easy. So I won't, for now, create new ticket. I'll have to
look first at the source code for GraphLatex (wich I haven't yet located,
shame on me...).
Emmanuel
Charpentier
BTW : tex.stackexchange.com gave me few hints about this problem : people
here tend to hack their solutions directly in \LaTeX, or even in plain \TeX
(God forbid...).
Le lundi 17 juin 2013 22:03:32 UTC+2, Dima Pasechnik a écrit :
>
> On 2013-06-17, Emmanuel Charpentier <[email protected] <javascript:>>
> wrote:
> > ------=_Part_260_31328394.1371497392901
> > Content-Type: text/plain; charset=ISO-8859-1
> >
> > Dear list,
> >
> > I am trying to render a *directed* graph with LaTeX and tikz. I'ts a
> > Bayesian network based on some causal reasoning (hence the necessity for
> a
> > directed graph), but I'll reduce my problem to a simple test case.
> >
> > The following code :
> >
> > var("a", latex_name="\mathrm{a}")
> > var("b", latex_name="\mathrm{b}")
> > var("c", latex_name="\mathrm{c}")
> > var("d", latex_name="\mathrm{d}")
> > var("e", latex_name="\mathrm{e}")
> > H=DiGraph({a:{b:'$\\beta_{a,b}$',c:'$\\beta_{a,c}$',d:'$\\beta_{a,d}$'},
> > c:{e:'$\\beta_{c,e}$'}})
> > H.set_pos(H.layout_acyclic())
> > H.set_latex_options(tkz_style="Custom", graphic_size=(4,4),
> > vertex_size=0.5, vertex_labels=True, edge_labels=True,
> > edge_label_sloped=False)
> > view(H)
> >
> > gives me *almost* what I want (drag-and-drop from a notebook] :
> >
> >
> > The graph has the desired layout, the markup (vertices and edges) is
> > correct. But, for reasons I haven't be able to fathom, edges are
> rendered
> > as circle arcs (about pi/6). It is not especially good in my test case,
> and
> > makes my full graph positively awful...
> >
> > Trying to use another style of graph makes me lose [a) edge markup
> and/or
> > b) vertex markup], and c) arrow heads. Looking in the documentation
> about
> > arrow heads gave no clue. Trying to specify latex parameters for edges
> and
> > vertices has no point, since these setups are forgotten by the new style
> > (and yes, I tried to use two set_latex_options instructions : same
> results
> > in both orders...).
> >
> > Any hint ?
> Your subject says that you narrowed down the problem to LaTeX/tikz. If
> so, try a forum frequented by tikz wizards,
> e.g. http://tex.stackexchange.com/
>
> Anyhow, I'd try to use sagetex to draw your graph, generating LaTeX file
> along
> the way. Maybe then it would be more clear how to tweak the drawing.
>
> HTH,
> Dmitrii
>
>
>
> >
> > Emmanuel Charpentier
> >
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.