我正在学习考试类来生成试卷。示例代码如下:
\documentclass{exam}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill,inner sep=1.5pt, text=white] (char) {#1};}}
\renewcommand{\questionlabel}{\circled{\thequestion}}
\begin{document}
\begin{questions}
\question[4] Choose the correct reponse:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
\end{questions}
\end{document}
您能否给出一些指示来添加下面提到的问题 [37 和 15-19 的段落]:
答案1
这是解决方案的一部分。显然,你会使用自己的剪贴画。
\documentclass[a4paper,addpoints,answers,10pt]{exam}
\usepackage{tikz}
\usepackage{graphicx}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill,inner sep=1.5pt, text=white] (char) {#1};}}
\renewcommand{\questionlabel}{\circled{\thequestion}}
\begin{document}
\begin{questions}
\question[4] Choose the correct reponse:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
\hspace*{-0.27in}\begin{tikzpicture}[rounded corners=5pt]
\path node[rectangle,draw=black] {\hspace*{.23in}\parbox{5.97in}{
\question[4] Choose the correct reponse:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
}};
\end{tikzpicture}
\hspace*{-0.27in}\begin{tikzpicture}[rounded corners=5pt]
\path node[rectangle,draw=black] {\begin{minipage}{6.2in}
\begin{minipage}[c]{5in}
\raggedright\setlength{\parskip}{0.1in}
There are many kinds of boats.
One kind of boat is called a sailboat. It uses wind to move.
Wind makes the sailboat move in the water.
Wind pushes the sailboat. Wind fills the sails.
The sailboat moves when the wind blows.
\end{minipage}\hfill\parbox[c]{1in}{\resizebox{1in}{!}{\includegraphics{sailboat.png}}}
\parbox[c]{1in}{\resizebox{1in}{!}{\includegraphics{motorboat.png}}}\hfill
\parbox[c]{5in}{\raggedright
One kind of boat is called a motorboat.
A motorboat uses a motor to move.
The motor gives power to the boat.
The motorboat moves when the motor is running,
The motor makes a loud noise.}
\parbox[c]{5in}{\raggedright
One kind of boat is called a rowboat.
A rowboat needs people to move it.
People make a rowboat move in the water.
People use oars to move a rowboat.
Oars are long and flat.
Oars go into the water.
A rowboat moves when people use the oars.
}\hfill\parbox[c]{1in}{\resizebox{1in}{!}{\includegraphics{rowboat.png}}}
\end{minipage}
};
\end{tikzpicture}
\end{questions}
\end{document}
答案2
以下是一次尝试tcolorbox
。
\documentclass{exam}
\usepackage{tcolorbox}
\usepackage{showframe,lipsum}
%
\tcbuselibrary{skins}
\usetikzlibrary{calc}
\pgfdeclarelayer{foreground}
\pgfsetlayers{main,foreground}
%
\newtcolorbox{myqbox}{%
colback=white,
left=-1ex, % left space between content text and box I don't know why -1ex is needed here
top=0pt,
bottom=0pt,
right=0pt,
skin=freelance,
enlarge left by=0pt,
frame code={%
\begin{pgfonlayer}{foreground}
\draw[line width = 2pt,color = magenta,rounded corners=2ex] ($(frame.south west) +(-1.2\leftmargin,-.2em)$) rectangle ($(frame.north east)+(.3em,.2em)$);
\end{pgfonlayer}%
},
}%
%
\newtcolorbox{mybox}{%
colback=white,
left=0ex, % left space between content text and box I don't know why -1ex is needed here
top=0pt,
bottom=0pt,
right=0pt,
arc=2ex,
oversize
}%
%
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{%
\node[shape=circle,fill,inner sep=1.5pt, text=white] (char) {#1};}}
\renewcommand{\questionlabel}{\circled{\thequestion}}
\begin{document}
\begin{questions}
\question[4] Choose the correct reponse:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
%
\begin{myqbox}%
\question[4] Choose the correct reponse just to fill the line of text until the end of line for having some fun and test:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
\end{myqbox}
%
\uplevel{%
{\bfseries Read the following and go to heaven}
\begin{mybox}
\lipsum[1]
\end{mybox}
}
%
\begin{myqbox}%
\question[4] Choose the correct reponse just to fill the line of text until the end of line for having some fun and test:
\begin{choices} \choice Option A
\choice Option B
\choice Option C
\choice Option D
\end{choices}
\end{myqbox}
\end{questions}
\end{document}
注意事项:如果你想给问题添加背景颜色,那你就麻烦了。另外我不明白为什么我必须添加left=-1ex,
。
答案3
考虑到上述内容有多复杂,下面的内容是否就那么困难呢?
\documentclass{article}
\usepackage[margin=1in]{geometry}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.1in}
\newlength{\qwidth}
\setlength{\qwidth}{\textwidth}
\addtolength{\qwidth}{-0.75in}
\newcommand{\qbox}{\framebox[0.25in]{\rule{0in}{.2in}} \hspace*{0.1in}}
\newcommand{\question}[2]%#1 = problem number, #2 = statement
{(#1) \qbox
\parbox[t]{\qwidth}{\raggedright #2}
\par\vfill}
\newcommand{\qmult}[3]%#1 = number, #2 = question, #3 = choices
{(#1) \qbox \parbox[t]{\qwidth}{\raggedright #2}\par
\hspace*{0.1in}
\begin{tabular}{ll}#3\end{tabular}\\
\vfill}
\newcommand{\qchoice}[2]%#1 = letter, #2 = text
{#1.\\}
\begin{document}
\pagestyle{empty}
\large
\framebox[3in][l]{\rule{0in}{0.25in}\tiny name}\hfill
\framebox[1.5in][l]{\rule{0in}{0.25in}\tiny date}\hfill
\framebox[0.4in][l]{\rule{0in}{0.25in}\tiny period}
\begin{center}
{\huge Attitude}
\end{center}
\rule{\textwidth}{1pt}
Answer true (T) or false (F).
\par\vfill
\question{1}{I'm not going to learn anything, and you can't make me.}
\question{2}{If it's not about sports, video games, pop culture, me or
my friends, I don't want to hear about it.}
\question{3}{If it's not going to be on the test, I don't need to know it.}
\question{4}{When I try to do math all I can think of is ``I hate this!
I hate this! I hate this!''}
\question{5}{No one I know or admire is any good at math either.}
\question{6}{I enjoy solving puzzles.}
\rule{\textwidth}{1pt}
Multiple choice.
\qmult{7}{I won't need an education if I am going to be \underline{\rule{0.5in}{0pt}} .}{
\qchoice{A}{dead by 21}
\qchoice{B}{a convicted felon}
\qchoice{C}{in a permanent drunken stupor}
\qchoice{D}{on an MTV reality show}
}
\qmult{8}{Given a choice, I would rather be \underline{\rule{0.5in}{0pt}} .}{
\qchoice{A}{ignorant}
\qchoice{B}{narrow minded}
\qchoice{C}{self-destructive}
\qchoice{D}{unpopular}
}
\end{document}
顺便说一句,我知道如何使用计数器,但我只是不喜欢它们。