列举出真假问题列表,答案带有下划线

列举出真假问题列表,答案带有下划线

我想写一份是非题清单:

  1. 每个问题都应编号。
  2. 应该有足够的下划线空间来手写单个字符,即 T 或 F。
  3. 接下来的问题就是。

以下 MWE 显示了与我想要的非常接近的列表

\documentclass{book}

\usepackage{enumitem}
\newlist{tfl}{enumerate}{1}
\setlist[tfl]{label*={\alph*.\quad\underline{\hspace{0.5cm}}}}

\begin{document}

\section{Exercises}

\begin{enumerate}
\item Mark the following true or false
  \begin{tfl}
  \item Every dog has a tail
  \item Every animal with a tail is a dog
  \item Every dog has four legs
  \item Every animal which barks and is born with four legs is a dog
  \end{tfl}
\item Compute to the last digit the value of $\pi$.
\end{enumerate}

\end{document}

这是 MWE 在我的屏幕上显示的样子

我主要关心的是将整个是非题部分推向右边。

具体来说,我不希望标有字母 a、b、c 和 d 的列出现在标有数字 1 和 2 的列的左侧。

此外,我想知道是否有比在 \setlist 定义中使用 \hspace 更干净的方法来留出一些下划线空格。

然而,最后一点只是次要问题。


编辑 1:我很感谢我收到的所有有用信息。我怀疑@Bernard 的答案是解决我的问题的答案,因为我正在书籍类中工作。遗憾的是,我当前的 LaTex 安装无法编译它。我正在调查这个问题。

但是,根据@Alan Munn 和@Skillmun 的建议,我构建了另一个可能对其他人有用的例子。这个例子和我原来的 MWE 之间的关键区别在于单个问题跨越多行。使用“leftmargin=2cm”或“leftmargin=*”可确保这些单独的行对齐。

\documentclass{book}

\usepackage{enumitem}
\newlist{tfl}{enumerate}{1}
\setlist[tfl]{label*=\alph*.\quad\underline{\hspace{0.5cm}},leftmargin=2cm}

    \begin{document}

    \section{Exercises}

    \begin{enumerate}
    \item Mark the following true or false
      \begin{tfl}
      \item Every real number is a floating point number.
      \item Every floating point number is a rational number.
      \item Every real number can be accurately represented by a floating point number.
      \item Every real number in the representable range can be accurately represented by a floating point number.
    \item For every real number $x$ in the representable range, there exists a floating point number $\hat{x}$ such that $\hat{x} = x(1+\delta)$, where $|\delta| \leq u$ and $u$ is the unit round off error.
      \end{tfl}
    \item Compute the IEEE single precision representation of $\pi$.
    \end{enumerate}

    \end{document}

改进的最小工作示例

答案1

像这样?

\documentclass{book}

\usepackage{enumitem}
\newlist{tfl}{enumerate}{1}
\setlist[tfl]{label*=\alph*.\quad\rule[-0.5ex]{0.5cm}{0.4pt}, wide =0pt, leftmargin=*}

\begin{document}

\section{Exercises}

\begin{enumerate}[wide=0pt, leftmargin=*]
\item Mark the following true or false
  \begin{tfl}
  \item Every dog has a tail
  \item Every animal with a tail is a dog
  \item Every dog has four legs
  \item Every animal which barks and is born with four legs is a dog
  \end{tfl}
\item Compute to the last digit the value of $\pi$.
\end{enumerate}

\end{document}

在此处输入图片描述

答案2

您需要使用exam课程以实现您所寻找的目标(以及更多)。


以下是代码:

\documentclass{exam}

% \printanswers

\newcommand{\tfq}[1][{}]{%
  \fillin[#1][10.0mm]}

\begin{document}

\section{Exercises}

\begin{questions}
\question [4] Mark the following true or false
  \begin{parts}
    \part \tfq[T] Every dog has a tail.
    \part \tfq[F] Every animal with a tail is a dog.
    \part \tfq[T] Every dog has four legs.
    \part \tfq[F] Every animal which barks and is born with four legs
    is a dog.
  \end{parts}

  \question [6] Compute to the last digit the value of $\pi$.
\end{questions}

\end{document}

输出:

在此处输入图片描述


要打印答案,只需取消注释该% \printanswers行。

要开始其他自定义,例如点位置、外观等,请参阅exam文档


尖端

为了在右边距放置要点,我发现以下方法非常方便:

\usepackage[dvips,pdftex,legalpaper,top=10.0mm,bottom=15.0mm,includeheadfoot,left=20.0mm,right=25.0mm]{geometry}

\pointsinrightmargin
\setlength{\rightpointsmargin}{10.0mm}

相关内容