我正在使用练习包编写教科书。我希望每个练习看起来都像新的数字 SAT 格式。我根据(类似 SAT 的题目格式),然后才意识到练习包更适合我的项目。我还使用 \shipoutAnswer 按章节/部分打印书末的答案。新的数字 SAT 问题采用这种格式。
在切换到锻炼包之前,我使用 MyChoice 已经非常接近了,但使用智能盒时遇到了一些问题。我相信我需要使用 \renewcommand{\ExerciseHeader} 来实现锻炼包的这一功能。我很感激任何关于如何实现这一功能的建议!
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\newcommand{\DrawSmartBox}[1][black]{%
\tikz[overlay,remember picture]{
\draw[#1, rounded corners]
($(bl)+(-2.5em,1.5em)$) rectangle
($(br)+(0,-.7em)$);}
}
\newcommand{\MyCorrectSmartChoice}[2][black]{\CorrectChoice \tikzmark{bl}#2\tikzmark{br}\DrawSmartBox[red]}
\newcommand{\MyChoice}[1]{\item \tikzmark{bl}#1\tikzmark{br}\DrawSmartBox}
\usepackage{xcolor}
\usepackage{calc}
\usepackage[width = 18cm]{geometry}
\usepackage{enumitem}
\newcounter{question}
\newcounter{choice}
\setcounter{choice}{1}
\newenvironment{question}{%
\stepcounter{question}%
\noindent\colorbox{black}{\textcolor{white}{\makebox[1.5em][c]{\thequestion}}}%
\colorbox{lightgray}{\phantom{\rule{\columnwidth-1.5em-\columnsep}{\heightof{1}}}}\par
\begin{list}{}{%
\setlength\itemindent{0pt}%
\setlength\leftmargin{0.0em}%
\setlength\labelwidth{0pt}%
\setlength\labelsep{0pt}}%
\item[]}%
{\end{list}}
\usepackage{enumitem,tikz}
\usetikzlibrary{shapes}
\setlist[enumerate,1]{align=left}
\newlist{choices}{enumerate}{2}
\setlist[choices]{label=\Alph*,format=\ovalnode,align=left,itemsep=1.5em, itemindent=.5em}
\newcommand\ovalnode[1]{%
\tikz[baseline=(circle.base)]\node[draw,circle,inner ysep=1pt,inner xsep=1pt](circle){\makebox[0.8em]{#1\vphantom{A}}};}
\let\choice\item
\begin{document}
\begin{question}
Which choice best describes what happens in the passage?
\begin{choices}
\item One character argues with another character who intrudes on her home.
\item One character receives a surprising request from another character.
\item One character reminisces about choices she has made over the years.
\item One character criticizes another character for pursuing an unexpected course of action.
\end{choices}
\end{question}
\begin{question}
Which choice best describes the developmental pattern of the passage?
\begin{choices}
\item A careful analysis of a traditional practice.
\item A detailed depiction of a meaningful encounter.
\item A definitive response to a series of questions.
\item A cheerful recounting of an amazing anecdote.
\end{choices}
\end{question}
\begin{question}
Which choice best describes the developmental pattern of the passage?
\begin{choices}
\MyChoice{A careful analysis of a traditional practice.}
\MyChoice{A detailed depiction of a meaningful encounter.}
\MyChoice{A definitive response to a series of questions. Get to a second line. Get to a second line. Get to a second line. Get to a second line. Get to a second line. Get to a second line. Get to a second line.}
\MyChoice{A cheerful recounting of an amazing anecdote.}
\end{choices}
\end{question}
\end{document}'
我当前环境的一部分:
\documentclass{article}
\usepackage{mathptmx}
\usepackage[cmintegrals, cmbraces]{newtxmath}
\usepackage{hyperref}
\usepackage{tasks}
\settasks{
label = {(\Alph*)},
label-width=1.4em
}
\usepackage[lastexercise,answerdelayed]{exercise}
\renewcommand{\ExerciseName}{Exercise}
\renewcommand{\AnswerName}{Exercise}
\usepackage{totcount}
\regtotcounter{Exercise} % register the counter for getting the total
\usepackage{chngcntr}
\counterwithin{Exercise}{section}
\counterwithin{Answer}{section}
\usepackage{xassoccnt}
\NewTotalDocumentCounter{totalex}
\usepackage{titleref}
\usepackage{etoolbox}
% \renewcommand{\ExerciseHeader}{ \stepcounter{totalex}\ifnumcomp{\value{Exercise}}{=}{1}{\ifnumcomp{\thechapter}{=}{1}{}{\vspace{10pt}}\noindent\Large\textbf{Chapter\ \thechapter\ \currenttitle}\par\vspace{10pt}}{}\noindent\normalsize\bfseries\ExerciseName\ \ExerciseHeaderNB\par\medskip}
% make look like Digital SAT
\renewcommand{\ExerciseHeader}{ \stepcounter{totalex}\ifnumcomp{\value{Exercise}}{=}{1}{\ifnumcomp{\thechapter}{=}{1}{}{\vspace{10pt}}\noindent\Large\textbf{Chapter\ \thechapter\ \currenttitle}\\}{}\noindent\normalsize\bfseries\ExerciseName\ \ExerciseHeaderNB\\}
\begin{document}
\section{Words in Context}
% Words in context practice problem below:
\begin{Exercise}
What is the value of 2+5?
\begin{tasks}(4)
\task 2
\task 5
\task\label{correctchoice}7
\task 3
\end{tasks}
\end{Exercise}
\begin{Answer}
\ref{correctchoice} 7
\end{Answer}
\end{document}