使用方程式平衡多元醇

使用方程式平衡多元醇

我给学生布置了一道题目,题目涉及八个极限/函数要求,希望它们均匀分布在两行上。代码如下:

\documentclass[11pt, bothsides]{exam}
\usepackage{multicol}
\usepackage{amsmath}
\extrawidth{1in}
\begin{document}
\begin{questions}
\question[10] Draw an example of a function $f(x)$ that satisfies the following conditions:
\newline
\begin{multicols}{4}
    $$\lim_{x\to-2}f(x)=1$$
    $$f(-2)=\text{DNE}$$
    $$\lim_{x\to2^-}f(x)=-4$$
    $$f(2)=3$$
    $$\lim_{x\to2}f(x)=\text{DNE}$$
    $$f(4)=-2$$
    $$\lim_{x\to4}f(x) \hspace{.1in} \text{exists}$$
    $$\lim_{x\to4}f(x)\neq f(4)$$
\end{multicols}
\end{questions}
\end{document}

但输出是这样的:

注意不均匀的第一列

你知道为什么会出现这种情况吗?我认为这可能是由于 extrawidth 命令造成的,但删除它只会让事情变得更加糟糕:

一切都已成定局

有什么想法吗?这不是什么大问题,但我想帮助理解事情。也许数组会更好?

答案1

由于您还要加载amsmath包,因此不妨利用其alignat*环境来排列这 8 个方程式。在下面的示例中,我已将列4em之间的距离设置为(相当于 4 个“四边形”);您可以根据需要随意修改间距。

在此处输入图片描述

\documentclass[11pt, bothsides]{exam}
\usepackage{amsmath}
\extrawidth{1in}
\begin{document}
\begin{questions}
\question[10] Draw an example of a function $f(x)$ that satisfies the following conditions:

\begin{alignat*}{4}
&\lim_{x\to-2}f(x)=1&\hspace{4em}&
 f(-2)=\text{DNE}&\hspace{4em}&
 \lim_{x\to2^-}f(x)=-4&\hspace{4em}&
 f(2)=3\\
&\lim_{x\to2}f(x)=\text{DNE}&&
 f(4)=-2&&
 \lim_{x\to4}f(x) \text{ exists}&&
 \lim_{x\to4}f(x)\neq f(4)
\end{alignat*}
\end{questions}
\end{document}

我认为multicols环境主要用于文本。使用(滥用?!)此环境来排版一堆显示的方程式可能会引发各种问题,而这些问题是该包的作者从未考虑过的。如果出于某种原因,您必须在代码中使用它,我建议您使用环境而不是 8 个单独显示的方程式。哦,观察aftergather*的使用。\noindent\begin{multicols}{4}

在此处输入图片描述

\documentclass[11pt, bothsides]{exam}
\usepackage{amsmath,multicol}
\allowdisplaybreaks
\extrawidth{1in}
\begin{document}
\begin{questions}
\question[10] Draw an example of a function $f(x)$ that satisfies the following conditions:

\begin{multicols}{4}
\noindent
\begin{gather*}
\lim_{x\to-2}f(x)=1\\
f(-2)=\text{DNE}\\
\lim_{x\to2^-}f(x)=-4\\
f(2)=3\\
\lim_{x\to2}f(x)=\text{DNE}\\
f(4)=-2\\
\lim_{x\to4}f(x) \text{ exists}\\
\lim_{x\to4}f(x)\neq f(4)
\end{gather*}
\end{multicols}
\end{questions}
\end{document}

相关内容