為什麼我不能在 xsim 中使用註解環境?

為什麼我不能在 xsim 中使用註解環境?

我正在寫一些講義,我想在其中添加一些練習提示。為此,我使用該包xsim並為hint.

有時我還需要呼叫一些註解某些行的函數。

comment但是,當我在我的環境中使用環境時hint,我收到一條錯誤訊息:Argument of \xComment has an extra }. <inserted text> \par l.57 \end{hint} Runaway argument? 我遇到了相同的問題,使用預設exercise環境,但沒有可用的錯誤訊息。 (所以我不認為問題來自我的環境定義)。

這是一個 MWE:

\documentclass{article} 

    \usepackage{comment}
    \usepackage{xsim}
        \DeclareExerciseProperty{hint}
        
        \ExplSyntaxOn
            \bool_new:N \l_xsim_hint_bool
            
            \keys_define:nn {xsim}
            { hint/print .bool_set:N = \l_xsim_hint_bool }
            
            
            \NewDocumentEnvironment{hint}{+b}
            {%
                \tl_set:NV \ExerciseType \g_xsim_exercise_type_tl
                \tl_set:NV \ExerciseID \g_xsim_exercise_id_tl
                \SetExerciseProperty {hint} {#1}
                \bool_if:NT \l_xsim_hint_bool
                {
                    \par\medskip
                    \underline{\itshape Hint \nobreakspace \GetExerciseProperty{counter}}\,:\nobreakspace 
                    {#1}
                }
            }
            {}
        \ExplSyntaxOff
                
        %% description list for hints
        \newcommand\printhints{%
            \begin{description}
                \ForEachUsedExerciseByType{%
                    \GetExercisePropertyT{hint}
                    {\item[Hint ##3]####1}%
                }%
            \end{description}
        }
        
        %% Declare to print hint
        \xsimsetup{
            hint/print = true 
        }


\begin{document} 

    \begin{comment}
        no problem
    \end{comment}

    \begin{hint}
        Let us remark that $a+b=0$.
        
        \begin{comment}
            problem
        \end{comment}
    \end{hint}

    % \begin{exercise}
    %   Let us remark that $a+b=0$.
        
    %   \begin{comment}
    %       problem
    %   \end{comment}
    % \end{exercise}

\end{document}
%EoF

我該如何解決這個問題?

相關內容