具有自定义标签的多列水平枚举

具有自定义标签的多列水平枚举

根据我发现的情况,我有一个问题这里。我希望将这些项目的标签从数字更改为单词后跟数字。具体来说,我希望看到:

Problem 1: stuff here    Problem 2: next thing's stuff here

ETC。

因为我使用 each\item而不仅仅是:

1. stuff here
2. next thing's stuff here

ETC。

对于正常情况,enumerate您可以使用[label=Problem \arabic*:]附加到声明中的方法,但在这种情况下似乎不起作用。

答案1

修改的egreg 的回答来自问题提供的链接。

\documentclass{article}

\setlength{\parindent}{0mm}

\usepackage{paralist}
\usepackage{tabto}

\newenvironment{tabbedenum}[1]
 {\NumTabs{#1}\inparaenum\let\latexitem\item
  \def\item{\def\item{\tab Problem~\latexitem}Problem~\latexitem}}  %%<<-- just add Problem~ here
 {\endinparaenum}

\begin{document}

\begin{tabbedenum}{3}
\item text
\item text
\item text
\item text
\item text
\item text
\end{tabbedenum}

\bigskip

\NumTabs{3}
\begin{inparaenum}
\item text
\tab\item text
\tab\item text
\tab\item text
\tab\item text
\tab\item text
\end{inparaenum}

\end{document}

在此处输入图片描述

现在有tasks来自克莱门斯的回答

\documentclass{article}
\usepackage{exsheets}

% \NewTasks[options]{name}[separator](default number of columns)
% all arguments except {name} are optional
\NewTasks[counter-format=Problem~tsk[1]:,label-width=5.5em,label-format=\bfseries]{tabbedEnum}[\item](3)

\usepackage{lipsum}% for dummy text

\begin{document}

\lipsum[1]

\begin{tabbedEnum}
 \item text
 \item text
 \item text
 \item text
 \item text
 \item text
\end{tabbedEnum}

\lipsum[2]

\end{document}

在此处输入图片描述

答案2

像这样?

问题

\documentclass{article}
\usepackage[inline]{enumitem}
\begin{document}
  \begin{enumerate*}[label=Problem (\arabic*)]
    \item first
    \item second
    \item third
  \end{enumerate*}
\end{document}

答案3

这是基于shortlst软件包的解决方案,带有一个小补丁:我引入了 3 个键:(nc列数;默认为 3),il(行间拉伸,默认为 1,在公式非常高的情况下可能有用)和ls(\labelsep 的值,默认为 0.6em)。它还使用xkeyvalsetspace

如果 \item 大于一列,则它将占用尽可能多的列。我引入了一个\paritem命令,它将项目主体设置在 \parbox 中,该 \parbox 占用选定的列数(默认为 1)。它提供了一种控制项目占用的列数的方法。

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage{shortlst,setspace,xkeyval}%

\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}
\settowidth{\labelwidth}{\mbox{\itshape Problem 0\hskip0.25em}}
\setlength{\leftmargini}{\dimexpr\labelwidth+\labelsep\relax}%[1][3]
\setlength{\shortitemwidth}{\dimexpr\linewidth/\value{ncol}-\labelwidth-2\labelsep\relax}%
\setstretch{\@intln}
\everymath{\displaystyle}
\begin{shortenumerate}}%
{\end{shortenumerate}
}%
\newcommand\paritem[2][1]{\item \parbox[t]{\dimexpr#1\shortitemwidth +(\labelwidth + \labelsep + \itemindent)* \numexpr#1-1\relax\relax}{\setstretch{1}\leavevmode#2\strut\medskip}}
\makeatother
\renewcommand{\labelenumi}{\itshape Problem \arabic{enumi}.}
\makeatother

\begin{document}


\noindent Solve the following equations:
\begin{tabenumerate}[nc=3]
  \item Stuff here.
  \item Next thing’s stuff here. It requires 2 columns. \label{pb2}
  \item Stuff there.
  \paritem{Equation $4$ is another long equation in only one column. }
  \item Still stuff.
  \paritem[2] {\label{pb6} Equation $6$ is a second long equation. It stretches along two columns and no more.}
  \item A small problem.
  \item Equation $8$ is also a very very long equation, but its stretches ‘naturally’.

\end{tabenumerate}
We see by problems \ref{pb2} and \ref{pb6} that cross-references seem to work in this context.

\end{document} %

在此处输入图片描述

相关内容