使用任务包中的 fbox 编号时出错

使用任务包中的 fbox 编号时出错

当我插入“\renewcommand{\labelenumi}{\bfseries \fbox{\arabic*}}“在序言中,我收到一个错误"! \boxframe 的参数有一个额外的 }.\par \item“但如果我不插入它就好了。我的代码是:

\documentclass{report}
\usepackage{multicol,amsmath,amsfonts,tasks,enumitem}
%\renewcommand{\labelenumi}{\bfseries \fbox{\arabic*}}
\begin{document}
\begin{center}
\textbf{EXERCISES}\\
\end{center}
\begin{enumerate}
  \item Prove the following by induction on $n$, where $n\in\mathbb Z^+$.
        \begin{tasks}(2)
          \task $\sum_{r=0}^n 2^r=2^{n+1}-1$
          \task $5+5^2+\cdots+5^n=\frac{5(5^n-1)}{4}$
          \task $\sum_{r=0}^n a^r=\frac{a(a^n-1)}{a-1};~a\in\mathbb R$\\
          \task The sum of the first $n$ odd numbers is $n^2$.
          \task* $(1+a)+2(2+a)+3(3+a)+\cdots+n(n+a)=\frac{n}{6}(n+1)(3a+2n+1);~a\in\mathbb R$
          \task* $5(4)+6(5)+7(6)+\cdots+n(n-1)=\frac{1}{3}(n^3-n-60);~\forall n\geq 5$
          \task* $1^4+2^4+3^4+\cdots+n^4=\frac{n}{30}(n+1)(2n+1)(3n^2+3n-1)$
        \end{tasks}
  \item Prove the following statements by induction.
        \begin{tasks}[counter-format={\bfseries tsk[1].}](2)
          \task $\sum_{r=1}^n r^5=\frac{n^2}{12}(n+1)^2(2n^2+2n-1)$
          \task $\sum_{r=1}^n \frac{1}{r(r+1)}=\frac{r}{r+1}$
          \task $\prod_{r=1}^n r^{12}=(r!)^{12}$

        \end{tasks}
\end{enumerate}
\end{document} 

提前感谢您的帮助。

答案1

\fbox是一个脆弱的命令,在这种情况下需要进行保护:

\renewcommand{\labelenumi}{\bfseries\protect\fbox{\arabic*}} 

相关内容