Multicols 環境在運動環境中無法正常運作

Multicols 環境在運動環境中無法正常運作

multicols我在運動環境中使用環境時遇到問題。這是我的 MWE:

\documentclass[11pt]{exam}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{ifthen}
\newboolean{firstanswerofthechapter}  
\usepackage{stackengine}
\usepackage{tasks}
\newlength{\longestlabel}
\settowidth{\longestlabel}{\bfseries\sffamily vv}
\settasks{after-item-skip=3pt,%gap for next row
        before-skip=2pt,%gap from the text above    
          after-skip=0pt,%gap for next question
          label-width=20pt,%width from left
          item-indent=25pt,%indent from left
          label=$\EgyptianBlue\bm{(\alph*)}$,
          column-sep=0em, label-align=left}

\usepackage[lastexercise,answerdelayed]{exercise}




\begin{document}

\setcounter{Exercise}{0}

\begin{Exercise}



\Question
\Question
\Question










\end{Exercise}
    
\begin{Answer}



\Question $(a)$

\begin{multicols}{4}
\Question $(a)$
\Question $(a)$
\Question $(a)$
\Question $(a)$
\end{multicols}


\end{Answer}
\setboolean{firstanswerofthechapter}{false}
\shipoutAnswer

\end{document}

Answer如果我使用 a 啟動環境,程式碼中沒有問題\Question,但是,如果我以環境啟動\multicols\Question之前沒有任何環境\multicols),則會出現以下錯誤:

Extra }, or forgotten \endgroup.
\endmulticols ...le@items \color@endgroup \egroup 
                                                  \balance@columns \return@n...
l.60 \end{multicols}

我需要啟動Answer環境\multicols。我還希望從左到右輸入答案,例如

   1.     2.      3.       4.
   5.     6.      7.       8.

請幫忙。

答案1

此問題在文件的“4 已知問題”部分中討論exercise。您可以透過在環境結束\EndCurrentQuestion之前添加來避免錯誤multicols

\documentclass[11pt]{exam}

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{multicol}
\usepackage{ifthen}
\newboolean{firstanswerofthechapter}  
\usepackage{stackengine}
\usepackage{tasks}
\newlength{\longestlabel}
\settowidth{\longestlabel}{\bfseries\sffamily vv}
\settasks{after-item-skip=3pt,%gap for next row
        before-skip=2pt,%gap from the text above    
          after-skip=0pt,%gap for next question
          label-width=20pt,%width from left
          item-indent=25pt,%indent from left
          label=$\EgyptianBlue\bm{(\alph*)}$,
          column-sep=0em, label-align=left}

\usepackage[lastexercise,answerdelayed]{exercise}




\begin{document}

\setcounter{Exercise}{0}

\begin{Exercise}



\Question
\Question
\Question










\end{Exercise}
    
\begin{Answer}


\begin{multicols}{4}
\Question $(a)$
\Question $(a)$
\Question $(a)$
\Question $(a)$
\EndCurrentQuestion
\end{multicols}


\end{Answer}
\setboolean{firstanswerofthechapter}{false}
\shipoutAnswer

\end{document}

相關內容