Lets say we've generated some diagrams, like so:
SetOptions[$Output, PageWidth -> 65]; $HistoryLength = 2; Get["alibrary.m"]; Get[$Apath <> "/amodel-qcd.m"]; diagrams = Diagrams[{"A"}, {"A"}, 2];
Normally the diagrams would now be passed into Amplitude to apply Feyman rules to them; there are however two reasons to additionally convert them into a viewable form: to debug the Feynman rules and to prepare publications.
There are two ways to view the obtained diagrams. One way is by
producing .dot
files for them, using graphviz
to convert
those into PDFs, and importing the PDFs into Mathematica.
This achieves a quick and dirty view of the diagram, suitable
for debugging:
diagrams // Map[DiagramViz]
Note that the result of DiagramViz is a Graphics[]
object, and the Mathematica GUI frontend is needed to see
it.
The other objective is to prepare publication-quality LaTeX
renderings of the diagrams. To that end, we have found it best
to use the TikZ library in combination with the TikZiT
editor. To use this combination, first export any diagram to
a .tikz
(LaTeX) file:
MkFile["diagram.tikz", DiagramToTikZ[diagrams[[1]]]];
Then edit it with TikZiT by running tikzit diagram.tikz
.
Make sure to load the all.tiksztyles
style file that comes
with alibrary to be able to preview the diagrams insize TikZiT.
Once you're done, you can include diagram.tikz
into any
LaTeX source (in text or in a formula) to get a picture of
the diagram. A minimal example would be:
\documentclass{article} \input{all.tikzdefs} \input{all.tikzstyles} \begin{document} \input{diagram.tikz} \end{document}
Note that both all.tikzdefs
and all.tikzstyles
are required
for this to work.
The result might looks like this: