7

Problem/question

It seems that the ellipsis package does not work with sans-serif fonts. Is it a known problem or maybe not a problem at all? This question follows this one, about "how to change the appearance of \dots"?

Thank you.

MWE (minimal working example)

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{ellipsis}
\setlength{\ellipsisgap}{0.05em}

\begin{document}

{\sffamily So\dots{} let's see\dots{}}

So\dots{} let's see\dots{}

\end{document}

enter image description here


edit

Based on David's answer, here is my code

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{ellipsis}
\setlength{\ellipsisgap}{0.05em}
{\sffamily\setlength{\ellipsisgap}{0.05em}}
{\bfseries\setlength{\ellipsisgap}{0.05em}}

\begin{document}

{\normalfont So\dots{} let's see\dots{}}

{\sffamily So\dots{} let's see\dots{}}

{\bfseries So\dots{} let's see\dots{}}

So\dots{} let's see\dots{}

\end{document}
  • What is it that isn't working properly in the example you've provided? – dbmag9 May 21 '14 at 13:11
  • @dbmag9 The spacing in \sffamily's \dots is not what he wants (0.05em). – Manuel May 21 '14 at 13:12
  • Isn't em relative to the type size? – dbmag9 May 21 '14 at 13:13
  • 1
    @dbmag9 Yes, but if you change the value, the spacing doesn't change. – Manuel May 21 '14 at 13:16
  • 1
    @dbmag9 em is relative to the type size at the point the length is set the length register is a fixed length. – David Carlisle May 21 '14 at 13:41
8

\ellipsigap is not a length register, but a macro! Doing

\setlength{\ellipsisgap}{0.5em}

or any other value is a big mistake. The definition of \ellipsisgap in the package is

\newcommand{\ellipsisgap}{\fontdimen3\font}

and \setlength{\ellipsisgap}{0.5em} will do, according to the definition of \setlength,

\ellipsisgap0.5em\relax

Now \ellipsisgap will be expanded and the assignment

\fontdimen3\font0.5em\relax

will be executed! This will change the parameter controlling the stretch component of interline glue. And the change is global, affecting the current font.

The command \ellipsisgap should be changed with \renewcommand, as the documentation tells to (page 2, last code example in section 2).

By default, it gives the same space used as the stretch component in the interword spaces. You can change it to suit your needs, using em units. In the Computer Modern fonts, the stretch component is 0.6em; the same for roman and sans serif type.


Maybe the package should do

\renewcommand{\ellipsisgap}{\fontdimen3\font\relax}

so using \setlength{\ellipsisgap}{...} would at least throw an error.

  • Great answer ! Have you seen that @Werner? – Colas May 22 '14 at 18:00
  • @egreg had you seen tex.stackexchange.com/questions/179541/…? – user4686 May 22 '14 at 19:48
  • @jfbu No, I had not seen them, sorry. I felt urgent to tell why \setlength{\ellipsisgap}{...} should not be used. – egreg May 22 '14 at 20:00
  • @egreg I felt the same urgency and hence posted immediately my three comments. In retrospect I should have added their contents to the body of my answer. – user4686 May 22 '14 at 20:07
  • Even if I don't know TeX, I am sure you will agree with me to say that \relax is very important :-) – Colas May 23 '14 at 16:21
7

You can do this:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{ellipsis}
\renewcommand{\ellipsisgap}{\dimexpr0.05em\relax}

\begin{document}

\textsf{So\dots{} let's see\dots{}}

So\dots{} let's see\dots{}


\LARGE

\textsf{So\dots{} let's see\dots{}}

So\dots{} let's see\dots{}

\end{document}

Update:

As I pointed out in my comments A (the corresponding answer by @DavidCarlisle has now been deleted) and B, and this third comment to the present question all posted very shortly after this answer, the \ellipsisgap is not a skip register but a macro. \setlength works on it but does a font dimen assignment (automatically global).

The \dimexpr allows, now that \ellipsisgap is a size specification to do things like \kern2\ellipsisgap which omitting the \dimexpr would not permit. However, if there is no use for this, then \renewcommand{\ellipsisgap}{0.05em} would also work because, as it turns out, all its uses in ellipsis.sty are properly terminated.

ellipsis gap

  • The \dimexpr is irrelevant and useless. – egreg May 22 '14 at 18:02
  • @egreg At the time of writing this answer I had not looked at ellipsis.sty, and did not know how \ellipsisgap was used within the package (in view of the other postings on this site, it appears I was not alone). This being done I can confirm your irrelevant and useless caracterisation and extend it to the ending \relax. – user4686 May 22 '14 at 19:45

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.