101

This might seem like a very simple question, but what is the easiest way to turn a normal vertical list into a horizontal one?

94

The enumitem package has an inline option which implements inline versions of the standard lists using starred versions of the basic list environments. As with other enumitem lists, labels and (horizontal) spacing can be set with key values as well as custom settings for the elements between the list items (typically punctuation).

\documentclass{article}

\usepackage[inline]{enumitem}

\begin{document}

Text before list.
\begin{enumerate*}
  \item My first in list.
  \item My second in list.
\end{enumerate*}
Text after list.

\end{document}

output of code

|improve this answer|||||
  • 1
    How do you make this work so that the lists have an equal number of items on each row and the rows are vertically aligned? – Jeff Mar 13 '16 at 19:49
  • 3
    @jeff This is not the right tool for achieving that. This is mainly intended for lists in running text. For equally spaced list elements you can use the multicol package with a regular list. – Alan Munn Mar 13 '16 at 20:47
  • @Jeff And depending on what you are doing, (e.g. multiple choice questions) there are nice packages designed specifically for that. e.g. exsheets, answers, etc. – Alan Munn Mar 13 '16 at 20:58
  • multicol does not work because it only aligns the lists vertically -- but who reads vertically? Next time I need this I'll look at the other two packages you suggest. TY. – Jeff Mar 17 '16 at 23:25
  • 2
    @MartinUeding I think that inline lists have very limited uses, and the context should make clear what they are, for example by prefacing the list with expressions that explicitly mention the count: There are three main properties: (i)... ;(ii) ... and (iii) ... This is also why there are options for punctuation between items and for the last item. Multi-sentence items are really not a good idea in this sort of list. – Alan Munn Jul 3 '17 at 16:14
48

If you use the enumitem package, you can pass the option [inline]. Doing this enables starred environments corresponding to the regular ones which produce inline lists (\begin{enumerate*}, \begin{itemize*} etc.):

\documentclass{article}
\usepackage[inline]{enumitem}

\begin{document}

Text before list.
\begin{enumerate*}[label=(\roman*)]
  \item My first in list.
  \item My second in list.
\end{enumerate*}
Text after list.

\end{document}

This package gives you a lot of control over the formatting of enumerate, itemize and description environments and lets you control their style globally or locally, to create custom environments based on the defaults, and to easily specify a range of formatting options. The above example produces an inline enumerated list with labels of the form (i). What I actually do is set up a customised environment for this so that I can use it as I wish:

\newlist{mylist}{enumerate*}{1}
\setlist[mylist]{label=(\roman*)}

Then I can just say

\begin{mylist}
  \item My first in list.
  \item My second in list.
\end{mylist}

and it is easy to change the configuration globally if I need to. By changing the definition of mylist, for example, you could switch all of the lists which used this environment from vertical to inline.

|improve this answer|||||
  • 13
    Always when I come to this question, I want \begin{enumerate*}[label=(\arabic*)] which is (1) ... (2) ... (just a friendly reminder to my future self) – Martin Thoma May 24 '17 at 23:19
  • 1
    @MartinThoma Even easier, you can use \begin{enumerate*}[(1)] as a shorthand. – red_trumpet Mar 18 '19 at 13:06
39

A solution with the package tasks by Clemens Niederberger is found at Wikibooks/Latex

\documentclass{article}
\usepackage{tasks}
\usepackage{amssymb}
\begin{document}

\settasks{label-format={\color{green!70!black}\large\bfseries}, label-align=center, label-offset={10mm}, label-width={10mm}, item-indent={5mm}, item-format={\scshape\small}, column-sep={3mm}, after-item-skip=-1mm, after-skip={3mm}
}


\bfseries Horizontal list with the same look as enumerate.\normalfont
\begin{tasks}[style=enumerate, item-format={\normalfont\tiny}, after-item-skip=4mm](6)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\task Nine
\task Ten
\end{tasks}


