From fa45645fdad403ae78fef2f3ad79f913472139c8 Mon Sep 17 00:00:00 2001 From: Alexander Puck Neuwirth Date: Wed, 5 Jul 2023 14:44:03 +0200 Subject: [PATCH] Still needs feynml bump --- .gitignore | 1 + pyfeyn2/render/latex/tikzfeynman.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 40d3cb9db..982941071 100644 --- a/.gitignore +++ b/.gitignore @@ -152,3 +152,4 @@ tmp.tex tests/out.pdf .vscode/* +tmp-* diff --git a/pyfeyn2/render/latex/tikzfeynman.py b/pyfeyn2/render/latex/tikzfeynman.py index 26adf4073..15405add4 100644 --- a/pyfeyn2/render/latex/tikzfeynman.py +++ b/pyfeyn2/render/latex/tikzfeynman.py @@ -2,10 +2,13 @@ from typing import List from warnings import warn +from feynml.connector import Connector +from feynml.feynmandiagram import FeynmanDiagram +from feynml.leg import Leg +from feynml.vertex import Vertex from pylatex import Command from pylatex.utils import NoEscape -from pyfeyn2.feynmandiagram import Connector, FeynmanDiagram, Leg, Vertex from pyfeyn2.render.latex.latex import LatexRender # converte FeynmanDiagram to tikz-feynman @@ -56,7 +59,13 @@ def stylize_connect(fd: FeynmanDiagram, c: Connector): if style.getProperty("line") is not None: ret += type_map[style.getProperty("line").value] else: - ret += type_map[c.type] # fallback to type if no style + if c.type is not None: + ret += type_map[c.type] # fallback to type if no style + else: + warnings.warn( + f"No type or style set for connector {c.id} {c.type} {c.pdgid}" + ) + ret += "plain" if c.label is not None: ret += ",edge label=" + c.label