使用 Feynmp 在 LaTeXiT 中创建费曼图

使用 Feynmp 在 LaTeXiT 中创建费曼图

我想使用 LaTeXiT 创建费曼图。我已按照此处的说明操作http://osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/feynmp.html安装 feynmp 和此处的说明http://osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/feynmp_latexit.html设置 LaTeXiT 来生成费曼图,但是当我运行序言时:

\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths%\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{feynmp}

以及代码:

\begin{fmffile}{feyngraph}
  \begin{fmfgraph}(110,60)
    \fmfleft{i1,i2}
    \fmfright{o1,o2}
    \fmf{fermion}{i1,v1,o1}
    \fmf{fermion}{i2,v2,o2}
    \fmf{photon}{v1,v2}
  \end{fmfgraph}
\end{fmffile}

我得到一张空白图片作为输出。没有错误,只是没有图片。我正在使用 LaTeXiT 版本 2.13.2 的 MacOS Catalina 上工作。有人能告诉我让它工作的最佳方法吗?

答案1

我没有使用特定的设置,但 fenymp 包不会尝试为您运行 mpost,您的构建系统应该将此作为流程的一部分执行,并且需要检测是否已创建或更新 .mp,因此它也应该运行该步骤。

如果您确实希望主构建运行 mpost,另一个选项是使用 feynmp-auto 包,该包随后会为您运行 mpost(此时 --shell-escape 变得相关,如问题评论中所述)。您的构建系统仍需要注意到某些输入已更改并重新运行构建,否则您将需要重新运行构建。

答案2

根据以上答案中的信息

% !TEX program = pdflatexmk
% !TEX parameter = -shell-escape 
% !TEX encoding = UTF-8 Unicode
\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
\usepackage{amssymb} %maths%\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{feynmp-auto}
\begin{document}
\begin{fmffile}{feyngraph}
  \begin{fmfgraph}(110,60)
    \fmfleft{i1,i2}
    \fmfright{o1,o2}
    \fmf{fermion}{i1,v1,o1}
    \fmf{fermion}{i2,v2,o2}
    \fmf{photon}{v1,v2}
  \end{fmfgraph}
\end{fmffile}
\end{document}

在 TeXShop 中可以正常工作。使用的 pdflatexmk 引擎将自动进行第二次 pdflatex 运行,并注意使用 feynmp-auto 包进行 mpost 运行。

答案3

修改上述 Herb Schulz 的回答后,我发现 LaTeXiT 中有以下作品:序言:

\documentclass[10pt]{article}
\usepackage[usenames]{color} %used for font color
% !TEX program = pdflatexmk
\usepackage{amssymb} %maths
\usepackage{amsmath} %maths
\usepackage[utf8]{inputenc} %useful to type directly diacritic characters
\usepackage{feynmp-auto}

数字:

\begin{fmffile}{feyngraph}
  \begin{fmfgraph}(110,60)
    \fmfleft{i1,i2}
    \fmfright{o1,o2}
    \fmf{fermion}{i1,v1,o1}
    \fmf{fermion}{i2,v2,o2}
    \fmf{photon}{v1,v2}
  \end{fmfgraph}
\end{fmffile}

答案4

此处提出的解决方案均不feynmp-auto适用于 LaTeXiT 2.14.5。结果发现在 macOS Mojave (10.14.6) 上更新 TeX Live 时出现了问题。我不得不安装一个单独的 GhostScript 版本,例如参见此主题之后我跟着Taku Yamanaka 的常规指示dvipdf,并更新了、gs和首选项 > 排版 > 行为 下的路径ps2pdf,这三个路径均可从 获得/usr/local/Cellar/ghostscript/9.54.0/bin/

相关内容