feynman icon indicating copy to clipboard operation
feynman copied to clipboard

tex export fails to compile with negative sign

Open ExarchD opened this issue 8 years ago • 8 comments

It seems that negative signs are not friendly in the latex export for labelDistance and labelLocation:

\begin{feynman} 
    \gluon[label=$g$, labelDistance=-0.30, labelLocation=1.20]{2.20, 2.20}{0.20, 4.20}
    \gluon[label=$g$, labelDistance=0.60, labelLocation=-0.10]{0.20, 0.20}{2.20, 2.20}
    \gluon[color=000000, label=$g$]{2.20, 2.20}{5.20, 2.20}
    \fermion[label=$\anti{t}$, labelDistance=0.00, labelLocation=-0.14]{7.20, 4.20}{5.20, 2.20}
    \fermion[label=$t$, showArrow=true, flip=false, labelDistance=0.30, labelLocation=1.00]{5.20, 2.20}{7.20, 0.20}
\end{feynman}

Adding parentheses around the negative values fixed the problem for me.

ExarchD avatar Jul 28 '17 22:07 ExarchD

Sorry I guess I was hasty. There are a few issues I hit with this code, and I don't think its the negative sign. Here's the error it outputs:

!FP error: UPN stack is empty!.
\FP@errmessage #1->\errmessage {FP error: #1!} 
l.15 ...abelLocation=1.20]{2.20, 2.20}{0.20, 4.20}

ExarchD avatar Jul 28 '17 22:07 ExarchD

hey @ExarchD - thanks for submitting the issue! If adding parentheses fixes the problem, then I think the issue is in fact with the minus sign. I can submit a fix that wraps the exported values in parentheses if so.

EDIT: After playing around with this for a bit, it seems the error is with the labelLocation greater than 1.

AlecAivazis avatar Jul 28 '17 23:07 AlecAivazis

@ExarchD this problem should be fixed now, can you verify?

AlecAivazis avatar Jul 29 '17 22:07 AlecAivazis

Hi, I actually am still getting the same error with negative label locations. Parentheses don't solve the problem. As a minimal example:

\fermion[label=$d$, labelDistance=-0.10, labelLocation=0.35]{0.20, 10.20}{1.40, 10.20}

compiles but

\fermion[label=$d$, labelDistance=-0.10, labelLocation=-0.35]{0.20, 10.20}{1.40, 10.20}

doesn't. Parentheses don't seem to help.

shwinnn avatar Dec 01 '18 18:12 shwinnn

@shwinnn i'm sorry to hear you're running into that. I just reproduced the problem but it might take me awhile to find the time to fix this. Until I do, you should be able to use a floating text element to put the label where you want

AlecAivazis avatar Dec 02 '18 00:12 AlecAivazis

A label location of 0 works fine for my diagrams anyway! Thanks for the great tool.

shwinnn avatar Dec 02 '18 23:12 shwinnn

@shwinnn - this should be fixed now. Could you confirm?

AlecAivazis avatar Dec 03 '18 10:12 AlecAivazis

Hi, first of all thanks for this lovely tool.

Unfortunately, this (error when setting negative labelLocation) is still an issue, but following the discussion https://tex.stackexchange.com/questions/460522/using-fp-package-to-compute-sum-breaks-fp-error-upn-stack-is-empty I managed to fix it by adding "0+" to line 588 of feynman.sty. \FPeval{labelX}{@temp@locX} --> \FPeval{labelX}{0+@temp@locX}

Hope it helps.

mvaculciak avatar Jan 04 '21 20:01 mvaculciak