1

I found out about inline lists with the enumitem package and it works exactly how I wanted except for the fact that there is some leading spacing before each item. I tried reading through the manual and I honestly couldn't make sense of the various different spacing parameters, or if any of them have any effect. I suspect it's some edge case with the list being inline.

\documentclass{article}

\usepackage[inline]{enumitem}

\newlist{commalist}{itemize*}{1}
\setlist[commalist]{label={},itemjoin={{·}}}

\begin{document}

First Line

\begin{commalist}
    \item First
    \item Second
    \item Third
\end{commalist}

Second Line

\end{document}

output


I saw this answer which gave me the idea for redefining the \item command within the list environment, but I couldn't quite get it to work:

\documentclass{article}

\usepackage[inline]{enumitem}

\let\realitem\item
\newcommand{\mynewitem}{%
\realitem\hspace*{-\labelsep}\ignorespaces%
}

\newlist{commalist}{itemize*}{1}
\setlist[commalist]{before={\let\item\mynewitem},label={},itemjoin={{·}}}

\begin{document}

First Line

{%
\setlength\parskip{0pt}%
\begin{commalist}
    \item First
    \item Second
    \item Third
\end{commalist}}

Second Line

\end{document}

attempt

1 Answer 1

3

Oops! The answer is simply to set afterlabel={} since by default it is set to \nobreakspace.

\documentclass{article}

\usepackage[inline]{enumitem}

\newlist{commalist}{itemize*}{1}
\setlist[commalist]{label={},itemjoin={{·}},afterlabel={}}

\begin{document}

First Line

\begin{commalist}
    \item First
    \item Second
    \item Third
\end{commalist}

Second Line

\end{document}
2
  • Please provide a full sentence with afterspace={} at the right place in your MWE.
    – pzorba75
    Commented May 18, 2018 at 3:12
  • Good idea, edited. Commented May 18, 2018 at 3:56

You must log in to answer this question.

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