类似问题:以表格形式呈现的考试类别多项选择题答案,我试图将其嵌入\choices
到表格格式中并看起来像一张表格。
\documentclass[11pt]{exam}
\usepackage{mathtools}
\usepackage{xspace}
\usepackage{array}
\usepackage{tikz}
\printanswers
\newcommand{\wideunderline}[2][2em]{%
\underline{\makebox[\ifdim\width>#1\width\else#1\fi][c]{#2}}%
}
\begin{document}
\fbox{\parbox{\linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the \wideunderline[1.5cm]{\textit{i}} and vertically stretched about the x-axis by a factor of \wideunderline[1.5cm]{\textit{ii}}}}\medskip
\begin{questions}
\question The statement above is completed by the information in row:\medskip
\begin{choices}
\renewcommand\arraystretch{1.5}
\choice A
\correctchoice B
\choice C
\choice D
\end{choices}
\question I want choice B embedded in the table.
%\begin{choices}%%%is this possible?
\begin{tabular}{|c|c|c|}
\hline
\textbf{Row }& \textbf{\textit{i}}&\textbf{\textit{ii}}\\
\hline
A & $y$-axis&8\\
\hline
B & $y$-axis&$\frac{1}{8}$\\%I would like the choice to be embeded i.e. \choice B is in the first column of the table in row 3.
\hline
C & $x$-axis&8\\
\hline
D & $x$-axis&$\frac{1}{8}$\\
\hline
\end{tabular}
%\end{choices}%%%%doesn't work.
\end{questions}
\end{document}
谁能帮我这个?
答案1
环境oneparchoices
几乎它可以实现您想要的功能,但是它有两个主要限制:首先,将选项嵌入到表格中会使处理变得混乱;\correctchoice
其次,格式会自动在\choice
第一个选项之后的每个选项前添加额外的空格,这在段落情况下是有意义的,但在其他情况下则不然。
为了获得接近您想要的结果,我修改了环境oneparchoices
以删除水平间距,并且仅将正确的选择格式应用于标签而不是整个答案(考虑到我们将命令放入表格\choice
的单元格中,以可推广的方式执行此操作将具有挑战性。
这是新的环境定义:
\makeatletter
\newenvironment{noparchoices}%
{%
\setcounter{choice}{0}%
\def\choice{%
\refstepcounter{choice}%
\choicelabel
% No need to put the following into a token string; we just put
% the choicelabel onto the page, so we're at the spot whose page
% number we want to record:
\questionobject@pluspagecheck
}% choice
\def\CorrectChoice{%
\refstepcounter{choice}%
\ifprintanswers
\begingroup
\CorrectChoice@Emphasis
\fi
\choicelabel
\endgroup
% No need to put the following into a token string; we just put
% the choicelabel onto the page, so we're at the spot whose page
% number we want to record:
\questionobject@pluspagecheck
}% CorrectChoice
\let\correctchoice\CorrectChoice
% If we're continuing the paragraph containing the question,
% then leave a bit of space before the first choice:
\ignorespaces
}%
{}
\makeatother
下面是它的使用示例:
\begin{noparchoices}
\begin{tabular}{|c|c|c|}
\hline
\textbf{Row }& \textbf{\textit{i}}&\textbf{\textit{ii}}\\
\hline
\choice & $y$-axis&8\\
\hline
\correctchoice & $y$-axis&$\frac{1}{8}$\\
\hline
\choice & $x$-axis&8\\
\hline
\choice & $x$-axis&$\frac{1}{8}$\\
\hline
\end{tabular}
\end{noparchoices}