制作水平和垂直连续列表

制作水平和垂直连续列表

我正在寻找在 Latex 文章类中布置作业和测试的方法。我希望能够非常轻松地完成以下操作:

在此处输入图片描述

几件事:我希望 a) 或 c) 中的文本能够环绕两列之间假想的“分隔线”。另外,如果程序能够同时跟踪两列的计数器就更好了;否则,这还不如在 MS Word 中完成——我正在将其移植到 LaTeX 以用于数学模式。

答案1

您可以将其用于tasks内部列表。

\documentclass{article}
\usepackage{enumitem}
\usepackage[more]{tasks}

\NewTasks[style=enumerate,counter-format=tsk[a]),label-width=2.6ex,column-sep=2ex,before-skip=2pt,item-indent = {1em}]
                        {questions}[\subquestion](2)
\begin{document}
\begin{enumerate}[nosep]
  \item Answer any  of the following questions as you wish.
  \begin{questions}
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question. How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
  \end{questions}
  \item You don't have to answer any of these questions as they may be difficult.%  << this % is needed
  \begin{questions}
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question. How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
  \end{questions}
  \item You don't have to answer any of these questions as they may be difficult.%  << this % is needed
  \begin{questions}
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question. How are you doing? If doing well, answer this question.
    \subquestion How are you doing? If doing well, answer this question.
  \end{questions}
\end{enumerate}
\end{document}

在此处输入图片描述

答案2

shortlst和包的解决方案enumitem。您可以选择列数(键nc,默认为 3)、考虑大公式的内衬(键il,默认为 1)以及项目标签和项目主体之间的距离(键ls,默认为 0.6em)。如有必要,项目将自动地使用多列。

例子:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{shortlst, setspace, amsmath}
\usepackage{enumitem} 
\newlist{exercises}{enumerate}{2}
\setlist[exercises,1]{label=\arabic*. , wide=0pt}
\usepackage{etoolbox}

\AtBeginEnvironment{tabenumerate}{\renewcommand\theenumi{\alph{enumi})}
\settowidth{\labelwidth}{\mbox{(m)}}}


\makeatletter
\newcounter{ncol}
\define@key{lex}{nc}[3]{\setcounter{ncol}{#1}}%% 3 columns by default
\define@key{lex}{il}[1.5]{\def\@intln{#1}}% interlining![1]
\define@key{lex}{ls}[0.6em]{\setlength{\labelsep}{#1}}%%distance between label and item body
\newenvironment{tabenumerate}[1][]{%\setlength\labelsep{0.6em}
\setkeys{lex}{nc,il,ls, #1}
\setlength{\leftmargini}{\dimexpr\labelwidth+\labelsep\relax}%[1][3]
\setlength{\shortitemwidth}{\dimexpr\linewidth/\value{ncol}-\labelwidth-2\labelsep\relax}%
\setstretch{\@intln}
\begin{shortenumerate}\everymath{\displaystyle}}%
{\end{shortenumerate}
 }%
 \newcommand\paritem[2][1]{\item \parbox[t]{#1\shortitemwidth}{\setstretch{1}#2\medskip}}
\makeatother

\begin{document}

\vspace*{1cm}
\begin{exercises}
\item For the following questions, \&c. \vspace{-\baselineskip}
 \begin{tabenumerate}[nc=3, il =2.5, ls =1em]
 \item $ a_n = \frac{4n^3 - (-1)^nn^2}{5n + 2n^3}$
 \item $ b_n = \frac{(n^3 - 5n)^4 - n^{12}}{n^{11}}$
 \item $ c_n = \frac{n^{n + 1}}{n!}$\label{q-3}
 \item $ e_n = \frac{2^{(n^3)}}{n!5^{(n^2)} - n^n}$
 \item $ f_n = \sqrt{n + \sqrt{2n}} - \sqrt{n + \sqrt{2n}}\mkern1mu x$
 \end{tabenumerate}
\end{exercises}
See question \ref{q-3}.

\end{document} 

在此处输入图片描述

相关内容