在 PDF 中的书面答案的问题下方添加空格
Add whitespace below questions for written answers in PDFs
我们只有笔试(纸笔),只有short/medium-sized个字符串答案。在我们目前的考试中,我们提出问题,并在下面留一些空白(这取决于答案的预期长度)。
当我从 R/exams 导出 PDF 时,如何灵活地在问题下方添加空白?
我刚才在 R-Forge 上问过这个问题,这是 Achim Zeileis 的回答:
The easiest way to add enough white space below a question is to include some LaTeX command for this either in the exercise itself or
(probably easier/better) in the LaTeX template. You could, for
example, add a \vspace*{8cm}
or a \newpage
at the end of every
exercise. For illustration I attach a plain-page.tex
template that
has:
\newenvironment{question}{\item \textbf{Problem}\newline}{\newpage}
where the \item
... \newline
is added in the beginning of each
exercise and \newpage
at the end. Check out
exams2pdf(c("tstat", "deriv"), template = "plain-page.tex")
to see what it does. In case you want to have different amounts of
white space for different questions, you should probably put a
\vspace*{}
into the exercises. There would be further fine-tuning
options but maybe the solution above works well enough for you. Please
keep asking otherwise.
https://r-forge.r-project.org/forum/message.php?msg_id=45361&group_id=1337
(您需要创建一个帐户才能查看。)
附件中的代码如下:
\documentclass[a4paper]{article}
\usepackage{a4wide,color,Sweave,url,amsmath,booktabs,longtable,verbatim}
\newenvironment{question}{\item \textbf{Problem}\newline}{\newpage}
\newenvironment{solution}{\comment}{\endcomment}
\newenvironment{answerlist}{\renewcommand{\labelenumi}
{(\alph{enumi})}\begin{enumerate}}{\end{enumerate}}
\begin{document}
\begin{enumerate}
%% \exinput{exercises}
\end{enumerate}
\end{document}
正如@jtr13 所指出的,最简单的解决方案是当所有练习都得到 相同的 白色 space 规则时,例如固定数量或其余部分R-Forge 论坛 post 中显示的页面。
如果白色 space 量 因练习而异 (如原始问题中所述),那么一个非常简单的解决方案是包含类似
\vspace*{5cm}
在每次练习中根据需要改变白色的量 space。这适用于 R/Markdown (.Rmd) 和 R/LaTeX (.Rnw) exams2pdf()
练习。当转换为 HTML 时(例如,对于 Moodle 等),它会被忽略。
如果也可以选择性地忽略 PDF 中的白色 space(例如,当将问题列表编译为概述而不是考试时),那么我将使用自定义专用命令.然后可以选择通过使命令处于非活动状态来忽略它。你可以使用 \vspace
而不是
\whitespace{5cm}
然后在 LaTeX header 中 template
你需要定义命令,例如
\let\whitespace=\vspace
并且在应该忽略您可以说的命令的模板中
\newcommand{\whitespace}[1]{}
有关 LaTeX 模板的具体示例,请参阅 jtr13 或 vignette("exams", package = "exams")
的回答。
我们只有笔试(纸笔),只有short/medium-sized个字符串答案。在我们目前的考试中,我们提出问题,并在下面留一些空白(这取决于答案的预期长度)。
当我从 R/exams 导出 PDF 时,如何灵活地在问题下方添加空白?
我刚才在 R-Forge 上问过这个问题,这是 Achim Zeileis 的回答:
The easiest way to add enough white space below a question is to include some LaTeX command for this either in the exercise itself or (probably easier/better) in the LaTeX template. You could, for example, add a
\vspace*{8cm}
or a\newpage
at the end of every exercise. For illustration I attach aplain-page.tex
template that has:\newenvironment{question}{\item \textbf{Problem}\newline}{\newpage}
where the
\item
...\newline
is added in the beginning of each exercise and\newpage
at the end. Check outexams2pdf(c("tstat", "deriv"), template = "plain-page.tex")
to see what it does. In case you want to have different amounts of white space for different questions, you should probably put a
\vspace*{}
into the exercises. There would be further fine-tuning options but maybe the solution above works well enough for you. Please keep asking otherwise.
https://r-forge.r-project.org/forum/message.php?msg_id=45361&group_id=1337 (您需要创建一个帐户才能查看。)
附件中的代码如下:
\documentclass[a4paper]{article}
\usepackage{a4wide,color,Sweave,url,amsmath,booktabs,longtable,verbatim}
\newenvironment{question}{\item \textbf{Problem}\newline}{\newpage}
\newenvironment{solution}{\comment}{\endcomment}
\newenvironment{answerlist}{\renewcommand{\labelenumi}
{(\alph{enumi})}\begin{enumerate}}{\end{enumerate}}
\begin{document}
\begin{enumerate}
%% \exinput{exercises}
\end{enumerate}
\end{document}
正如@jtr13 所指出的,最简单的解决方案是当所有练习都得到 相同的 白色 space 规则时,例如固定数量或其余部分R-Forge 论坛 post 中显示的页面。
如果白色 space 量 因练习而异 (如原始问题中所述),那么一个非常简单的解决方案是包含类似
\vspace*{5cm}
在每次练习中根据需要改变白色的量 space。这适用于 R/Markdown (.Rmd) 和 R/LaTeX (.Rnw) exams2pdf()
练习。当转换为 HTML 时(例如,对于 Moodle 等),它会被忽略。
如果也可以选择性地忽略 PDF 中的白色 space(例如,当将问题列表编译为概述而不是考试时),那么我将使用自定义专用命令.然后可以选择通过使命令处于非活动状态来忽略它。你可以使用 \vspace
而不是
\whitespace{5cm}
然后在 LaTeX header 中 template
你需要定义命令,例如
\let\whitespace=\vspace
并且在应该忽略您可以说的命令的模板中
\newcommand{\whitespace}[1]{}
有关 LaTeX 模板的具体示例,请参阅 jtr13 或 vignette("exams", package = "exams")
的回答。