3

I have a question based on what I found here. I was hoping to change the labels of these items from numbers to a word followed by a number. In particular, I would like to see:

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

etc.

as I use each \item rather than just:

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

etc.

For a normal enumerate you would use [label=Problem \arabic*:] attached to the declaration, but that doesn't seem to work in this case.

Jeremie
  • 509

3 Answers3

5

Modified egreg's answer from the link provided in the question.

\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}

enter image description here

Now with tasks package from Clemens answer

\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}

enter image description here

1

Like this?

problems

\documentclass{article}
\usepackage[inline]{enumitem}
\begin{document}
  \begin{enumerate*}[label=Problem (\arabic*)]
    \item first
    \item second
    \item third
  \end{enumerate*}
\end{document}
cfr
  • 198,882
  • Not quite; the other method has nice column spacing associated with it that I would like to preserve. – Jeremie Aug 20 '15 at 03:14
1

This is a solution based on the shortlst package, with a small patch: I introduced $3$ keys: nc (number of columns; $3$ by default), il (interline stretch, 1 by default, may be useful in case of very high formulae) and ls (the value of \labelsep, 0.6em by default). It also uses xkeyval and setspace.

An \item, if larger than one column, will occupy as many columns as necessary. I introduce a \paritem command, that sets the item body in a \parbox that occupies a chosen number of columns (1 by default). It gives a way to control the number of columns that an item occupies.

\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} %

enter image description here

Bernard
  • 271,350