1

Is there an easy way to make the items appear horizontally and not vertically and also be centered?

I have tried the following code but the points are squahed to the left side and there is no space in between them.

\documentclass{article}

\usepackage[inline]{enumitem}

\begin{document}

\begin{itemize*}
  \item Item 1
  \item Item 2
\end{itemize*}

\end{document}

I am thinking something like the one below where o is the "dot" made.

(space from the left side) o Item 1 (space here) o Item 2

9
  • @leandriis, almost but the problem is that they use enumerate and I am looking for itemize. As I wrote in my question I am looking to have the black dots and not numbers there.
    – Clone
    Apr 2, 2021 at 11:38
  • I edit my question to clarify more.
    – Clone
    Apr 2, 2021 at 11:41
  • 1
    You could use the itemjoin key to customize the horizontal distance between adjacent items. Seomthing like \documentclass{article} \usepackage[inline]{enumitem} \begin{document} \begin{itemize*}[itemjoin={\hspace{1cm}}] \item Item 1 \item Item 2 \item Item 3 \item Item 4 \end{itemize*} \end{document} or any other width of your choice should work.
    – leandriis
    Apr 2, 2021 at 11:54
  • 1
    You can use the before key to add horizontal white space before the first item in your list. (\begin{itemize*}[before={\hspace{2cm}},itemjoin={\hspace{1cm}}])
    – leandriis
    Apr 2, 2021 at 11:58
  • 1
    How can this be a duplicate of the linked question, where centering is not touched upon?
    – egreg
    Apr 2, 2021 at 15:08

3 Answers 3

3

You have several choices, of which I present two. The new environment would be my choice.

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

\newenvironment{centeritemize*}[1][]
  {\par\centering\begin{itemize*}[itemjoin=\quad,#1]}
  {\end{itemize*}\par}

\begin{document}

\begin{itemize*}[
  itemjoin=\quad,
  before=\hspace*{\fill},
  after=\hspace*{\labelwidth}\hspace*{-\labelsep}\hspace*{\fill},
]
  \item Item 1
  \item Item 2
  \item Item3
\end{itemize*}

\begin{centeritemize*}
  \item Item 1
  \item Item 2
  \item Item3
\end{centeritemize*}

\end{document}

enter image description here

If you want some vertical space above and below the list, you can do

\newenvironment{centeritemize*}[1][]
  {\begin{center}\begin{itemize*}[itemjoin=\quad,#1]}
  {\end{itemize*}\end{center}}

and this shows why using a new environment is better.

5
  • Thank you for your answer! How can I add more space between the items vertically? Do I edit itemjoin with something like \qquad?
    – Clone
    Apr 2, 2021 at 15:27
  • 1
    @Clone Sorry, but I don't understand: do you want the item stacked vertically? Please, be clearer with your question.
    – egreg
    Apr 2, 2021 at 15:30
  • Woops, sorry I meant horisontally. Like, how can I increase the spacing horizontally so that there would be more space between items 1 2 and 3 for instance?
    – Clone
    Apr 2, 2021 at 15:32
  • 1
    @Clone itemjoin=\qquad or itemjoin=\hspace*{3cm} (or whatever length you like).
    – egreg
    Apr 2, 2021 at 15:55
  • Thank you once again!
    – Clone
    Apr 2, 2021 at 16:03
2

A solution with the before and after keys from enumitem:

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

\begin{document}

\begin{itemize*}[itemjoin=\quad, before=\null\hfill, after=\hskip1.5em\hfill]
  \item Item 1
  \item Item 2
\item Item3
\end{itemize*}

\end{document} 

enter image description here

1
  • 1
    @egreg: I've just tested it, but my code (with the \hspace found by trial and error) is better centred – the difference in length of the white spaces on each side is measured to 0.2pt.
    – Bernard
    Apr 2, 2021 at 13:50
1

Just for fun:

\documentclass{article}

\newcommand{\itemtab}{\hspace{\tabcolsep}\textbullet\hspace{\itemsep}}

\begin{document}

\begin{center}
\begin{tabular}{@{\itemtab}l@{\itemtab}l}
  Item 1 & Item 2
\end{tabular}
\end{center}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .