複数段に列挙する

複数段に列挙する

次の画像は私が探しているものを示しています。

ここに画像の説明を入力してください

基本的には、上記のように番号付けを行いたいのですが、multicolandenumitemパッケージを使用します。しかし、次のコードを使用して試してみると、

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{enumitem,multicol}
\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{multicols}{2}
    \begin{enumerate}[itemsep=1cm]% The item sep is my choice here.
    \item $\dfrac{|x|}{x}$
    \item $\dfrac{x}{|x|}$
    \item $\dfrac{|-x|}{-x}$
    \item $|x|-|-x|$
    \end{enumerate} 
    \end{multicols}
\end{enumerate}
\end{document}

次のような結果になります:

ここに画像の説明を入力してください

基本的に、 を(b)がある場所に配置したいのです(c)。これがすでに実行されていることは知っていますが、見つけることができません。

答え1

以下は、定義されたコマンドを使用するオプションです\newitem。内容は、\parbox自然に左から右に流れる に設定され、必要なスタイルで列挙を提供します。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{amsmath,amssymb}% http://ctan.org/pkg/{amsmath,amssymb}
\usepackage{enumitem,multicol,setspace}% http://ctan.org/pkg/{enumitem,multicol,setspace}
\newcounter{subenum}[enumi]
\renewcommand{\thesubenum}{\alph{subenum}}
\newcommand{\newitem}[1]{%
  \refstepcounter{subenum}%
  \parbox{\dimexpr.5\linewidth-.5\columnsep}{%
    \makebox[\labelwidth][r]{(\thesubenum)\hspace*{\labelsep}}%
    #1}\hfill%
}
\begin{document}
\begin{enumerate}[start=8]
  \item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{multicols}{2}
      \begin{enumerate}[itemsep=1cm]% The item sep is my choice here.
        \item $\dfrac{|x|}{x}$
        \item $\dfrac{x}{|x|}$
        \item $\dfrac{|-x|}{-x}$
        \item $|x|-|-x|$
      \end{enumerate} 
    \end{multicols}
  \item Evaluate each of the following if $x$ is a non-zero real number.\par
    \setstretch{3}%
    \newitem{$\dfrac{|x|}{x}$}
    \newitem{$\dfrac{x}{|x|}$}
    \newitem{$\dfrac{|-x|}{-x}$}
    \newitem{$|x|-|-x|$}
\end{enumerate}
\end{document}

間隔の考慮は、setspace微調整も可能です (\topsep必要に応じて、追加の「 」空白も削除します)。


列数の変更をもう少し自動化するには、

\usepackage[nomessages]{fp}% http://ctan.org/pkg/fp

文書の序文に

\FPeval\thecolwidth{round(1/4:4)}% Specify number of columns -> column width
\newcommand{\newitem}[1]{%
  \refstepcounter{subenum}%
  \parbox{\dimexpr\thecolwidth\linewidth-.5\columnsep}{%
    \makebox[\labelwidth][r]{(\thesubenum)\hspace*{\labelsep}}%
    #1}\hfill%
}

の定義として を使用します\newitem。列数を増やすには1/4を変更します。1/<col nums>

答え2

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{amsmath,amssymb}
%\tracingall
\def\horizlist#1#2#3{%
  \setcounter{enumi}{0}%
  #3%
  \flushleft
  \dimen0 \linewidth
  \divide\dimen0 by #1\relax
  \advance\dimen0 -#2\relax
  \def\item{\hfil\egroup\penalty50 \hfill
  \refstepcounter{enumi}%
  \leavevmode\hbox to \dimen0 \bgroup\space(\theenumi)\space}%
  \leavevmode\bgroup\hskip 0pt plus -1fill }

\def\endhorizlist{\hfil\egroup\endflushleft}

\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.
    \begin{horizlist}{2}{1cm}{\renewcommand\theenumi{\alph{enumi}}}
    \item $\dfrac{|x|}{x}$
    \item $\dfrac{x}{|x|}$
    \item $\dfrac{|-x|}{-x}$
    \item $|x|-|-x|$
    \end{horizlist}
\end{enumerate}
\end{document}

ここで何が起こっているかを確認するには、番号付けを右から左、そして下に行う場合、これは通常の段落の語順なので、固定幅のボックスのシリーズを作成するだけです。それらが (たとえば) テキスト幅の 1/3 で、左揃えの段落でそのようなボックスの段落を作成すると、Tex は自然に段落を 3 つのボックスで 1 行に折り返し、すべて同じ幅であるため垂直に揃えます。コードの残りの部分は、カウンターを増分してボックスの先頭に (\the...) を配置し、構文を非表示にして\makebox[0.3\textwidth]{...}標準\item構文を使用するようにして、リストの種類を簡単に切り替えられるようにします。

言い換えれば、表面的な構文の変更以外は同じである次のものと比較してください。

ここに画像の説明を入力してください

\documentclass{article}

\begin{document}
\begin{flushleft}

\makebox[.3\textwidth][l]{one one}
\makebox[.3\textwidth][l]{two 2 two 2 two}
\makebox[.3\textwidth][l]{three three 3}
\makebox[.3\textwidth][l]{4 4 4 4 4 }
\makebox[.3\textwidth][l]{fifth box}
\makebox[.3\textwidth][l]{number 6}
\makebox[.3\textwidth][l]{7 7 7 7 }
\makebox[.3\textwidth][l]{eight}
\makebox[.3\textwidth][l]{nine nine}
\makebox[.3\textwidth][l]{10}

\end{flushleft}
\end{document}

結果は 3 列になっているように見えますが、段落内の各「単語」が同じサイズのボックスであるため、配置が自動的に行われるタイプセットされた段落にすぎません。

答え3

これは簡単ですexsheetsパッケージとtasksパッケージ。次の例を見れば、その意味は一目瞭然でしょう。

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{mathtools}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\usepackage{exsheets}% loads the `tasks' package
\SetupExSheets{
  headings = runin-nr
}
\settasks{
  counter-format = tsk[a]. ,
  label-format = \sffamily\itshape\bfseries
}

\setcounter{question}{43}% only for this example

\begin{document}

\begin{question}
  Evaluate each of the following if $x$ is a non-zero real number.
  \begin{tasks}(2)
    \task $\dfrac{\abs{x}}{x}$
    \task $\dfrac{x}{\abs{x}}$
    \task $\dfrac{\abs{-x}}{-x}$
    \task $\abs{x}-\abs{-x}$
  \end{tasks}
\end{question}

\end{document}

ここに画像の説明を入力してください

答え4

これはresumeenumitemパッケージ。コードがenumerate環境をあまりにも停止し始めるため、最も効率的ではありません。しかし、結果は視覚的に許容できます。これは単なる表形式の環境なので、あらゆる種類の追加の調整を導入できます。

\documentclass{article}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
\newcommand{\Choices}[4]{\begin{tabular}{p{0.5\textwidth} p{0.5\textwidth}} 
\begin{enumerate*}[series=lafter]
    \item #1
\end{enumerate*} &%
\begin{enumerate*}[resume=lafter]
    \item #2
\end{enumerate*} \\[2\baselineskip]
\begin{enumerate*}[resume=lafter]
    \item #3
\end{enumerate*} &%
\begin{enumerate*}[resume=lafter]
    \item #4
\end{enumerate*}
\end{tabular}}

\begin{document}
\begin{enumerate}
\item Evaluate each of the following if $x$ is a non-zero real number.

\Choices{$\dfrac{|x|}{x}$}{$\dfrac{x}{|x|}$}{$\dfrac{|-x|}{-x}$}{$|x|-|-x|$}

\item Evaluate each of the following if you can.

\Choices{This question is not answerable (is that a real word?)}
{This question does not have any correct answer}
{$\int_0^\pi{\tan\sqrt\theta d\theta}$}
{Whatever is a valid answer!}
\end{enumerate}
\end{document}

ここに画像の説明を入力してください

関連情報