17

How would I go about changing the \dots command to be more compact? I would like the dots to be closer together so that the printed symbol takes less horiontal space.

Alternatively, does anybody know of a command that is inherently more compact than \dots? This is actually preferable as it would still allow for the use of \dots in other contexts.

  • Have you seen the ellipsis package? – egreg Sep 12 '14 at 12:53
  • Do you need this in math-mode, too? \usepackage{ellipsis} \renewcommand{\ellipsisgap}{0.1em} just works in text-mode. And it will redefine your normal \dots-command. Even \let\olddots\dots does not work then. – LaRiFaRi Sep 12 '14 at 13:18
  • This answer does add to the usual options of ellipsis package, two more configurable spaces: \ellipsisbeforegap and \ellipsisaftergap (space before and after the dots, useful in many cases), apart from making it configurable also for math mode. – Manuel Sep 12 '14 at 14:17
11

How about this?

\documentclass{article}
\newcommand\mydots{\hbox to 1em{.\hss.\hss.}}
\begin{document}

Hello\dots

Hello again\mydots

\end{document}

Or if you prefer to keep it all "clean" LaTeX commands:

\newcommand\mydots{\makebox[1em][c]{.\hfil.\hfil.}}

A further consideration would be whether you care about maths mode or not. The standard \dots command carefully checks whether we are in maths or not and does the right thing. If you want to worry about this, then you would need this:

\newcommand\mydots{\ifmmode\ldots\else\makebox[1em][c]{.\hfil.\hfil.}\fi}

enter image description here

In order to change the spacing of the dots with this solution, you change the overall width of the ellipsis. In the above examples I've made it 1em wide, and the the \hss or the \hfil commands expand as needed to make the dots evenly spaced.

If your ellipsis is ever followed by more text, then there is another consideration: whether you want any built-in space after the ellipsis (as pointed out in the comments). The original \dots command has a small amount of space after it, but my suggested replacement above does not. For example

enter image description here

To fix this you can either add a thin space after it by hand or amend the definition to:

\newcommand\mydots{\ifmmode\ldots\else\makebox[1em][c]{.\hfil.\hfil.}\thinspace\fi}
| improve this answer | |
  • you might add some text following the dots. the appearance of the dots in relation to what follows is also important. – barbara beeton Sep 12 '14 at 18:11
  • @barbarabeeton thanks, useful consideration. – Thruston Sep 12 '14 at 22:09
  • This works really well in text mode. As I was specifically looking for a more compact version of \dots in math mode (which I failed to mention in the question) I went with your "clean LaTeX commands"-implementation of \mydots and tweaked it a little. Now, it reads \newcommand\varlist{,\makebox[1em][c]{.\hfil.\hfil.},} . This in the context of say $\Psi_0(\vec{r}_1\varlist\vec{r}_n)$ produces much more desirable output than $\Psi_0(\vec{r}_1,\dots,\vec{r}_n)$. Thanks a lot. – Casimir Sep 13 '14 at 10:20
5

Here it is another option: expanding ellipsis package to work also in math mode, apart from adding two more dimensions (\ellipsisbeforegap and \ellipsisaftergap, if set to zero it has the same behaviour as in ellipsis package).

\documentclass{scrartcl}

\usepackage{mathtools}
\usepackage{ellipsis}

\makeatletter
\renewcommand*{\mathellipsis}{%
  \mathinner{%
    \kern\ellipsisbeforegap%
    {\ldotp}\kern\ellipsisgap%
    {\ldotp}\kern\ellipsisgap%
    {\ldotp}\kern\ellipsisaftergap%
  }%
}
\renewcommand*{\dotsb@}{%
  \mathinner{%
    \kern\ellipsisbeforegap%
    {\cdotp}\kern\ellipsisgap%
    {\cdotp}\kern\ellipsisgap%
    {\cdotp}\kern\ellipsisaftergap%
  }%
}
\renewcommand*{\@cdots}{%
  \mathinner{%
    \kern\ellipsisbeforegap%
    {\cdotp}\kern\ellipsisgap%
    {\cdotp}\kern\ellipsisgap%
    {\cdotp}\kern\ellipsisaftergap%
  }%
}
\renewcommand*{\ellipsis@default}{%
  \ellipsis@before
  \kern\ellipsisbeforegap
  .\kern\ellipsisgap
  .\kern\ellipsisgap
  .\kern\ellipsisgap
  \ellipsis@after\relax}
\renewcommand*{\ellipsis@centered}{%
  \ellipsis@before
  \kern\ellipsisbeforegap
  .\kern\ellipsisgap
  .\kern\ellipsisgap
  .\kern\ellipsisaftergap
  \ellipsis@after\relax}
\AtBeginDocument{%
  \DeclareRobustCommand*{\dots}{%
    \ifmmode\@xp\mdots@\else\@xp\textellipsis\fi}}
\def\ellipsisgap{.1em}
\def\ellipsisbeforegap{.05em}
\def\ellipsisaftergap{.05em}
\makeatother

\begin{document}

a \dots\ b

a\dots b

\[ a + \dots + b \]

\end{document}

Also, this question of mine might be interesting in case you want to configure the spacing after the dots for diferent glyphs (e.g., !, ?, ,, ;, etc.).

| improve this answer | |
3

Or with kerning:

% arara: pdflatex

\documentclass{article}
\newcommand*{\myDots}{\ifmmode\mathellipsis\else.\kern-0.13em.\kern-0.13em.\fi} % touching at \kern-0.1725em

\begin{document}
\myDots

\dots 

$\myDots$

$\dots$
\end{document}

enter image description here

If you want to have different kerning for the math-version, you can just replace \mathellipsis by something else.

Update: for full control over math- and text-mode, you can use the following command: \newcommand{\myDots}{\ifmmode\mathinner{\ldotp\kern-0.2em\ldotp\kern-0.2em\ldotp}\else.\kern-0.13em.\kern-0.13em.\fi}


A second possibility (just for text-mode) would be the package ellipsis:

% arara: pdflatex

\documentclass{article}
\usepackage{ellipsis} 
\renewcommand{\ellipsisgap}{0.01em}

\begin{document}
\dots $\dots$
\end{document}
| improve this answer | |

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.