2

Consider the following code:

\documentclass{article}

% \usepackage{kpfonts}
\usepackage{kpfonts-otf}

\begin{document}

\[
    \begin{pmatrix}
        \mu_1\\
        \vdots\\
        \mu_n
    \end{pmatrix}
\]

\end{document}

The \vdots does not seem very balanced:

enter image description here

With the normal version of kpfonts the result looks fine:

enter image description here

Is there something that can be done within LaTeX to fix this?

2 Answers 2

1

Let's try the following:

\documentclass{article}

\NewCommandCopy\originalvdots\vdots
\usepackage{kpfonts-otf}

\begin{document}

\[
    \begin{pmatrix}
        \mu_1\\
        \vdots\\
        \mu_n
    \end{pmatrix}
    \begin{pmatrix}
        \mu_1\\
        \originalvdots\\
        \mu_n
    \end{pmatrix}
\]

\end{document}

enter image description here

The \originalvdots command uses the period from Computer Modern, but it's a detail not so important.

With some measuring…

\documentclass{article}

\NewCommandCopy\originalvdots\vdots
% \usepackage{kpfonts}
\usepackage{kpfonts-otf}

\AtBeginDocument{%
  \NewCommandCopy\unicodevdots\vdots
  \RenewDocumentCommand{\vdots}{}{\mathrel{\loweredvdots}}%
}

\makeatletter
\newcommand{\loweredvdots}{\mathpalette\loweredvdots@\relax}
\newcommand{\loweredvdots@}[2]{%
  \begingroup
  \sbox\z@{$\m@th#1\unicodevdots$}%
  \vrule width \z@ height 2.25\ht\z@ depth 0.012\ht\z@
  \raisebox{0.25\height}{\usebox\z@}%
  \endgroup
}
\makeatother

\begin{document}

\[
    \begin{pmatrix}
        \mu_1\\
        \vdots\\
        \mu_n
    \end{pmatrix}
    \begin{pmatrix}
        \mu_1\\
        \originalvdots\\
        \mu_n
    \end{pmatrix}
\]

\end{document}

enter image description here

6
  • Thank you! Two quick questions: 1) I thought that adding \setmathfont{latinmodern-math.otf}[range={\vdots}] would be the same as your first approach, but in fact it does not work. Why? 2) Is it safe to use your second approach (the \loweredvdots one) in a package? I mean if the kpfonts-otf get fixed some day, would those extra code cause trouble?
    – Jinwen
    Jun 15, 2022 at 8:08
  • @Jinwen In legacy TeX, \vdots is built by stacking periods; in unicode-math it’s a single glyph. I’m afraid that the here proposed hack only works for the specific font.
    – egreg
    Jun 15, 2022 at 8:13
  • Thank you, I understand. Actually, in my document class, the font configuration is fixed and uses the KpMath-Regular.otf from this line on, thus I'm willing to know if your proposed hack can serve as a temporary fix to this problem in this particular document class (the thing I'm afraid is that when the OTF file get updated, this hack might cause extra trouble).
    – Jinwen
    Jun 15, 2022 at 8:20
  • @Jinwen I can't know the plans of KpMath developers… On the other hand, it's not that I like so much the standard output of \vdots
    – egreg
    Jun 15, 2022 at 8:31
  • 1
    @Jinwen Btw your issue is not specific to kpfonts-otf (try Libertinus-Math, Latin-Modern-Math, Erewhon-Math, ...) the unicode-math glyph \vdots (U+22EE) is always vertically centred on the math axis, this causes your issue. As kpfonts-otf developer I do not intend to change this, so you can reliably apply @egreg' patch. Jun 17, 2022 at 8:01
1

In OpTeX, this problem doesn't exists. The original \vdots keeps unchanged even though the Unicode math with KP fonts and otf-math is initialized. The control sequence \unicodevdots is ready to access the Unicode vdots character. Compare:

\fontfam[kp]
$$
  \pmatrix{\mu_1\cr \vdots\cr \mu_n}, \quad \pmatrix{\mu_1\cr \unicodevdots\cr \mu_n}
$$
\bye

Of course, you can say \let\vdots=\unicodevdots if you like the Unicode character. See section 2.6 of the document optex-math for more information.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .