[Tex/LaTex] How to calculate the width of a space

calculationsenumitemlengthslistsspacing

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?

Best Answer

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

Related Question