4

Using the questions:

  1. Get width of a given text as length
  2. Lengths and when to use them
  3. enumitem package and description lists
  4. For the inline enumerate: controlling the item spacing
  5. Customizing inline enumerate with enumitem still not working?

I am trying to set my inline list inter space to one space \ using this code:

\documentclass{article}
\usepackage{enumitem}

\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{label=}
\usepackage{calc}

\begin{document}

some text \begin{inlinelist}[label=,itemjoin=\the\widthof{\ }]
    \item First Keyword.
    \item Second Keyword.
    \item Third Keyword.
\end{inlinelist} more text

\end{document}

But it is not setting the correct size and it is showing some stranger text:

enter image description here

How can I properly calculate the size of a space \ and set the itemjoin to this value?

4

Two ways:

\documentclass{article}
\usepackage{enumitem}

\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{label=}
\newlength{\interwordspace}
\settowidth{\interwordspace}{\ }

\begin{document}

some text \begin{inlinelist}[label=,itemjoin=\hspace{\interwordspace}]
    \item First Keyword.
    \item Second Keyword.
    \item Third Keyword.
\end{inlinelist} more text

some text \begin{inlinelist}[label=,itemjoin=\hspace{\fontdimen2\font}]
    \item First Keyword.
    \item Second Keyword.
    \item Third Keyword.
\end{inlinelist} more text

\end{document} 

enter image description here

3

Note that \widthof can only be used in the context of setting lengths and some other few cases, but not after \the (but \the would be misused, in this application, because it only produces strings of characters, see The \the command).

What about itemjoin={ }?

\documentclass{article}
\usepackage{enumitem}

\newlist{inlinelist}{enumerate*}{1}
\setlist*[inlinelist,1]{label=}

\begin{document}

some text\begin{inlinelist}[,itemjoin={ }]
\item First Keyword
\item Second Keyword
\item Third Keyword
\end{inlinelist}
more text

some text First Keyword Second Keyword Third Keyword more text
\end{document}

enter image description here

  • Thanks! This was what I wanted when I looked into setting the item join space to a space. Somehow using the space width was doubling it. – user Sep 10 '17 at 16:18

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.