TeX - LaTeX Asked by CampanIgnis on July 3, 2021
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 sinleft(
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{}
mathclosec_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}#4mathclose{#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}cdothspace{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]{
fabs*{#1}
plainlvert{}#1rvert
-mtoolabs{#1}
+mtoolabs*{#1}
#eglkabs*{#1}
timeslrleftlvert{}#1rightrvert
*mlrmleftlvert{}#1mrightrvert
quad plain(#1)
-mtoolbracket{#1}
+mtoolbracket*{#1{}}
#eglkbracket*{#1{}}
timeslrleft(#1right)
*mlrmleft(#1mright)
}
newcommand{checkLetterSingle}[1]{
checkLetter{#1}
&=checkLetter{int #1}allowdisplaybreaks
}
begin{document}
begin{align*}
% {{dotGamma_{r}}}_{1}^{2}
checkLetterSingle{argdot}
checkLetterSingle{argdot_{}^{}}
%
1checkLetterSingle {f}
1ucheckLetterSingle {f_{}}
1acheckLetterSingle {f^{}}
1aucheckLetterSingle {f_{}^{}}
1hcheckLetterSingle {fhspace{1pt}}
%%
% 2checkLetterSingle F
% 2hcheckLetterSingle {Fhspace{1pt}}
% 2acheckLetterSingle {F^{}}
% 2ucheckLetterSingle {F_{}}
% 2aucheckLetterSingle {F_{}^{}}%
%%
% 6checkLetterSingle omega
% 7checkLetterSingle {f_sum}
% 7acheckLetterSingle {{f_sum}^{}}
% 7ucheckLetterSingle {{f_sum}_{}}
% 7aucheckLetterSingle {{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
).
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):
More examples (feel free to experiment with the code):
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.
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP