11
\documentclass[a4paper]{article}

\usepackage[inline]{enumitem}

\begin{document}

\begin{itemize*}
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\end{document}

The above code gives

enter image description here

I need two items per row when i give

\begin{itemize*}(2)
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

I need three items per row when i give

\begin{itemize*}(3)
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

Something similar to "tasks" using "enumitem"

The output similar to

enter image description here

11

enumitem is not really needed for this (without more context, of course). xparse provides an easy way to create optional arguments with delimiters other than []:

enter image description here

\documentclass{article}

\usepackage{xparse}% http://ctan.org/pkg/xparse
\newcounter{itemcntr}
\DeclareDocumentEnvironment{itemize*}{D(){1234}}
  {\setcounter{itemcntr}{0}%
   \renewcommand{\item}{\stepcounter{itemcntr}%
     \ifnum\value{itemcntr}>#1\relax\par\setcounter{itemcntr}{1}\fi%
     \textbullet\hspace*{\labelsep}\nobreak}}% \begin{itemize*}
  {}% \end{itemize*}

\begin{document}

\begin{itemize}
  \item First point
  \item Second point
  \item Third point
\end{itemize}

\begin{itemize*}
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\begin{itemize*}(2)
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\begin{itemize*}(3)
  \item First point
  \item Second point
  \item Third point
  \item Fourth point
  \item Fifth point
  \item Sixth point
  \item Seventh point
  \item Eighth point
  \item Ninth point
  \item Tenth point
\end{itemize*}

\end{document}

