NewTasks 环境的计数器名称

NewTasks 环境的计数器名称

我正在使用tasks(作为的子集exsheets)来创建环境exer2和,exer3它们将微积分练习册中的练习集组织成行和列。我还使用环境exsheetsquestionsolution跟踪解决方案并有序地打印出来。

我知道第一级 {enumerate} 计数器的名称enumi如序言第 9 行所示。我不知道由 创建的环境中计数器的名称tasks。当我使用手册第 7.6 节第 13-14 页建议的语法时exsheets,我得到的是文本回显“tsk[a]”,而不是计数器。

我可以处理标签的最终格式solutions,我只需要知道如何获取“a,b,c”而不是“1 tsk [a],1 tsk [a],1 tsk [a]”。

我在这里遗漏了什么?

[包括以下内容:完整的 TeX 代码,以及 MS Word 的输出,以显示我想要的内容以及我从 LaTeX 中得到的内容]


\documentclass[12pt,letterpaper,fleqn,titlepage,openany,oneside]{book}
\usepackage{comment}
\usepackage[left=.75in, right=.75in, top=1in, bottom=1in]{geometry} 
\usepackage{setspace}
\usepackage[inline]{enumitem} 
\usepackage{exsheets} 
\SetupExSheets[question]{pre-hook=\vspace{-24pt},post-hook=\vspace{-12pt},headings=block}
\SetupExSheets[solution]{headings=runin}
\SetupExSheets{counter-format=\arabic{enumi}~tsk[a]}
% ENVIRONMENTS FOR EXERCISES USING TASKS
\NewTasks[before-skip=6pt,after-skip=6pt,after-item-skip=0pt,item-indent=24pt,label-width=6pt,label-offset=12pt,counter-format=tsk[a].~]{exer3}[\exercise](3)
\NewTasks[before-skip=6pt,after-skip=6pt,after-item-skip=0pt,item-indent=24pt,label-width=6pt,label-offset=12pt,counter-format=tsk[a].~]{exer2}[\exercise](2)

\begin{document}
    \begin{enumerate}
    \item First exercise set. 
        \begin{exer3} 
        \exercise % THIS IS THE COUNTER WHOSE NAME I WANT
            \begin{question}
                Set one exercise one
            \end{question}
            \begin{solution}
                Set one solution one\\
                 \hrule \vspace{6pt}
             \end{solution}
        \exercise
            \begin{question}
                Set one exercise two
            \end{question}
            \begin{solution}
                Set one solution two\\
                \hrule \vspace{6pt}
            \end{solution}
        \exercise
            \begin{question}
                Set one exercise three
            \end{question}
            \begin{solution}
                Set one solution three\\
                \hrule \vspace{6pt}
            \end{solution}
            \end{exer3}
    \end{enumerate}

    \begin{enumerate}[resume]
        \item Second exercise set.
            \begin{exer2}
        \exercise
            \begin{question}
                Set two exercise one
            \end{question}
            \begin{solution}
                Set two solution one\\
                \hrule \vspace{6pt}
            \end{solution}
        \exercise
             \begin{question}
                Set two exercise two
            \end{question}
            \begin{solution}
                Set two solution two\\
                \hrule \vspace{6pt}
            \end{solution}
            \end{exer2}
    \end{enumerate}

\hrule \vspace{2pt} \hrule \vspace{6pt}

\printsolutions

\end{document} 

我想要的是:

1a. Set one solution one
________________________________________
1b. Set one solution two
________________________________________
1b. Set one solution three
________________________________________
2a. Set two solution one
________________________________________
2b. Set two solution two
________________________________________

我得到的是:

Solution 1 tsk[a]   Set one solution one
________________________________________
Solution 1 tsk[a]   Set one solution two
________________________________________
Solution 1 tsk[a]   Set one solution three
________________________________________
Solution 2 tsk[a]   Set two solution one
________________________________________
Solution 2 tsk[a]   Set two solution two
________________________________________

答案1

你使用的tasks方式我从未想象过……

您必须让模式读取器tasks知道计数器(实际上是一个内部 expl3 整数)exsheets

\usepackage{exsheets,tasks}
\ExplSyntaxOn
  \AddCounterPattern* [exsheets] {task} {tsk}
  \ReadCounterFrom    [exsheets] {task} \g__tasks_int
\ExplSyntaxOff

嵌入到您的示例文档中:

\documentclass{book}
\usepackage[inline]{enumitem} 
\usepackage{exsheets,tasks}
\ExplSyntaxOn
  \AddCounterPattern*[exsheets]{task}{tsk}
  \ReadCounterFrom   [exsheets]{task}\g__tasks_int
\ExplSyntaxOff

\SetupExSheets{
  question/pre-hook = \vspace{-24pt},
  question/post-hook = \vspace{-12pt},
  question/headings = block ,
  solution/headings = runin ,
  solution/post-hook = \par \hrule \vspace{6pt} ,
  counter-format=\arabic{enumi}~tsk[a]
}

\NewTasks[
  before-skip=6pt,
  after-skip=6pt,
  after-item-skip=0pt,
  item-indent=24pt,
  label-width=6pt,
  label-offset=12pt,
  counter-format=tsk[a].~]{exer3}[\exercise](3)
\NewTasks[
  before-skip=6pt,
  after-skip=6pt,
  after-item-skip=0pt,
  item-indent=24pt,
  label-width=6pt,
  label-offset=12pt,
  counter-format=tsk[a].~]{exer2}[\exercise](2)

\begin{document}

\begin{enumerate}
  \item First exercise set. 
  \begin{exer3} 
    \exercise
    \begin{question}
      Set one exercise one
    \end{question}
    \begin{solution}
      Set one solution one
    \end{solution}
    \exercise
    \begin{question}
      Set one exercise two
    \end{question}
    \begin{solution}
      Set one solution two
    \end{solution}
    \exercise
    \begin{question}
      Set one exercise three
    \end{question}
    \begin{solution}
      Set one solution three
    \end{solution}
  \end{exer3}
\end{enumerate}

\begin{enumerate}[resume]
  \item Second exercise set.
  \begin{exer2} 
    \exercise
    \begin{question}
      Set two exercise one
    \end{question}
    \begin{solution}
      Set two solution one
    \end{solution}
    \exercise
    \begin{question}
      Set two exercise two
    \end{question}
    \begin{solution}
      Set two solution two
    \end{solution}
  \end{exer2}
\end{enumerate}

\hrule \vspace{2pt} \hrule \vspace{6pt}

\printsolutions

\end{document}

答案2

我无法让它发挥作用,但在阅读论坛上的其他一些帖子后,我确实找到了不同的答案

\usepackage{etoolbox}
\AtBeginEnvironment{exer2}{\setcounter{question}{0}}
\AtBeginEnvironment{exer3}{\setcounter{question}{0}}
\SetupExSheets{counter-format=\arabic{enumi}.\alph{question}}

似乎正在起作用。

相关内容