5

The unicode-math package re-defines ellipsis to be the ellipsis character in whatever font you're using, instead of spaced dots. This looks bad in my opinion, and violates the guidance on ellipses in every style guide I own. A solution for \ldots is provided here: variations-in-ldots. But that solution does not fix \cdots, \vdots, or \ddots.

I managed to find a solution for \cdots that works in this MWE, but seems to fail in other instances that I haven't figured out a reliable way to reproduce.

And I can't figure out a solution for \vdots or \ddots at all.

\documentclass{article}
\usepackage{unicode-math}
\AtBeginDocument{
  % From https://tex.stackexchange.com/questions/120627/variations-in-ldots
  \renewcommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}
  \renewcommand\cdots{\mathinner{\cdotp\cdotp\cdotp}}  % sometimes works
  %\renewcommand\vdots{\mathinner{\vdotp\vdotp\vdotp}} % doesn't work
  %\renewcommand\ddots{\mathinner{\ddotp\ddotp\ddotp}} % doesn't work
}
\begin{document}
$\dots, \ldots, \cdots, \vdots, \ddots$
\end{document}

Found an example of where my solution for \cdots didn't work. It's when \dots is used instead of \cdots explicitly to centrally place dots:

\documentclass{article}
\usepackage{unicode-math}
\AtBeginDocument{
  \renewcommand\mathellipsis{\mathinner{\ldotp\ldotp\ldotp}}
  \renewcommand\cdots{\mathinner{\cdotp\cdotp\cdotp}}  % sometimes works
}
\begin{document}
$x+\dots+ y$  % Do not get spaced dots

$x+\cdots+ y$ % Do get spaced dots
\end{document}
4
  • What do you mean by “sometimes works”? Commented 16 hours ago
  • @egreg Sometimes I get spaced centrally placed dots, and sometimes they are tight like I'm just getting a unicode character. Commented 16 hours ago
  • Details! Details! Commented 15 hours ago
  • Found it (and added to question). My \cdots solution fails when the actual command given is \dots. Commented 15 hours ago

2 Answers 2

3

You want to redefine \unicodeellipsis and \unicodecdots.

\documentclass{article}
\usepackage{unicode-math}

\NewCommandCopy{\amsvdots}{\vdots}
\NewCommandCopy{\amsddots}{\ddots}
\AtBeginDocument{%
  \RenewDocumentCommand{\unicodeellipsis}{}{\ldotp\ldotp\ldotp}%
  \RenewDocumentCommand{\unicodecdots}{}{\cdotp\cdotp\cdotp}%
  \RenewCommandCopy{\vdots}{\amsvdots}
  \RenewCommandCopy{\ddots}{\amsddots}
}

\begin{document}

$\dots, \ldots, \cdots, \vdots, \ddots$

$a,\dots,z$ $a,b,\dots,k,\dotsc$

$a+\dots+b+\dotsb$

\end{document}

output

6
  • Is there consensus that this is a better answer? Commented 14 hours ago
  • @dedded In what way? Commented 14 hours ago
  • @cabohah I don't understand what about AMS's \dots that is getting preserved here. Commented 14 hours ago
  • I suppose this solutions loses the definitions of \unicodellipsis and \unicodecdots. Although the only reason that comes to my mind for wanting them would be to make a font sampler. Commented 14 hours ago
  • 1
    @dedded My answer also preserved AMS's \dots and it does not break \unicodeellipsis (which I prefer in text mode). Commented 14 hours ago
3

You can store the original definition of the several dots commands before loading unicode-math and restore them inside \begin{document}:

\documentclass{article}
\NewCommandCopy{\latexvdots}{\vdots}
\NewCommandCopy{\latexddots}{\ddots}
\NewCommandCopy{\latexcdots}{\cdots}
\NewCommandCopy{\latexmathellipsis}{\mathellipsis}
\usepackage{unicode-math}
\AtBeginDocument{%
  %\ShowCommand\mathellipsis\ShowCommand\latexmathellipsis
  \RenewCommandCopy{\mathellipsis}{\latexmathellipsis}%
  %\ShowCommand\vdots\ShowCommand\latexvdots
  \RenewCommandCopy{\vdots}{\latexvdots}%
  %\ShowCommand\ddots\ShowCommand\latexddots
  \RenewCommandCopy{\ddots}{\latexddots}%
  %\ShowCommand\cdots\ShowCommand\latexcdots
  \RenewCommandCopy{\cdots}{\latexcdots}%
}
\begin{document}
$\dots, \ldots, \cdots, \vdots, \ddots$
\end{document}

enter image description here

If you want to see the different definitions, you can activate the \ShowCommand lines. They will show the definitions in the log file and on the terminal.

10
  • 1
    @egreg If you do it after unicode-math you would get \mathinner {\unicodecdots } instead of \mathinner {\cdotp \cdotp \cdotp} for \cdots and this is not what you want. For \vdots and \ddots there is not difference, whether you do it before or after loading unicode-math. Commented 15 hours ago
  • 1
    @dedded If you load amsmath explicitly, you should do it indeed after storing \cdots into \latexcdots (this is the reason, why I've named the commands \latex… and not \ams… ;-)). Commented 15 hours ago
  • 1
    @egreg I don't store and restore \dots. So with my code \dots uses the amsmath definition \ifmmode \@xp \mdots@ \else \@xp \textellipsis \fi and therefore IMHO should behave like explained in amsmath. Commented 14 hours ago
  • 1
    @dedded With unicode-math \vdots is just the character . Similar for \vdots. Just add, e.g., \\ShowCommand\ddots \ShowCommand\latexddots at the beginning of \AtBeginDocument so see the difference of the definition in the log file and on the terminal. Commented 14 hours ago
  • 2
    @dedded I've added the useful \ShowCommand commands to my example, but commented them. You can activate them to see the difference of the definitions. Commented 14 hours ago

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.