\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm,mathtools,systeme}
\usepackage[tikz]{bclogo}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
\newcommand{\isEquivTo}[1]{\underset{#1}{\sim}}
%----------------------------debut multiple choice------------------
\usepackage{enumitem}
\usepackage{multicol}
\newlist{choices}{enumerate}{1}
\setlist[choices]{label*=(\alph*)}
\newcommand{\choice}{\item}
\SetEnumitemKey{twocol}{
before=\raggedcolumns\begin{multicols}{2},
after=\end{multicols}}
\SetEnumitemKey{threecol}{
before=\raggedcolumns\begin{multicols}{3},
after=\end{multicols}}
\SetEnumitemKey{fourcol}{
before=\raggedcolumns\begin{multicols}{4},
after=\end{multicols}}
%----------------------------Fin multiple choice------------------
\begin{document}
\noindent Choose the one correct answer by circling it below:
\begingroup % localize scope of the next two instructions
\addtolength\abovedisplayskip{-12pt}
\addtolength\belowdisplayskip{-12pt}
\begin{itemize}
\item[(1)] Determine the correct characteristic equation for the differential equation $y'' - 4y' + 4y = 0$.
\begin{choices}[twocol]
\choice $r^2 - 4r + 4 = 0$
\choice $r^2 + 4r + 4 = 0$
\choice $r^2 + 2r + 1 = 0$
\choice $r^2 - 2r + 1 = 0$
\end{choices}
\item [(2)] State which of the following function is a solution of the differential equation: $y''-2y'+y=0$
\begin{choices}[twocol]
\choice $y=1+e^x$
\choice $y=xe^x$
\choice $y=x+e^x$
\choice $y=e^x$
\end{choices}
\item [(3)] In the context of the differential equation $(E): y'' - 2y' + y = 5e^x$, a particular solution is in the form:
\begin{choices}[twocol]
\choice $y_p=Ae^x$
\choice $y_p=Axe^x$
\choice $y_p=Ax^2e^x$
\choice $y_p=A+e^x$.
\end{choices}
Here, $A$ is a nonzero constant.
\end{itemize}
\endgroup
\end{document}
我想改善这里的间距。我尝试使用“\begingroup”,但没有看到任何变化。
答案1
我建议使用 ,tasks
因为它更具可定制性(并保证同一行上的选项正确对齐,而 则不是这种情况multicol
)。此外,阅读顺序也更自然。
\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm,mathtools,systeme}
\usepackage[tikz]{bclogo}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
%----------------------------debut multiple choice------------------
\usepackage{enumitem}
\usepackage{tasks}
\NewTasksEnvironment[
label-width=20pt,
label=(\alph*),
before-skip=0.5\topsep,
after-skip=0.5\topsep,
after-item-skip=2\itemsep,
]{choices}[\choice]
\newcommand{\isEquivTo}[1]{\underset{#1}{\sim}}
%----------------------------Fin multiple choice------------------
\begin{document}
\noindent Choose the one correct answer by circling it below:
\begin{enumerate}[label=(\arabic*)]
\item Determine the correct characteristic equation for the
differential equation $y'' - 4y' + 4y = 0$.
\begin{choices}(2)
\choice $r^2 - 4r + 4 = 0$
\choice $r^2 + 4r + 4 = 0$
\choice $r^2 + 2r + 1 = 0$
\choice $r^2 - 2r + 1 = 0$
\end{choices}
\item State which of the following function is a solution
of the differential equation: $y''-2y'+y=0$
\begin{choices}(2)
\choice $y=1+e^x$
\choice $y=xe^x$
\choice $y=x+e^x$
\choice $y=e^x$
\end{choices}
\item In the context of the differential equation
$(E): y'' - 2y' + y = 5e^x$, a particular solution is in the form:
\begin{choices}(4)
\choice $y_p=Ae^x$
\choice $y_p=Axe^x$
\choice $y_p=Ax^2e^x$
\choice $y_p=A+e^x$.
\end{choices}
Here, $A$ is a nonzero constant.
\end{enumerate}
\end{document}