# [Tex/LaTex] How to change dot spacing in \dotfill

macrosspacing

I'm using the \dotfill command in a nomenclature to add units at the end of each line. Here is the code I'm using:

\usepackage[refpage]{nomencl}
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\unskip\dofill[#1]}}
\renewcommand*{\pagedeclaration}[1]{\unskip, \hyperpage{#1}}


That works correctly, but in my table of contents where there is also automatic dot filling, spacing in not the same. So how could I modify the \dotfill spacing ? (to match the one of the table of contents actually)

The definition of \dotfill is

\leavevmode \cleaders \hb@xt@ .44em{\hss .\hss }\hfill \kern \z@


The spacing is given by .44em, so you can put this in your preamble:

\makeatletter
\renewcommand \dotfill {\leavevmode \cleaders \hb@xt@ .33em{\hss .\hss }\hfill \kern \z@}
\makeatother


I would, however, suggest that you create your own command called e.g. \Dotfill, like this, so that the spacing is modified only when you want (\dotfill is used by LaTeX in various places):

\makeatletter
\newcommand \Dotfill {\leavevmode \cleaders \hb@xt@ .33em{\hss .\hss }\hfill \kern \z@}
\makeatother