在遵循 MWE 中,我预计的值为Amb. Temp.
50,但事实并非如此。
\documentclass{article}
\usepackage{mathtools}
\usepackage{units}
\usepackage{pythontex}
\begin{document}
\begin{pycode}
s_base_ONAN = 18
s_base_ONAF1 = 24
s_base_ONAF = 30
u_os = 63
u_us = 20
u_range = 15
steps = 9
v_g = "Ynd11"
amb_temp = 50
install = 1500
\end{pycode}
\begin{align*}
& S = \unit[\py{s_base_ONAF}]{MVA}, \quad \text{ONAN, ONAF1, ONAF2}\
(\py{s_base_ONAN}/\py{s_base_ONAF1}/\py{s_base_ONAF}) \\
& \unit[\py{u_os}(\pm \py{u_range}\% \text{ in } \pm \py{steps}
\text{ steps})/\py{u_us}]{kV}, \quad
\text{\py{v_g}} \\
& \text{Amb.\ Temp.} = \unit[\py{amb_temp}]{^\circ C}, \quad
\text{Installation Level}= \unit[\py{install}]{m}
\end{align*}
\end{document}
答案1
如果你使用\mbox
它
\documentclass{article}
\usepackage{mathtools}
\usepackage{units}
\usepackage{pythontex}
\begin{document}
\begin{pycode}
s_base_ONAN = 18
s_base_ONAF1 = 24
s_base_ONAF = 30
u_os = 63
u_us = 20
u_range = 15
steps = 9
v_g = "Ynd11"
amb_temp = 50
install = 1500
\end{pycode}
\begin{align*}
& S = \unit[\py{s_base_ONAF}]{MVA}, \quad \text{ONAN, ONAF1, ONAF2}\
(\py{s_base_ONAN}/\py{s_base_ONAF1}/\py{s_base_ONAF}) \\
& \unit[\py{u_os}(\pm \py{u_range}\% \text{ in } \pm \py{steps}
\text{ steps})/\py{u_us}]{kV}, \quad
\mbox{\py{v_g}} \\
& \text{Amb.\ Temp.} = \unit[\py{amb_temp}]{^\circ C}, \quad
\text{Installation Level}= \unit[\py{install}]{m}
\end{align*}
\end{document}
\text
使用\mathchoice
so 进行 4 次求值,这似乎混淆了 pythontex 将 python 结果映射回 tex 的过程。您可以在 pythontex 存储库中报告此问题。