6

The issue is possibly going to be reviewed once the version of TeX Live has been installed.

I would like to have a command that stretches the common delimiters according to the content. The standard \sin\left( is known to have a bad spacing, the packages https://ctan.org/pkg/mathtools and https://ctan.org/pkg/mleftright and the proposed https://tex.stackexchange.com/a/136767/128553 have a different issue with spacing. I assume that this might be related to the beautiful typeface https://ctan.org/pkg/libertinus-fonts by https://tex.stackexchange.com/users/729. The project requires LuaLaTeX.

The problem does not occur with XeLaTeX with with Latin Modern, nor Libertinus Math. The problem does not occur with LuaLaTeX and Latin Modern. Both engines can be used in the MWE.

The following MWE shows some examples.

\documentclass[a1paper,DIV=50,12pt,landscape]{scrartcl}

%\usepackage{lua-visual-debug} %\usepackage{amsmath,mathtools,mleftright,xparse} %\usepackage{fontspec,unicode-math}

\usepackage{xparse} \usepackage{fontspec} \usepackage{amsmath} \usepackage{mathtools} \usepackage{unicode-math} \usepackage{mleftright}

\ifcase0 \setmainfont{LibertinusSerif-Regular.otf} \setmathfont{LibertinusMath-Regular.otf}[Scale=MatchUppercase,math-style=ISO,bold-style=ISO] \else \setmainfont{lmroman12-regular} \setmathfont{latinmodern-math}[Scale=MatchUppercase,math-style=ISO,bold-style=ISO] \fi

\ExplSyntaxOn%see https://tex.stackexchange.com/a/136767/128553 \DeclareDocumentCommand{\KDeclarePairedDelimiter}{mm} { __egreg_delimiter_clear_keys: % reset to the default \keys_set:nn { egreg/delimiters } { #2 } \use:x % we want to expand the values of the token variables set with the keys { \exp_not:n {\NewDocumentCommand{#1}{sO{}m} } { \exp_not:n { \IfBooleanTF{##1} } { \exp_not:N \egreg_paired_delimiter_expand:nnnn { \exp_not:V \l_egreg_delimiter_left_tl } { \exp_not:V \l_egreg_delimiter_right_tl } { \exp_not:n { ##3 } } { \exp_not:V \l_egreg_delimiter_subscript_tl } } { \exp_not:N \egreg_paired_delimiter_fixed:nnnnn { \exp_not:n { ##2 } } { \exp_not:V \l_egreg_delimiter_left_tl } { \exp_not:V \l_egreg_delimiter_right_tl } { \exp_not:n { ##3 } } { \exp_not:V \l_egreg_delimiter_subscript_tl } } } } }

\keys_define:nn { egreg/delimiters } { left .tl_set:N = \l_egreg_delimiter_left_tl, right .tl_set:N = \l_egreg_delimiter_right_tl, subscript .tl_set:N = \l_egreg_delimiter_subscript_tl, }

\cs_new_protected:Npn __egreg_delimiter_clear_keys: { \keys_set:nn { egreg/delimiters } { left=.,right=.,subscript={} } }

\cs_new_protected:Npn \egreg_paired_delimiter_expand:nnnn #1 #2 #3 #4 {% Fix the spacing issue with \left and \right (D. Arsenau, P. Stephani and H. Oberdiek) \mathopen{} \mathclose\c_group_begin_token \left#1 #3 \group_insert_after:N \c_group_end_token \right#2 \tl_if_empty:nF {#4} { \c_math_subscript_token {#4} } } \cs_new_protected:Npn \egreg_paired_delimiter_fixed:nnnnn #1 #2 #3 #4 #5 { \mathopen{#1#2}#4\mathclose{#1#3} \tl_if_empty:nF {#5} { \c_math_subscript_token {#5} } } \ExplSyntaxOff

\DeclareMathOperator{\mtool}{mtl} \DeclareMathOperator{\plain}{pl} \DeclareMathOperator{\lr}{rl} \DeclareMathOperator{\mlr}{mrl} \DeclareMathOperator{\egl}{egl} \newcommand{\argdot}{{\hspace{0.16667em}\cdot\hspace{0.16667em}}}

\KDeclarePairedDelimiter{\knorm}{left=\lVert,right=\rVert} \KDeclarePairedDelimiter{\kabs}{left=\lvert,right=\rvert} \KDeclarePairedDelimiter{\kbracket}{left=(,right=)}

\DeclarePairedDelimiter{\norm}{\lVert}{\rVert} \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} \DeclarePairedDelimiter{\bracket}{(}{)}

\newcommand{\checkLetter}[1]{ f\abs{#1} \plain\lvert{}#1\rvert -\mtool\abs{#1} +\mtool\abs{#1} #\egl\kabs{#1} \times\lr\left\lvert{}#1\right\rvert \mlr\mleft\lvert{}#1\mright\rvert \quad \plain(#1) -\mtool\bracket{#1} +\mtool\bracket{#1{}} #\egl\kbracket{#1{}} \times\lr\left(#1\right) *\mlr\mleft(#1\mright) } \newcommand{\checkLetterSingle}[1]{ \checkLetter{#1} &=\checkLetter{\int #1}\allowdisplaybreaks\ }

\begin{document}

\begin{align} % {{\dot\Gamma_{r}}}{1}^{2}\ \checkLetterSingle{\argdot} \checkLetterSingle{\argdot{}^{}} %
1\checkLetterSingle {f} 1u\checkLetterSingle {f_{}} 1a\checkLetterSingle {f^{}} 1au\checkLetterSingle {f_{}^{}} 1h\checkLetterSingle {f\hspace{1pt}} %% % 2\checkLetterSingle F % 2h\checkLetterSingle {F\hspace{1pt}} % 2a\checkLetterSingle {F^{}} % 2u\checkLetterSingle {F_{}} % 2au\checkLetterSingle {F_{}^{}}%
%% % 6\checkLetterSingle \omega % 7\checkLetterSingle {f_\sum} % 7a\checkLetterSingle {{f_\sum}^{}} % 7u\checkLetterSingle {{f_\sum}{}} % 7au\checkLetterSingle {{f\sum}_{}^{}} \end{align
}

\end{document}

A detail of the whole picture: pl (without anything), mtl (mathtools), egl (egreg's proposal), rl (\left), and url (mleftright).
enter image description here The problem can be solved by manually adding hspace by try and error but I do not really like that. I consider that a dirty solution as it is time consuming and not consistent.

The problem is less prominent or not existent with Latin Modern (I do not know whether this is on purpose or not): enter image description here

More examples (feel free to experiment with the code): enter image description here

https://tex.stackexchange.com/users/3929 noted that this is not a kerning but a spacing issue. Thank you. He is no longer maintainer of the typeface, see https://github.com/alerque/libertinus/issues/328.

CampanIgnis
  • 4,624

0 Answers0