How to use \dotfill if I do not have a command for it in LyX

Supposedly, newer versions of LyX have a command called \dotfill where one can obtain a string of dots such as in the following attachment.

I am specifically looking for (lower) dots which are analogous to a horizontal fill. Further, I would prefer to be in Standard mode when doing this (as opposed to in Table of Contents). When I enter math mode and insert \dotfill, nothing happens. How can I obtain these dots? If I have to add something to my LateX preamble, please share.

EDIT: When I enter \dotfill in LyX (in either inline or displayed mathmode) here is what I get

• There is the the \@dottedtocline command, but I am not sure where is usable at all outside of \tableofcontents etc. – user31729 Apr 27 '14 at 8:51
• \dotfill works in inline math. Does is have to be in displayed math mode? – Torbjørn T. Apr 27 '14 at 9:22
• @TorbjørnT. that command does not work in my inline math. It also doesn't work in displayed math form. I have LyX version 2.0. – The Substitute Apr 27 '14 at 9:31
• @ChristianHupfer that command doesn't do anything in either inline or displayed math mode. – The Substitute Apr 27 '14 at 9:34
• @ChristianHupfer No package needed, it is defined in the LaTeX kernel. The Substitute: Define 'does not work'. – Torbjørn T. Apr 27 '14 at 12:22

You can write \dotfill in ERT (Evil Red Text) boxes with Ctrl-L in text mode (1) or math mode (2) or in blue boxes (Ctrl-M) in math inline mode (3). Anyway you obtain \dotfill in the Lyx screen and the line of dots in the final PDF only. The \dotfill alone has no sense in display math mode with Ctrl-L (4) nor with Ctrl-M (5) as the the dotted line may shrink infinitely, so you must supply some space where it can be extended. One way to do is with a \makebox command (6). This is the LaTeX code produce made by the above Lyx screenshot:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{babel}
\begin{document}
\begin{enumerate}
\item $\chi^{2}$\dotfill$\pi$
\item $\chi^2 \dotfill \pi$
\item $\chi^{2}\dotfill\pi$
\item $\chi^2 \dotfill \pi$
\item
$\chi^{2}\dotfill\pi$

\item
$\chi^{2}\makebox[10em]{\dotfill}\pi$
\end{enumerate}

\end{document}


BTW, I think that for display math is better (simpler) use a chain of \ldotscommands.