pythontex icon indicating copy to clipboard operation
pythontex copied to clipboard

`align*` prevents following `\py` from using correct value

Open gpoore opened this issue 6 years ago • 1 comments

\documentclass{article}
\usepackage{amsmath,amsfonts}
\usepackage[keeptemps]{pythontex}
\usepackage{siunitx}
\begin{document}
\begin{pycode}
(m, a ) = (14, 3)
F = m*a
num=1
unit='cm'
\end{pycode}


\begin{align*}
  ma =& F&\\
  a =& \dfrac{F}{a}
       =  \dfrac{\py{F}}{\py{a}}
       = \py{a}
       = {\py{a}} \ \si{m/s^2}
     = \SI[parse-numbers=false]{\py{a}}{m/s^2}  
\end{align*}

\py{r'\SI{%s}{%s}' % (num, unit)}

\end{document}

gpoore avatar Sep 06 '17 11:09 gpoore

After further testing, it appears that the actual issue is due to a combination of align* with \SI[parse-numbers=false]. Using \py outside \SI is fine.

gpoore avatar Sep 06 '17 22:09 gpoore