4

Using the glossaries and glossary-longragged packages (In a memoir document) as well as a custom style I found by Googling:

\newglossarystyle{dottedlocations}{%
    \glossarystyle{list}%
    \renewcommand*{\glossaryentryfield}[5]{%
    \item[\glsentryitem{##1}\glstarget{##1}{##2}] 
            \emph{##3}\ignorespaces\unskip\leaders\hbox to 2.9mm{\hss.}\hfill##5}%
            \renewcommand*{\glsgroupskip}{}%
     }
    \glossarystyle{dottedlocations}

(Source)

My problem is that several of my abbreviations are used rather often, which makes the \leaders sometimes repeat the \hss. zero times, as demonstrated below for polydopamine:

enter image description here

I tried to insert a few dots manually before the \leaders, which lead to the appearance of a gap between those dots and the leaders. So the question is: Is there a way to force a \leaders to repeat a following \hbox a certain minimum of times? i.e. is there a way to force the \leaders to repeat the \hbox at least three times before expanding if there is a need?

The V
  • 1,401
  • 1
    Just a remark on the code: \ignorespaces does exactly nothing. Its function is to expand the next token repeatedly until an unexpandable token remains; if it is a space it is gobbled and the procedure restarts from the next token, otherwise it stops. Since \unskip is unexpandable, the procedure stops immediately and nothing is done. – egreg Jun 06 '14 at 19:55

1 Answers1

6

Use \leaders\hbox to2.9mm{\hss.\hss}\hskip 2.9mm plus1fill instead your \leaders construction.

The \hfill is equivalent to \hskip 0pt plus1fill but you need to have some minimal space everywhere, such as 2.9mm in my example.

wipet
  • 74,238