1

I want to justify a horizontal list. I'm able to get a horizontal list but I want to have it justified horizontally. Here's what I have so far:

\documentclass[landscape]{article}
\usepackage[inline]{enumitem}
\begin{document}
\begin{itemize*}
    \item Advanced Data Science
    \item Machine Learning
    \item Deep Learning
    \item Computer Vision
\end{itemize*}
\end{document}

• Advanced Data Science • Machine Learning • Deep Learning • Computer Vision            | End of empty space

I want this justified:

• Advanced Data Science    • Machine Learning    • Deep Learning    • Computer Vision

Anyone have any idea?

Edit: Added a reproducible example.

Kevin M
  • 25
  • 5

1 Answers1

2

You can use the keys itemjoin and itemjoin*, as in:

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

\setlist[itemize]{itemjoin=\hspace{\fill},itemjoin=\hspace*{\fill}}

\begin{document} \begin{itemize} \item Advanced Data Science \item Machine Learning \item Deep Learning \item Computer Vision \end{itemize}

\begin{itemize} \item A \item M \item D \item C \end{itemize}

\end{document}

For even positioning, have a look into e.g. How to make horizontal lists?

TobiBS
  • 5,240
  • This seems to not have a sapce before the last bullet. Also, why the landscape option? – Peter Grill Jul 12 '20 at 01:23
  • @PeterGrill as you probably noticed, Kevin did not provide a full MWE, therefore I had to made assumptions. And thanks for the hint, I adjusted itemjoin* – TobiBS Jul 12 '20 at 01:40
  • I don't want to manually insert the spacing, as I may have to add another item. Is there a way to do this automatically? – Kevin M Jul 12 '20 at 02:04
  • @KevinM it is done, automatically, try it for yourself, you can add as many items as you like and they all carry the spacing. Or do you mean, that I used the options only for this itemize* environment? I adjusted it and use \setlist now, is that what you want? In general, your question could have been formulated clearer and for the next time, please provide a MWE! – TobiBS Jul 12 '20 at 02:13
  • No I mean the command "\hspace*{2em}" . Sorry if I'm not being clear. I don't mind whether it's for the entire document or not. I have to change it to 5em to get it justified. Otherwise there's extra spacing to the right. I don't wish to do this :(

    Also adding an item \item Data Structureadds it onto the next line.

    – Kevin M Jul 12 '20 at 02:19
  • 1
    Sorry @KevinM but it would be best if you draw a clear picture of what you really want to achieve. If you want to auto fill the space, try \setlist[itemize]{itemjoin=\hspace*{\fill},itemjoin*=\hspace*{\fill}} but this will not prevent the line break, if a line is full, it is full. So maybe you start from scratch with a simple drawing to illustrate what you want and in which cases. – TobiBS Jul 12 '20 at 02:31
  • \fill worked perfectly! Agreed that it would not break the line break but there are ways around that. I'll edit your post and accept it as final answer – Kevin M Jul 12 '20 at 02:40
  • @KevinM thanks! – TobiBS Jul 12 '20 at 03:02