\bfseries Horizontal list:  1 = arabic \normalfont
\begin{tasks}[counter-format={tsk[1].}, label-align=left, label-offset={0mm}, label-width={5mm}, item-indent={5mm}, label-format={\bfseries}, column-sep=10mm](4)
\task One One One One One One
\task Two Two Two Two Two Two
\task Three Three Three Three
\task Four Four Four Four Four Four
\task Five
\task Six
\task Seven
\task Eight
\end{tasks}


\bfseries  Horizontal list: r= roman \normalfont
\begin{tasks}[counter-format={(tsk[r])}, label-align=left, label-offset={10mm}, label-width={10mm}, label-format={\bfseries}](4)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\end{tasks}


\bfseries  Horizontal list: R = Roman \normalfont
\begin{tasks}[counter-format={(tsk[R])}, label-align = right, label-width = {10mm}, label-offset={10mm}, label-format = {\bfseries}, after-skip={10mm}](4)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\end{tasks}
\bfseries Horizontal list: a = alphabetical \normalfont
\begin{tasks}[counter-format={tsk[a].}, label-format={\bfseries}](6)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\task Nine
\task Ten
\end{tasks}


\bfseries Horizontal list: A = Alphabetical \normalfont
\begin{tasks}[counter-format={(tsk[A])}, label-offset={10mm}, label-width={10mm}, label-format={\bfseries}](4)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\end{tasks}


\bfseries Horizontal list with the default look.\normalfont
\begin{tasks}[after-skip={10mm}](6)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\task Nine
\task Ten
\end{tasks}


\bfseries Horizontal list with the same look as itemize.\normalfont
\begin{tasks}[style=itemize, column-sep=-35mm, label-align=left, label-offset={0mm}, label-width={3mm}, item-indent={0mm}](6)%
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\task Nine
\task Ten
\end{tasks}


\bfseries Horizontal list with the same look as multiplechoice.\normalfont
\begin{tasks}[style=multiplechoice](6)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\task Nine
\task Ten
\end{tasks}


\bfseries Horizontal list with custom bullets "@@@".\normalfont
\begin{tasks}[label={@@@}, label-offset={10mm}, label-width={10mm}](4)
\task One
\task Two
\task Three
\task Four
\task Five
\task Six
\task Seven
\task Eight
\end{tasks}


\bfseries Horizontal list with variable formatting.\normalfont
\begin{tasks}[label=\textcolor{red}{$\bullet\bullet\bullet$}, label-format={\color{blue!80!black}\large\bfseries}, label-align=left, label-offset={5mm}, label-width={10mm}, item-indent={15mm},
% text aligned if item-indent = label-offset + label-width
item-format={\itshape\small}, column-sep={8mm}, after-item-skip=1mm, after-skip={1cm}](3)
\task Item
\task Item
\task Item
\task Item Item Item Item Item Item
\task Item Item Item Item Item Item
\task Item Item Item Item Item Item
\vglue5mm% 
% parbox: 1st parameter = vertical position =  bottom (b), center (c), top (t)
% parbox: 2nd parameter = height of parbox
% parbox: 3rd parameter = content position =  center, top, bottom or spread
\task \parbox[b][0em][b]{3cm}{Item Item \\ Item Item \\Item} 
\task \parbox[c][0em][c]{3cm}{Item Item \\ Item Item \\Item} 
\task \parbox[t][0em][t]{3cm}{Item Item \\ Item Item \\Item} 
\vglue5mm
\task* task* spans more than one column.
\task  Item
\task[\small$\blacksquare\textcolor{orange}{\blacksquare}\blacksquare$] Item
\task[\normalsize$\blacksquare\textcolor{orange}{\blacksquare}\blacksquare$] Item
\task[$\blacksquare\otimes\blacksquare$] Item
\task  Item
\task! task! spans all columns in any case.
\task[$\otimes\otimes\otimes$]  Item
\task! task! spans all columns in any case.
\task[\small$\blacksquare\textcolor{green}{\blacksquare}\blacksquare$] Item
\task[\small$\blacksquare\textcolor{orange}{\blacksquare}\blacksquare$] Item
\task*(3) task*(3) takes max. of 3 of remaining columns.
\task*(2) task*(2) takes max. of 2 of remaining columns.
\task  Item
\task*(3) task*(3) takes max. of 3 of remaining columns.
\task  Item
\task[\small$\blacksquare\textcolor{blue}{\blacksquare}\blacksquare$] Item
\task[\small$\blacksquare\textcolor{pink}{\blacksquare}\blacksquare$] Item
\task[\small$\blacksquare\textcolor{orange}{\blacksquare}\blacksquare$] Item
\task startnewitemline starts...  \startnewitemline
\task  Item
\task  Item
\task  Item
\end{tasks}

\end{document}

enter image description here enter image description here

|improve this answer|||||
  • 2
    Since the other examples use numbered lists, could you show how to do that (the tasks syntax is somewhat unintuitive.) – Alan Munn Aug 13 '16 at 22:13
  • I changed the example according to your comment. – SDrolet Aug 13 '16 at 22:38
  • 2
    Thanks! And thanks for adding this answer. That's a super useful package for this kind of list. – Alan Munn Aug 13 '16 at 22:39
  • 4
    This seems fairly overkill, given the original question, but Sir, have my upvote for your work. This could come in handy one day! – thymaro Oct 19 '17 at 12:37
23

The Solution

Use paralist for the purpose of making horizontal list. It allows you to make lists which can be used within paragraphs. Use inparaenum environment for such a list.

The Code

\documentclass{article}

\usepackage{paralist}

\begin{document}

Text before list.
\begin{inparaenum}
  \item My first in list.
  \item My second in list.
\end{inparaenum}
Text after list.

\end{document}

The Output

enter image description here

|improve this answer|||||
7

Horizontal lists with LaTeX list environments + multicols

\documentclass{article}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{multicol}


\begin{document}

\def\PreText{ In-line list of items.  \color{blue!80!black}\scshape}
\def\PosText{\color{black}\normalfont In-line list of items.\vglue5mm}

    %...........................
    \vglue10mm\hrule\vglue5mm
\bfseries LaTeX list environments + multicols\normalfont\\


\begin{enumerate}
%
\item ITEMIZE
\begin{multicols}{4}
\begin{itemize}
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\item Item8
\item Item9
\item Item10
\item Item11
\item Item12
\end{itemize}
\end{multicols}
%
%
\item ENUMERATE
\raggedcolumns% 
\raggedright% 
\begin{multicols}{3}
\begin{enumerate}
\item Item1Item1 Item1 Item1Item1
\item Item2
\item Item3
\item Item4Item4Item4 Item4Item4 Item4 \columnbreak
\item Item5
\item Item6
\item Item7
\item Item8
\item Item9 Item9Item9 Item9Item9Item9
\item Item10
\item Item11Item11 Item11Item11
\item Item12
\end{enumerate}
\end{multicols}
% 
% 
\item DESCRIPTION
\begin{multicols}{2}
\begin{description}
\item[CustomLabel1] Item
\item[CustomLabel2] Item
\end{description}
\columnbreak
\begin{description}
\item[First label] Item
\item[Second label] Item
\end{description}
\end{multicols}
% 
% 
\end{enumerate}

\end{document}

enter image description here

|improve this answer|||||
4

Four types of horizontal "in-line" lists with the package Paralist by Bernd Schandl.

\documentclass{article}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage[defblank]{paralist}


\begin{document}

\def\PreText{ In-line list of items.  \color{blue!80!black}\scshape}
\def\PosText{\color{black}\normalfont In-line list of items.}


 %...........................
 \vglue10mm\hrule\vglue5mm
 Package PARALIST by Bernd Schandl.\\[2mm]

\color{blue!80!black}\bfseries\large Four types of horizontal lists:\color{black}\normalsize\normalfont\vglue4mm

