包含考试类别练习列表的目录

包含考试类别练习列表的目录

我需要在包含带解决方案的练习的多页文档的第一页中包含一个目录。我不知道是否应该将其命名为目录更确切地说 练习列表(喜欢图片列表

在此处输入图片描述

女士:

\documentclass[a4paper,answers]{exam} 
\usepackage{lipsum}
\qformat{\textbf {Exercise \thequestion} \hfill \thepoints}
\begin{document}
    \begin{questions}
    \question
    \lipsum[1]
    \begin{solution}
    \lipsum
    \end{solution}
    \newpage 

    \question
    \lipsum[2]
    \begin{solution}
    \lipsum
    \end{solution}
    \newpage 

    \question
    \lipsum[3]
    \begin{solution}
    \lipsum
    \end{solution}

    \end{questions}
\end{document}

答案1

建议使用\tableofcontents

\documentclass[a4paper,answers]{exam}
\usepackage{lipsum}% only for dummy text

\usepackage{tocbasic}
\DeclareTOCStyleEntry[
  level=1,
  indent=0pt,
  numwidth=2.3em,
  dynnumwidth,
  pagenumberformat=\entryprefix{page~},
  pagenumberbox=\mbox
]{tocline}{exercise}
\newcommand*\entryprefix[2]{#1#2}

\qformat{%
  \textbf{Exercise~\thequestion}%
  \addxcontentsline{toc}{exercise}{Exercise~\thequestion}%
  \hfill\thepoints%
}

\renewcommand*\contentsname{List of Exercises}

\begin{document}
\tableofcontents
\clearpage

\begin{questions}
\question
\lipsum[1]
\begin{solution}
\lipsum
\end{solution}
\clearpage

\question
\lipsum[2]
\begin{solution}
\lipsum
\end{solution}
\clearpage

\question
\lipsum[3]
\begin{solution}
\lipsum
\end{solution}

\end{questions}
\end{document}

建议使用新定义\listofexercises

\documentclass[a4paper,answers]{exam}
\usepackage{lipsum}% only for dummy text

\usepackage{tocbasic}
\DeclareNewTOC[%
  type=exercise,%
  types=exercises,%
  name=Exercise,%
  listname={List of Exercises},%
  tocentrystyle=tocline,%
  tocentryindent=0pt,%
  tocentrydynnumwidth,%
  tocentrypagenumberformat=\entryprefix{page~},%
  tocentrypagenumberbox=\mbox
]{exr}
\newcommand*\entryprefix[2]{#1#2}

\qformat{%
  \textbf{Exercise~\thequestion}%
  \addxcontentsline{exr}{exercise}{Exercise~\thequestion}%
  \hfill\thepoints%
}

\begin{document}
\listofexercises
\clearpage

\begin{questions}
\question
\lipsum[1]
\begin{solution}
\lipsum
\end{solution}
\clearpage

\question
\lipsum[2]
\begin{solution}
\lipsum
\end{solution}
\clearpage

\question
\lipsum[3]
\begin{solution}
\lipsum
\end{solution}

\end{questions}
\end{document}

两者都导致

在此处输入图片描述

相关内容