在枚举环境中对每一项添加括号(真/假问题)

在枚举环境中对每一项添加括号(真/假问题)

我想做点类似的事情

\documentclass{article}
\usepackage{amsmath,amssymb,enumerate}
\newcounter{num}
\newcommand{\exam}[1]
{\bigskip\bigskip\noindent\refstepcounter{num}\textbf{Example \arabic{num})} #1\par\noindent}

\begin{document}

%
\exam{Read the following sentences and write 'O' or 'X' in each bracket}
\begin{enumerate}[(1)]
\item
If \(x\) is real, then \(\sqrt{(x-1)^2}=|x-1|\).
\(\quad\cdots\cdots\cdots\cdots\cdots\cdots\cdots\quad\)[\qquad]
\item
If \(y\) is real, then \(\sqrt{y^2}=y\).
\(\quad\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\quad\)[\qquad]
\item
If \(t\le0\), then \(\sqrt t^2\neq t\).
\(\quad\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\cdots\quad\)[\qquad]
\end{enumerate}
\end{document}

结果就是这样。这

我手动输入了类似的命令,但我更愿意自动执行此操作,以便生成括号并将其对齐到包中\(\cdots\)每个括号的最右侧itemenumerate

答案1

使用\dotfill

\documentclass{article}
\usepackage{amsmath,amssymb,enumerate}
\newcounter{num}
\newcommand{\exam}[1]
{\bigskip\bigskip\noindent\refstepcounter{num}\textbf{Example \arabic{num})} #1\par\noindent}

\begin{document}

%
\exam{Read the following sentences and write 'O' or 'X' in each bracket}
\begin{enumerate}[(1)]
\item
If \(x\) is real, then \(\sqrt{(x-1)^2}=|x-1|\).
\dotfill[\qquad]
\item
If \(y\) is real, then \(\sqrt{y^2}=y\).
\dotfill[\qquad]
\item
If \(t\le0\), then \(\sqrt t^2\neq t\).
\dotfill[\qquad]
\end{enumerate}
\end{document}

在此处输入图片描述

或者用\cdots。(非常感谢 @Fractal 给我发送 ping 消息!)

\documentclass{article}
\usepackage{amsmath,amssymb,enumerate}
\newcounter{num}
\newcommand{\exam}[1]
{\bigskip\bigskip\noindent\refstepcounter{num}\textbf{Example \arabic{num})} #1\par\noindent}

\begin{document}

%
\exam{Read the following sentences and write 'O' or 'X' in each bracket}
\begin{enumerate}[(1)]
\item
If \(x\) is real, then \(\sqrt{(x-1)^2}=|x-1|\).
{\leaders\hbox{$\,\cdot$}\hfill}[\qquad]
\item
If \(y\) is real, then \(\sqrt{y^2}=y\).
{\leaders\hbox{$\,\cdot$}\hfill}[\qquad]
\item
If \(t\le0\), then \(\sqrt t^2\neq t\).
{\leaders\hbox{$\,\cdot$}\hfill}[\qquad]
\end{enumerate}
\end{document}

在此处输入图片描述

或者

\documentclass{article}
\usepackage{amsmath,amssymb,enumerate}
\newcounter{num}
\newcommand{\exam}[1]
{\bigskip\bigskip\noindent\refstepcounter{num}\textbf{Example \arabic{num})} #1\par\noindent}

\newcommand{\Cdotfill}{\leaders\hbox{$\,\cdot$}\hfill}
\begin{document}

%
\exam{Read the following sentences and write 'O' or 'X' in each bracket}
\begin{enumerate}[(1)]
\item
If \(x\) is real, then \(\sqrt{(x-1)^2}=|x-1|\).
\Cdotfill[\qquad]
\item
If \(y\) is real, then \(\sqrt{y^2}=y\).
\Cdotfill[\qquad]
\item
If \(t\le0\), then \(\sqrt t^2\neq t\).
\Cdotfill[\qquad]
\end{enumerate}
\end{document}

相关内容