The above MWE provides itemize* that takes a single optional argument (<num>), setting a "list" inline (like enumitem's [inline] option). After <num> entries, a paragraph break \par is inserted. <num> is set by default to 1234 (just a large enough number)...


A complete revamp to accommodate the new request: Itemized list spread across the page the are horizontally aligned.

enter image description here

\documentclass{article}
\usepackage{environ,multido,calc}% http://ctan.org/pkg/{environ,multido,calc}
\makeatletter
% Taken from https://tex.stackexchange.com/a/128318/5764
\newcounter{listcount}% Keep track of \item
\let\olditem\item% Store regular \item macro
\NewEnviron{itemize*}[1][5]{%
  \setcounter{listcount}{0}% Start with 0 \items
  \g@addto@macro{\BODY}{\item\relax\item}% Used to delimit the items; last item identified by \item\relax\item
  \def\item##1\item{% Redefine \item to capture contents
    \def\optarg{##1}%
    \expandafter\ifx\optarg\relax\else% Last item not reached
      \stepcounter{listcount}% Next item being processed
      \expandafter\gdef\csname inlineitem@\thelistcount\endcsname{##1}% Store item in control sequence
      \expandafter\item% Recursively continue processing items
    \fi
  }%
  \BODY% Process environment (save items)
  \setlength{\@tempdima}{\linewidth/#1}% Set length of each \item \parbox; possibly corrent...
  \ifnum\value{listcount}<#1\relax\setlength{\@tempdima}{\linewidth/\value{listcount}}\fi%... if needed
  \par\noindent% Start new non-indented paragraph
  \multido{\i=1+1}{\value{listcount}}{% Insert all items in a \parbox
    \parbox[t]{\@tempdima}{\raggedright\hangindent=1.5em\hangafter=1% Paragraph formatting
      \makebox[1.5em][r]{\textbullet\space}\strut\csname inlineitem@\i\endcsname\strut}\hspace{0pt}}%
}
\makeatother
\begin{document}

\begin{itemize*}
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\noindent\hrulefill

\begin{itemize*}[2]
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\noindent\hrulefill

\begin{itemize*}[3]
  \item First point
  \item Second point
  \item Third point
  \item Fourth point
  \item Fifth point
  \item Sixth point
  \item Seventh point
  \item Eighth point
  \item Ninth point
  \item Tenth point
\end{itemize*}

\noindent\hrulefill

\begin{itemize*}[3]
  \item First point First point First point First point First point First point First point
  \item Second point Second point Second point Second point Second point Second point Second point
  \item Third point Third point Third point Third point Third point Third point Third point
  \item Fourth point Fourth point Fourth point Fourth point Fourth point Fourth point Fourth point
  \item Fifth point Fifth point Fifth point Fifth point Fifth point Fifth point Fifth point
  \item Sixth point Sixth point Sixth point Sixth point Sixth point Sixth point Sixth point
\end{itemize*}

\end{document}

The first step is to mimic a list, but actually capture each \item in a macro. This is done using some help from Order items in enumerate environment automatically. Once each item is captured, it is sequentially printed in a \parbox (with some default formatting that can be adjusted) that spans exactly a portion of \linewidth so that exactly the number of items specified fits within it. A minor check is performed to make sure the default is not adhered to when there are fewer items in the list.

  • I need the two or three items evenly spaced in the row like choices in multiple choice questions – sandu Dec 9 '13 at 6:49
  • @sandu: That is soooo not what you asked... And by "evenly spaced" you probably also want the items to line up underneath one another from one row to the next, right? – Werner Dec 9 '13 at 6:54
  • Yes you are right. – sandu Dec 9 '13 at 7:02
  • wouldn't an added multicols env plus a \vfill be enough if the columns are filled from left to right. That is what I usually use. – daleif Dec 9 '13 at 8:45
2

The proposed syntax and your sentence

Something similar to "tasks" using "enumitem"

makes me believe you already know the tasks package. Why don't you use it?

\documentclass{article}
\usepackage[more]{tasks}
\NewTasks[style=itemize]{itemize*}[\item]
\begin{document}

\begin{itemize*}(2)
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\begin{itemize*}(3)
  \item First point
  \item Second point
  \item Third point
  \item Fourth point
  \item Fifth point
  \item Sixth point
  \item Seventh point
  \item Eighth point
  \item Ninth point
  \item Tenth point
\end{itemize*}

\end{document}

enter image description here

If you want hollow bullet points (as requested in a comment) you can set textcomp's \textopenbullet as label:

\documentclass{article}
\usepackage{tasks}
\usepackage{textcomp}
\NewTasks[
  label =  \textopenbullet ,
  after-item-skip = 0pt plus 1ex ,
  label-offset = -1pt
]{itemize*}[\item]
\begin{document}

\begin{itemize*}(2)
  \item First point
  \item Second point
  \item Third point
\end{itemize*}

\begin{itemize*}(3)
  \item First point
  \item Second point
  \item Third point
  \item Fourth point
  \item Fifth point
  \item Sixth point
  \item Seventh point
  \item Eighth point
  \item Ninth point
  \item Tenth point
\end{itemize*}

\end{document}

enter image description here

  • How to make change this textdot into hollowcircle? – sandu Dec 10 '13 at 9:26
  • @sandu I updated my answer – clemens Dec 10 '13 at 10:06
  • label= $\circ$ may be used – sandu Dec 11 '13 at 6:01
  • @sandu You can use whatever you like. I prefer text symbols for text and math symbols for math... – clemens Dec 11 '13 at 8:29
2

You can do what you require for an enumerate environment using the tablists package.

However the shortlst package allows a simpler syntax and works with the itemize environment.

Here is a code that defines a tabitemize environment, with an optional argument, the number of columns of this environment (3 by default). The main advantage of using shortlst is that, given that each column has a calculated width, if an item's width is too large for one column, it automatically uses two columns.

\documentclass[a11pt, a4paper]{article}  
\usepackage[utf8]{inputenc}  
\usepackage[T1]{fontenc}
\usepackage[textwidth=15cm]{geometry}

\usepackage{shortlst} 
\newenvironment{tabitemize}[1][3]{%  
\settowidth{\labelwidth}{\labelitemi}%
\setlength{\leftmargini}{\dimexpr\parindent + \labelwidth + \labelsep\relax}%
\setlength{\shortitemwidth}{\dimexpr\linewidth/#1-\labelwidth-2\labelsep\relax}%
\begin{shortitemize}}%
{\end{shortitemize}}%

\begin{document}
Here is an example:  

\begin{tabitemize}[4]
  \item First item
  \item Second item
  \item Third item
  \item Fourth item
  \item Fifth,  sixth and seventh item
  \item Eighth item
\end{tabitemize}

\end{document} 

Result

Unfortunately, shortlst package isn't in MiKTeX nor TeX Live distributions. It can be downloaded directly from CTAN, e.g.

http://dante.ctan.org/tex-archive/macros/latex/contrib/shortlst.zip

  • I modified the line that begins with \setlength{\leftmargini}, which required loading the calc package to work as expected. – Bernard Dec 10 '13 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.