% For compactenum
\setlength{\plitemsep}{2mm}% adjusts items separation
\setlength{\pltopsep}{2mm}% Space between first item and preceeding paragraph
\setlength{\plpartopsep}{1mm}%  Extra space added to topsep when environment starts a new paragraph.
\setlength{\plitemsep}{1mm}% Space between successive items.
\setlength{\plparsep}{1mm}% Space between paragraphs within an item



\begin{compactenum}
\item\bfseries INPARANEUM (similar to "enumerate")\\ \normalfont
%
    \PreText
    \begin{inparaenum}[1.]
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaenum}
    \PosText
%
    \PreText
    \begin{inparaenum}[(i)]
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaenum}
    \PosText
%
    \PreText
    \begin{inparaenum}[(a)]
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaenum}
    \PosText
%
\item\bfseries INPARAITEM (similar to "itemize")\\\normalfont
%
     \PreText
    \begin{inparaitem}[\textcolor{orange}{$\blacksquare\blacksquare\blacksquare$}]% 
    \item Item
    \item Item
    \item Item
    \item[\textcolor{blue}{$\blacksquare$}] Item
    \item Item
    \item Item
    \item Item
    \end{inparaitem}
    \PosText
%    
\item\bfseries INPARADESC  (similar to "description")\\\normalfont
%
     \PreText
    \begin{inparadesc}% 
    \item[\textcolor{red}{$\Rightarrow$ Description1}] Item1
    \item[\textcolor{red}{$\Rightarrow$ Description2}] Item2
    \item[\textcolor{red}{$\Rightarrow$ Description3}] Item3
    \item[\textcolor{green!30!black}{$\Rightarrow\Rightarrow$ Description4}] Item4
    \item[\textcolor{red}{$\Rightarrow$ Description5}] Item5
    \item[\textcolor{red}{$\Rightarrow$ Description6}] Item6
    \item[\textcolor{red}{$\Rightarrow\Rightarrow\Rightarrow$ Description7}] Item7
    \end{inparadesc}
    \PosText
%   
      \item\bfseries INPARABLANK  (with the package option defblank)\\\normalfont
%
     \PreText
    \begin{inparablank}% 
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparablank}
    \PosText
%
\end{compactenum}

\vglue5mm\color{blue!80!black}\large Compatibility with and enhancement of LaTeX list environments\color{black}\normalsize\vglue4mm


\begin{compactenum}
\item\bfseries ITEMIZE + INPARAITEM\normalfont
\begin{itemize}[\Large\textcolor{red}{$\star$}\textcolor{orange}{$\star$}\textcolor{green!50!black}{$\star$}\normalsize]
\item First item of "itemize" followed by:
    \PreText
    \begin{inparaitem}
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaitem}
    \PosText
\item Second item of "itemize" followed by:
    \PreText
    \begin{inparaitem}[\textcolor{pink}{$\blacksquare$}]
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaitem}
    \PosText
\end{itemize}
%
%
%
\item\bfseries ENUMERATE  +  INPARANEUM\normalfont
%
\begin{enumerate}[{\Large\textcolor{orange}{$\star$\normalsize~Option}} \bfseries\color{green!50!black} a)\color{black}\normalfont]
\item First item of "enumerate" followed by:
    \PreText
    \begin{inparaenum}
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaenum}
    \PosText
\item Second item of "enumerate" followed by:
    \PreText
    \begin{inparaenum}
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \item Item
    \end{inparaenum}
    \PosText
\end{enumerate}
\end{compactenum}

\end{document}

enter image description here

|improve this answer|||||
1

An example of the many possibilities of the enumitem package.

\documentclass{article}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{pifont}
\usepackage[inline,shortlabels]{enumitem}


\begin{document}

\def\Text{\color{blue!80!black} In-line list of items.~~  \bfseries\color{red!70!black}}
\parindent0em
\parskip5mm


\begin{center}
\textcolor{blue!50!black}{HORIZONTAL LISTS WITH ENUMITEM}
\end{center}

