Skip to content

Commit 8577496

Browse files
committed
better edges for texmode=raw & format=tikz
1 parent 846e9cb commit 8577496

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ dist/*
3232
venv/*
3333
.idea/*
3434

35+
!*.py

dot2tex/__main__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .dot2tex import main
2+
3+
if __name__ == '__main__':
4+
main()

dot2tex/base.py

+3
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def do_draw_op(self, drawoperations, drawobj, stat, texlbl_name="texlbl", use_dr
386386
text = drawop[5]
387387
# head and tail label
388388
texmode = self.options.get('texmode', 'verbatim')
389+
label = text = drawobj.attr.get('label', '')
389390
if drawobj.attr.get('texmode', ''):
390391
texmode = drawobj.attr['texmode']
391392
if texlbl_name in drawobj.attr:
@@ -398,6 +399,8 @@ def do_draw_op(self, drawoperations, drawobj, stat, texlbl_name="texlbl", use_dr
398399
elif texmode == 'math':
399400
# math mode
400401
text = "$%s$" % text
402+
elif label and len(drawoperations) == 1:
403+
text = label
401404

402405
drawop[5] = text
403406
if self.options.get('alignstr', ''):

dot2tex/dot2tex.py

-3
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,3 @@ def convert_graph(dotsource, **kwargs):
498498
tex = main(True, dotsource, options)
499499
return tex
500500

501-
502-
if __name__ == '__main__':
503-
main()

0 commit comments

Comments
 (0)