考试线(不包含在考试包中)

考试线(不包含在考试包中)

几天前,我刚开始接触 LaTeX,听说有一款exam软件包可以减轻我的痛苦,我非常高兴。但是,我发现,我试图模拟的试卷肯定没有使用该exam软件包,因为它的评分方式和问题子部分的位置都与此有关。

所以我想在其中模拟问题行 - 我尝试查看exam.cls源代码,但对于我这个初学者来说,这非常深奥。我一直在尝试使用,\line(1, 0){some number}但这很容易超出右边距 - 我不想这样做 - 即我想要一条可以从缩进或制表符位置开始并停止在右边距的行。

请参见下面的图片来了解其外观。

考试题目

答案1

您可以直接从 exam.cls 中复制代码\fillwithlines,它将在枚举环境中运行:

\documentclass[12pt]{article}

%--------------------------------------------------------------------
\makeatletter
%                            \fillwithlines


% \fillwithlines takes one argument, which is either a length or \fill
% or \stretch{number}, and it fills that much vertical space with
% horizontal lines that run the length of the current line.  That is,
% they extend from the current left margin (which depends on whether
% we're in a question, part, subpart, or subsubpart) to the right
% margin.
%
% The distance between the lines is \linefillheight, whose default value
% is set with the command
%
% \setlength\linefillheight{.25in}
%
% This value can be changed by giving a new \setlength command.
%
% The thickness of the lines is \linefillthickness, whose default value
% is set with the command
%
% \setlength\linefillthickness{.1pt}
%
% This value can be changed by giving a new \setlength command.


\newlength\linefillheight
\newlength\linefillthickness
\setlength\linefillheight{.25in}
\setlength\linefillthickness{0.1pt}

\newcommand\linefill{\leavevmode
    \leaders\hrule height \linefillthickness \hfill\kern\z@}


\def\fillwithlines#1{%
  \begingroup
  \ifhmode
    \par
  \fi
  \hrule height \z@
  \nobreak
  \setbox0=\hbox to \hsize{\hskip \@totalleftmargin
          \vrule height \linefillheight depth \z@ width \z@
          \linefill}%
  % We use \cleaders (rather than \leaders) so that a given
  % vertical space will always produce the same number of lines
  % no matter where on the page it happens to start:
  \cleaders \copy0 \vskip #1 \hbox{}%
  \endgroup
}
\makeatother
%--------------------------------------------------------------------

\newcommand{\e}{\mathrm{e}}

\begin{document}
\begin{enumerate}
\item Let $y = (3x^{2} - 5x)^{5}$.  Find $\frac{dy}{dx}$.
  \fillwithlines{2in}

\item Let $f(x) = x \e^{3x}$.  Evaluate $f'(0)$.
\fillwithlines{2in}
\end{enumerate}

\end{document}

相关内容