生成答题气泡纸

生成答题气泡纸

我希望在以下 MWE 中添加气泡答题纸:

\documentclass[twoside,a4paper,cleardoublepage=empty,14pt]{book}
\usepackage{exsheets}
\SetupExSheets[question]{type=exam}
\SetupExSheets{counter-format=ch.qu[1]}
\RenewQuSolPair{question}[headings-format=\large\bfseries,name=Problem]{solution}
\usepackage{enumerate,tikz}

\newcommand*\squared[1]{\tikz[baseline=(char.base)]{
        \node[shape=rectangle,draw,inner sep=3pt] (char) {#1};}}
\usepackage{enumitem}
\usepackage{multicol}
\setlist[enumerate]{label=\protect\squared{\arabic*}}
\begin{document}
    
    \chapter{Analysis of Algorithms}
    
    \begin{question}
        Which of the following answers is correct for the given recurrence relation $T(n)=T(n-1)+n$?
        \begin{enumerate}
            \item $O(n^2)$
            \item $O(n^3)$
            \item $O(n^4)$
            \item $O(n\log n)$
        \end{enumerate}
    \end{question}
    
    \begin{solution}
        this is a solution
    \end{solution}
    \chapter{answer Sheet}
    
    
    
    
\end{document}

更详细地说,我正在写一本多项选择题的书。我希望在章节答题表中添加一个气泡答题表,以便每个问号都有正确的选择,如下图所示:

在此处输入图片描述

答案1

无需修改exsheets即可实现此目的。

演示

\documentclass[twoside,a4paper,cleardoublepage=empty,14pt]{book}
\usepackage{exsheets}
\SetupExSheets[question]{type=exam}
\SetupExSheets{counter-format=ch.qu[1]}
\RenewQuSolPair{question}[headings-format=\large\bfseries,name=Problem]{solution}
\usepackage{enumerate,tikz}

\newcommand*\squared[1]{\tikz[baseline=(char.base)]{
        \node[shape=rectangle,draw,inner sep=3pt] (char) {#1};}}
\usepackage{enumitem}
\usepackage{multicol}
\setlist[enumerate]{label=\protect\squared{\arabic*}}


\newcommand{\bubble}[1]% #1 is correct choice (out of 4)
{\bgroup
  \fboxsep=0pt
  \count1=0
  \count2=#1\relax
  \loop\ifnum\count1<4
    \advance\count1 by 1
    \ifnum\count1=\count2
      \fbox{\rule[-\dp\strutbox]{1em}{\baselineskip}}\quad
    \else
      \fbox{\makebox[1em]{\number\count1}\strut}\quad
    \fi
  \repeat
\egroup}

\begin{document}
    
    \chapter{Analysis of Algorithms}
    
    \begin{question}
        Which of the following answers is correct for the given recurrence relation $T(n)=T(n-1)+n$?
        \begin{enumerate}
            \item $O(n^2)$
            \item $O(n^3)$
            \item $O(n^4)$
            \item $O(n\log n)$
        \end{enumerate}
    \end{question}
    
    \begin{solution}
        \bubble{3}
    \end{solution}
    \chapter{answer Sheet}
    
    \printsolutions
    
\end{document}

相关内容