[Tex/LaTex] Inline arrangement using “enumitem”

enumitemlists

\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

Best Answer

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.