Sympy 中的 for 循环失控参数错误

Sympy 中的 for 循环失控参数错误

我正在尝试使用 sympytex 编译以下文档。目标是使用 sympy 和 latex forloop 将整数平方生成到 exsheets 中。我花了几个小时试图修复错误,但无济于事。缩进似乎会影响错误的类型。这是我的代码:

\documentclass{article}
\write18{}
\usepackage{forloop,python,sympytex}
\usepackage{amsmath, amsfonts, amssymb,amsthm}
\usepackage[auto-label=true]{exsheets}
\SetupExSheets[question]{type=exam}
\newtheorem{exer}{Exercise}
\newtheorem{example}{Example}
\newtheorem{theorem}{Theorem}
\newtheorem*{theorem*}{Theorem}
\renewcommand*{\proofname}{Solution}

\begin{document}
Hello world!
\begin{sympysilent}
  h=2*10
\end{sympysilent}
We know that $h=\sympy{h}$.
\newcounter{s}
\forloop[1]{s}{1}{\value{s}< 6}
{
\begin{sympysilent}
  h=4
  t=h*h
\end{sympysilent}

\begin{question}
  Hello is $\sympy{h}^2 =$
\end{question}
\begin{solution}
  The answer is $\sympy{h}^2 = \sympy{t}$
\end{solution}
}

\printsolutions
\end{document}

相关内容