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}

Colas
  • 6,772
  • 4
  • 46
  • 96
  • 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
  • If it's only for text, why don't you directly type (U+2026), (using UTF8 input encoding, of course)? If you're using a french layout keyboard, there are free drivers that allow you do that easily (and much more). You can take a look here: http://accentuez.mon.nom.free.fr/Clavier-Galeron.htm – Bernard May 21 '14 at 14:48
  • @Colas your code appears to work by a sort of miracle, which is a bit technical. \ellipsisgap is not length, nevertheless your \setlength do not raise errors, quite the contrary they even work globally not obeying the scope limitations due to the braces!! but I do not recommend to do this because it permanently alters font parameters. Besides replace 0.05em by 1cm and you will see the side effects. –  May 22 '14 at 16:29
  • @jfbu Thanks for your help. Maybe you could add your point of view to this previous question http://tex.stackexchange.com/questions/179351/how-to-change-how-suspension-points-dot-dot-dot-look-with-latex – Colas May 22 '14 at 16:46
  • @jfbu I want to make the dots closer one to each other. IMHO, by default, the space between them is too wide. – Colas May 22 '14 at 16:54
  • @Colas closer? then you need to use a negative value for the dimension used in \ellipsisgap. \renewcommand{\ellipsisgap}{\dimexpr-0.05em\relax} –  May 22 '14 at 17:11

2 Answers2

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.

egreg
  • 1,121,712
  • Great answer ! Have you seen that @Werner? – Colas May 22 '14 at 18:00
  • @egreg had you seen http://tex.stackexchange.com/questions/179541/how-to-make-ellipsis-work-with-sans-serif-font/179767?noredirect=1#comment415239_179566? –  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. –  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
  • Why? Yours is clearer. You explain what is going on. – Colas May 23 '14 at 16:46
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. –  May 22 '14 at 19:45