\noindent\rule{3cm}{0.4pt}\\[2mm]
\textcolor{blue!50!black}{ENUMITEM; ITEMIZE}

\Text
\begin{itemize*}[font=\color{green!50!blue}\huge]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{itemize*}
\Text


\Text
\begin{itemize*}[font=\color{green!20!blue!50!black},label=\ding{105}]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{itemize*}
\Text


\noindent\rule{3cm}{0.4pt}\\[2mm]
\textcolor{blue!50!black}{ENUMITEM: DESCRIPTION}

\Text
\begin{description*}
\item[\textcolor{orange}{$\blacksquare$}] Item1
\item[\textcolor{pink}{$\blacksquare$}] Item2
\item[\textcolor{red}{$\blacksquare$}] Item3
\item[\textcolor{pink}{$\blacksquare$}] Item4
\item[\textcolor{blue}{$\blacksquare$}] Item5
\item[\textcolor{green}{$\blacksquare$}] Item6
\item[\textcolor{orange}{$\blacksquare$}] Item7
\end{description*}
\Text


\noindent\rule{3cm}{0.4pt}\\[2mm]
\textcolor{blue!50!black}{ENUMITEM: ENUMERATE}


\Text
\begin{enumerate*}[before=\hskip1.5cm,after=\hskip5mm,itemjoin={\hskip5mm}]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text


\Text
\begin{enumerate*}[1.,font=\color{green!50!blue!30!black},itemjoin={\hskip5mm},after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text


\Text
\begin{enumerate*}[(i),itemjoin={\hskip5mm},wide,afterlabel={\hskip3mm},after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text

\Text
\begin{enumerate*}[I),after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text

\Text
\begin{enumerate*}[{[a]},after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text


\Text
\begin{enumerate*}[A:,after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text


\Text
\begin{enumerate*}[$\rightarrow$,after=\hskip5mm]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{enumerate*}
\Text


\newlist{MyInlineList}{enumerate*}{1}
%\setlist[enumerate,⟨levels ⟩]{⟨format ⟩} 
\setlist*[MyInlineList,1]{label=\textcolor{blue}{$\blacksquare$},itemjoin={~$\rightarrow$\hskip5mm},afterlabel=\textcolor{orange}{$\blacksquare$}\hskip2mm,itemjoin*={~~~\textcolor{purple}{$\leftarrow$}\hskip5mm}}


\Text
\begin{MyInlineList}
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\end{MyInlineList}
\Text

\end{document}

enter image description here enter image description here

|improve this answer|||||
1

With the packages ENUMITEM + TABTO

\documentclass{article}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage[inline,shortlabels]{enumitem}
\usepackage{tabto}


\begin{document}

\def\Text{\color{blue}In-line list of items.~~\color{black}}

\begin{center}\textcolor{blue!50!black}{ENUMITEM + TABTO}
\end{center}

\parindent0em
\parskip5mm


\NumTabs{5}
\begin{enumerate*}[1.,font=\color{blue},itemjoin={\tab}]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\item Item8
\item Item9
\item Item10
\end{enumerate*}


\NumTabs{5}
\Text
\begin{enumerate*}[(1),font=\color{blue},itemjoin={\tab}]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\item Item8
\item Item9
\item Item10
\end{enumerate*}
\hglue5mm\Text

\NumTabs{5}
\begin{enumerate*}[i.,font=\color{blue},itemjoin={\tab}]
\item Item1Item1
\item Item2
\item Item3Item3
\item Item4
\item Item5
\item Item6
\item Item7Item7Item7
\item Item8
\item Item9Item9
\item Item10
\end{enumerate*}


\NumTabs{7}
\begin{enumerate*}[label=$\square$,font=\color{blue},itemjoin={\tab}]
\item Item1
\item Item2
\item Item3
\item Item4
\item Item5
\item Item6
\item Item7
\item Item8
\item Item9
\item Item10
\end{enumerate*}


\end{document}

enter image description here

|improve this answer|||||

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.