Is it canonical bit space? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)remove additional space before `:`No space present after ensuremathExplicit space character?Extra vertical space before displayed math in enumeration with newtxmathBit Grouping in LaTeXExtra space in renewcommandHow to define variables with white spacelist of canonical math operatorsHow to make mtpro2 math font a litte bit more thick?Automatically convert math written in .tex into a canonical form that retains all the math information

Inverse square law not accurate for non-point masses?

Does the main washing effect of soap come from foam?

Is it OK to use the testing sample to compare algorithms?

How does the body cool itself in a stillsuit?

How to make triangles with rounded sides and corners? (squircle with 3 sides)

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?

Is this Half-dragon Quaggoth boss monster balanced?

How do I find my Spellcasting Ability for my D&D character?

What does 丫 mean? 丫是什么意思?

An isoperimetric-type inequality inside a cube

Fit odd number of triplets in a measure?

Was the pager message from Nick Fury to Captain Marvel unnecessary?

Baking rewards as operations

How could a hydrazine and N2O4 cloud (or it's reactants) show up in weather radar?

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

How do I say "this must not happen"?

Why not use the yoke to control yaw, as well as pitch and roll?

Is there a spell that can create a permanent fire?

Does the universe have a fixed centre of mass?

Determine whether an integer is a palindrome

Getting representations of the Lie group out of representations of its Lie algebra

Table formatting with tabularx?

Marquee sign letters

Can gravitational waves pass through a black hole?



Is it canonical bit space?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)remove additional space before `:`No space present after ensuremathExplicit space character?Extra vertical space before displayed math in enumeration with newtxmathBit Grouping in LaTeXExtra space in renewcommandHow to define variables with white spacelist of canonical math operatorsHow to make mtpro2 math font a litte bit more thick?Automatically convert math written in .tex into a canonical form that retains all the math information










19















I have this simple code,



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument
$dbarp$ and $dt$.
enddocument


with this output,



enter image description here



I think it's a canonical space is due to the presence of the bar... command? Sometimes to bring it back I insert a negative space ! to bring the p to the left near the d.



This little adjustment must always be done or I should create a particular macro. Which one could be always using the same command bar? It gets a bit complicated for me in my book to change the original command bar.... Thank you.




Using Steven Segletes' suggestion of ooalign$dbar#1$cr$d#1$, one can see if the problem is universal across bar. If the superposition produces a "thick" second letter, the kerning is not correct. (using newtxmath as Steven does not have mtpro2)



Unfortunately, that proves not to be the case, as some cases seem kerned correctly and others not:



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
newcommandtestkern[1]%
ooalign$dbar#1$cr$d#1$
textwidth 1in
begindocument
noindenttestkerna
testkernb
testkernc
testkernd
testkerne
testkernf
testkerng
testkernh
testkerni
testkernj
testkernk
testkernl
testkernm
testkernn
testkerno
testkernp
testkernq
testkernr
testkerns
testkernt
testkernu
testkernv
testkernw
testkernx
testkerny
testkernz
enddocument


enter image description here



Applying a universal -1mu kern to bar



newcommandxbarmkern-1mubar
newcommandtestkern[1]%
ooalign$dxbar#1$cr$d#1$


therefore, may fix some letter combinations, but will inevitably break others:



enter image description here










share|improve this question



















  • 4





    Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

    – Steven B. Segletes
    Apr 4 at 10:18












  • @StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

    – Sebastiano
    Apr 4 at 10:20







  • 1





    If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

    – Steven B. Segletes
    Apr 4 at 10:24







  • 2





    Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

    – Steven B. Segletes
    Apr 4 at 10:26







  • 1





    I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

    – Stefan Kottwitz
    Apr 7 at 15:01















19















I have this simple code,



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument
$dbarp$ and $dt$.
enddocument


with this output,



enter image description here



I think it's a canonical space is due to the presence of the bar... command? Sometimes to bring it back I insert a negative space ! to bring the p to the left near the d.



This little adjustment must always be done or I should create a particular macro. Which one could be always using the same command bar? It gets a bit complicated for me in my book to change the original command bar.... Thank you.




Using Steven Segletes' suggestion of ooalign$dbar#1$cr$d#1$, one can see if the problem is universal across bar. If the superposition produces a "thick" second letter, the kerning is not correct. (using newtxmath as Steven does not have mtpro2)



Unfortunately, that proves not to be the case, as some cases seem kerned correctly and others not:



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
newcommandtestkern[1]%
ooalign$dbar#1$cr$d#1$
textwidth 1in
begindocument
noindenttestkerna
testkernb
testkernc
testkernd
testkerne
testkernf
testkerng
testkernh
testkerni
testkernj
testkernk
testkernl
testkernm
testkernn
testkerno
testkernp
testkernq
testkernr
testkerns
testkernt
testkernu
testkernv
testkernw
testkernx
testkerny
testkernz
enddocument


enter image description here



Applying a universal -1mu kern to bar



newcommandxbarmkern-1mubar
newcommandtestkern[1]%
ooalign$dxbar#1$cr$d#1$


therefore, may fix some letter combinations, but will inevitably break others:



enter image description here










share|improve this question



















  • 4





    Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

    – Steven B. Segletes
    Apr 4 at 10:18












  • @StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

    – Sebastiano
    Apr 4 at 10:20







  • 1





    If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

    – Steven B. Segletes
    Apr 4 at 10:24







  • 2





    Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

    – Steven B. Segletes
    Apr 4 at 10:26







  • 1





    I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

    – Stefan Kottwitz
    Apr 7 at 15:01













19












19








19


1






I have this simple code,



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument
$dbarp$ and $dt$.
enddocument


with this output,



enter image description here



I think it's a canonical space is due to the presence of the bar... command? Sometimes to bring it back I insert a negative space ! to bring the p to the left near the d.



This little adjustment must always be done or I should create a particular macro. Which one could be always using the same command bar? It gets a bit complicated for me in my book to change the original command bar.... Thank you.




Using Steven Segletes' suggestion of ooalign$dbar#1$cr$d#1$, one can see if the problem is universal across bar. If the superposition produces a "thick" second letter, the kerning is not correct. (using newtxmath as Steven does not have mtpro2)



Unfortunately, that proves not to be the case, as some cases seem kerned correctly and others not:



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
newcommandtestkern[1]%
ooalign$dbar#1$cr$d#1$
textwidth 1in
begindocument
noindenttestkerna
testkernb
testkernc
testkernd
testkerne
testkernf
testkerng
testkernh
testkerni
testkernj
testkernk
testkernl
testkernm
testkernn
testkerno
testkernp
testkernq
testkernr
testkerns
testkernt
testkernu
testkernv
testkernw
testkernx
testkerny
testkernz
enddocument


enter image description here



Applying a universal -1mu kern to bar



newcommandxbarmkern-1mubar
newcommandtestkern[1]%
ooalign$dxbar#1$cr$d#1$


therefore, may fix some letter combinations, but will inevitably break others:



enter image description here










share|improve this question
















I have this simple code,



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument
$dbarp$ and $dt$.
enddocument


with this output,



enter image description here



I think it's a canonical space is due to the presence of the bar... command? Sometimes to bring it back I insert a negative space ! to bring the p to the left near the d.



This little adjustment must always be done or I should create a particular macro. Which one could be always using the same command bar? It gets a bit complicated for me in my book to change the original command bar.... Thank you.




Using Steven Segletes' suggestion of ooalign$dbar#1$cr$d#1$, one can see if the problem is universal across bar. If the superposition produces a "thick" second letter, the kerning is not correct. (using newtxmath as Steven does not have mtpro2)



Unfortunately, that proves not to be the case, as some cases seem kerned correctly and others not:



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
newcommandtestkern[1]%
ooalign$dbar#1$cr$d#1$
textwidth 1in
begindocument
noindenttestkerna
testkernb
testkernc
testkernd
testkerne
testkernf
testkerng
testkernh
testkerni
testkernj
testkernk
testkernl
testkernm
testkernn
testkerno
testkernp
testkernq
testkernr
testkerns
testkernt
testkernu
testkernv
testkernw
testkernx
testkerny
testkernz
enddocument


enter image description here



Applying a universal -1mu kern to bar



newcommandxbarmkern-1mubar
newcommandtestkern[1]%
ooalign$dxbar#1$cr$d#1$


therefore, may fix some letter combinations, but will inevitably break others:



enter image description here







math-mode macros symbols mtpro newtx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 4 at 10:54









Steven B. Segletes

163k9207419




163k9207419










asked Apr 4 at 10:13









SebastianoSebastiano

11.4k42266




11.4k42266







  • 4





    Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

    – Steven B. Segletes
    Apr 4 at 10:18












  • @StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

    – Sebastiano
    Apr 4 at 10:20







  • 1





    If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

    – Steven B. Segletes
    Apr 4 at 10:24







  • 2





    Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

    – Steven B. Segletes
    Apr 4 at 10:26







  • 1





    I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

    – Stefan Kottwitz
    Apr 7 at 15:01












  • 4





    Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

    – Steven B. Segletes
    Apr 4 at 10:18












  • @StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

    – Sebastiano
    Apr 4 at 10:20







  • 1





    If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

    – Steven B. Segletes
    Apr 4 at 10:24







  • 2





    Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

    – Steven B. Segletes
    Apr 4 at 10:26







  • 1





    I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

    – Stefan Kottwitz
    Apr 7 at 15:01







4




4





Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

– Steven B. Segletes
Apr 4 at 10:18






Without mtpro2, the space does not manifest. However, it does show, when, instead of mtpro2, one uses newtxmath.

– Steven B. Segletes
Apr 4 at 10:18














@StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

– Sebastiano
Apr 4 at 10:20






@StevenB.Segletes You've given me some very bad news. :-( I have the whole book with mtpro2 because I like fonts.

– Sebastiano
Apr 4 at 10:20





1




1





If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

– Steven B. Segletes
Apr 4 at 10:24






If the problem is universal with bar in that font, you could always do letsvbarbarrenewcommandbarmkern-1musvbar

– Steven B. Segletes
Apr 4 at 10:24





2




2





Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

– Steven B. Segletes
Apr 4 at 10:26






Yes, if the two superimposed p's are "thick", that means the kerning is different between the two cases. If the superimposed p's look like one, then the kerning is correct.

– Steven B. Segletes
Apr 4 at 10:26





1




1





I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

– Stefan Kottwitz
Apr 7 at 15:01





I removed some offtopic comments. (the conversation seemed to be finished anyway). Thanks.

– Stefan Kottwitz
Apr 7 at 15:01










2 Answers
2






active

oldest

votes


















19














A proposal to renew the command of bar as follows:



letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!


This will guarantee proper kerning of the letter, as it is set first thing without the bar. Then, I kern backward across the letter, and apply the bar to a variant of the letter's phantom. In this case, the variant is a shifted phantom, which is then unshifted following the bar, so as not to introduce any stray space.



Therefore, if there are residual kerning issues, they will be with the placement of the superimposed bar, relative to the underlying properly kerned letter.



The MWE uses the ooalign test given in the question to judge the quality of the bar macro, using letter boldness as an indicator for bad kerning. As you can see, there are no thick/boldened letters signifying a kern mismatch. Therefore, with this approach, one must merely judge if the placement of the bar relative to the letter is suitable or not.



While all examples are shown relative to the letter "d", the method, in fact, will perform similarly, regardless of the preceding letter.



EDITED to work across math styles.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
usepackagescalerel
letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!
newcommandtestkern[2][]%
ooalign$#1 dbar#2$cr$#1 d#2$
textwidth 1in
begindocument
noindenttestkerna testkernb testkernc testkernd
testkerne testkernf testkerng testkernh testkerni
testkernj testkernk testkernl testkernm testkernn
testkerno testkernp testkernq testkernr testkerns
testkernt testkernu testkernv testkernw testkernx
testkerny testkernz

noindenttestkern[scriptstyle]a testkern[scriptstyle]b
testkern[scriptstyle]c testkern[scriptstyle]d
testkern[scriptstyle]e testkern[scriptstyle]f
testkern[scriptstyle]g testkern[scriptstyle]h
testkern[scriptstyle]i testkern[scriptstyle]j
testkern[scriptstyle]k testkern[scriptstyle]l
testkern[scriptstyle]m testkern[scriptstyle]n
testkern[scriptstyle]o testkern[scriptstyle]p
testkern[scriptstyle]q testkern[scriptstyle]r
testkern[scriptstyle]s testkern[scriptstyle]t
testkern[scriptstyle]u testkern[scriptstyle]v
testkern[scriptstyle]w testkern[scriptstyle]x
testkern[scriptstyle]y testkern[scriptstyle]z

noindent$2 dbarp^2ne2d p^2$
enddocument


enter image description here






share|improve this answer




















  • 1





    My always thanks from my first question I asked two and a half years ago :-)

    – Sebastiano
    Apr 4 at 11:21






  • 2





    @Sebastiano It has been my pleasure to assist you.

    – Steven B. Segletes
    Apr 4 at 11:26











  • Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

    – Sebastiano
    Apr 4 at 19:53











  • @Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

    – Steven B. Segletes
    Apr 4 at 19:54











  • I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

    – Sebastiano
    Apr 4 at 19:55


















16














If I compile



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument

$dbarp$

$dp$

showoutput

enddocument


I get, for the two formulas



....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....vbox(7.88399+2.568)x7.98
.....hbox(7.88399+0.0)x0.0, shifted 3.312
......LMP2/mtt/m/n/12 N
.....kern-5.484
.....hbox(5.484+2.568)x7.98
......LMP1/mtt/m/it/12 p
....mathoff


....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....kern-2.40001
....LMP1/mtt/m/it/12 p
....kern0.48
....mathoff


After removing the call to mtpro2, I get



....mathon
....OML/cmm/m/it/12 d
....vbox(6.77774+2.33331)x5.89717
.....hbox(6.77774+0.0)x0.0, shifted 0.99028
......OT1/cmr/m/n/12 ^^V
.....kern-5.16667
.....hbox(5.16667+2.33331)x5.89717
......OML/cmm/m/it/12 p
....mathoff


....mathon
....OML/cmm/m/it/12 d
....OML/cmm/m/it/12 p
....mathoff


The obvious difference is that d in the font LMP1/mtt/m/it/12 (pointing to mt2mit at 12pt) has an italic correction, which isn't present in the OML/cmm/m/it/12 font (pointing to cmsy10 at 12pt).



Indeed, if I do tftopl mt2mit, I get



(CHARACTER C d
(CHARWD R 0.551)
(CHARHT R 0.717)
(CHARIC R 0.12)
(COMMENT
(KRN O 0 R -0.06)
[...]
(KRN C p R -0.2)
[...]
(KRN C t R -0.04)
[...]
(KRN O 263 R -0.02)
)
)


and with tftopl cmsy10 I get



(CHARACTER O 100
(CHARWD R 0.611113)
(CHARHT R 0.694445)
)


As you can see, there is also a kerning pair with p or t, which moves in the character when there is no accent, but this is not possible when the next item is an Acc atom.



You can manually compute the appropriate kerning.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2

newcommanddwithbar[1]%
dcomputedaccentkern#1bar#1%

makeatletter
newcommandcomputedaccentkern[1]%
mathpalettecomputedaccentkern@#1%

newcommandcomputedaccentkern@[2]%
begingroup
sboxz@$m@th#1d#2$
sboxtw@$m@th#1dkern0pt#2$%
kerndimexprwdz@-wdtw@relax
endgroup

makeatother


begindocument

$dbarp$ $scriptstyle dbarp$

$dwithbarp$ $scriptstyle dwithbarp$

$dp$ $scriptstyle dp$

$dbart$ $scriptstyle dbart$

$dwithbart$ $scriptstyle dwithbart$

$dt$ $scriptstyle dt$

enddocument


You can define similarly for other accents, say dot:



newcommanddwithdot[1]%
dcomputedaccentkern#1dot#1%



or a generic



newcommanddwithacc[2]%
dcomputedaccentkern#2#1#2%



to be called like dwithaccbarp or dwithaccdotp.



enter image description here






share|improve this answer

























  • Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

    – Sebastiano
    Apr 4 at 11:20






  • 2





    @Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

    – egreg
    Apr 4 at 11:21











  • Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

    – Steven B. Segletes
    Apr 4 at 11:57






  • 1





    @StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

    – egreg
    Apr 4 at 12:02











  • @egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

    – Sebastiano
    Apr 4 at 19:52











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483128%2fis-it-canonical-bit-space%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









19














A proposal to renew the command of bar as follows:



letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!


This will guarantee proper kerning of the letter, as it is set first thing without the bar. Then, I kern backward across the letter, and apply the bar to a variant of the letter's phantom. In this case, the variant is a shifted phantom, which is then unshifted following the bar, so as not to introduce any stray space.



Therefore, if there are residual kerning issues, they will be with the placement of the superimposed bar, relative to the underlying properly kerned letter.



The MWE uses the ooalign test given in the question to judge the quality of the bar macro, using letter boldness as an indicator for bad kerning. As you can see, there are no thick/boldened letters signifying a kern mismatch. Therefore, with this approach, one must merely judge if the placement of the bar relative to the letter is suitable or not.



While all examples are shown relative to the letter "d", the method, in fact, will perform similarly, regardless of the preceding letter.



EDITED to work across math styles.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
usepackagescalerel
letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!
newcommandtestkern[2][]%
ooalign$#1 dbar#2$cr$#1 d#2$
textwidth 1in
begindocument
noindenttestkerna testkernb testkernc testkernd
testkerne testkernf testkerng testkernh testkerni
testkernj testkernk testkernl testkernm testkernn
testkerno testkernp testkernq testkernr testkerns
testkernt testkernu testkernv testkernw testkernx
testkerny testkernz

noindenttestkern[scriptstyle]a testkern[scriptstyle]b
testkern[scriptstyle]c testkern[scriptstyle]d
testkern[scriptstyle]e testkern[scriptstyle]f
testkern[scriptstyle]g testkern[scriptstyle]h
testkern[scriptstyle]i testkern[scriptstyle]j
testkern[scriptstyle]k testkern[scriptstyle]l
testkern[scriptstyle]m testkern[scriptstyle]n
testkern[scriptstyle]o testkern[scriptstyle]p
testkern[scriptstyle]q testkern[scriptstyle]r
testkern[scriptstyle]s testkern[scriptstyle]t
testkern[scriptstyle]u testkern[scriptstyle]v
testkern[scriptstyle]w testkern[scriptstyle]x
testkern[scriptstyle]y testkern[scriptstyle]z

noindent$2 dbarp^2ne2d p^2$
enddocument


enter image description here






share|improve this answer




















  • 1





    My always thanks from my first question I asked two and a half years ago :-)

    – Sebastiano
    Apr 4 at 11:21






  • 2





    @Sebastiano It has been my pleasure to assist you.

    – Steven B. Segletes
    Apr 4 at 11:26











  • Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

    – Sebastiano
    Apr 4 at 19:53











  • @Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

    – Steven B. Segletes
    Apr 4 at 19:54











  • I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

    – Sebastiano
    Apr 4 at 19:55















19














A proposal to renew the command of bar as follows:



letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!


This will guarantee proper kerning of the letter, as it is set first thing without the bar. Then, I kern backward across the letter, and apply the bar to a variant of the letter's phantom. In this case, the variant is a shifted phantom, which is then unshifted following the bar, so as not to introduce any stray space.



Therefore, if there are residual kerning issues, they will be with the placement of the superimposed bar, relative to the underlying properly kerned letter.



The MWE uses the ooalign test given in the question to judge the quality of the bar macro, using letter boldness as an indicator for bad kerning. As you can see, there are no thick/boldened letters signifying a kern mismatch. Therefore, with this approach, one must merely judge if the placement of the bar relative to the letter is suitable or not.



While all examples are shown relative to the letter "d", the method, in fact, will perform similarly, regardless of the preceding letter.



EDITED to work across math styles.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
usepackagescalerel
letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!
newcommandtestkern[2][]%
ooalign$#1 dbar#2$cr$#1 d#2$
textwidth 1in
begindocument
noindenttestkerna testkernb testkernc testkernd
testkerne testkernf testkerng testkernh testkerni
testkernj testkernk testkernl testkernm testkernn
testkerno testkernp testkernq testkernr testkerns
testkernt testkernu testkernv testkernw testkernx
testkerny testkernz

noindenttestkern[scriptstyle]a testkern[scriptstyle]b
testkern[scriptstyle]c testkern[scriptstyle]d
testkern[scriptstyle]e testkern[scriptstyle]f
testkern[scriptstyle]g testkern[scriptstyle]h
testkern[scriptstyle]i testkern[scriptstyle]j
testkern[scriptstyle]k testkern[scriptstyle]l
testkern[scriptstyle]m testkern[scriptstyle]n
testkern[scriptstyle]o testkern[scriptstyle]p
testkern[scriptstyle]q testkern[scriptstyle]r
testkern[scriptstyle]s testkern[scriptstyle]t
testkern[scriptstyle]u testkern[scriptstyle]v
testkern[scriptstyle]w testkern[scriptstyle]x
testkern[scriptstyle]y testkern[scriptstyle]z

noindent$2 dbarp^2ne2d p^2$
enddocument


enter image description here






share|improve this answer




















  • 1





    My always thanks from my first question I asked two and a half years ago :-)

    – Sebastiano
    Apr 4 at 11:21






  • 2





    @Sebastiano It has been my pleasure to assist you.

    – Steven B. Segletes
    Apr 4 at 11:26











  • Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

    – Sebastiano
    Apr 4 at 19:53











  • @Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

    – Steven B. Segletes
    Apr 4 at 19:54











  • I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

    – Sebastiano
    Apr 4 at 19:55













19












19








19







A proposal to renew the command of bar as follows:



letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!


This will guarantee proper kerning of the letter, as it is set first thing without the bar. Then, I kern backward across the letter, and apply the bar to a variant of the letter's phantom. In this case, the variant is a shifted phantom, which is then unshifted following the bar, so as not to introduce any stray space.



Therefore, if there are residual kerning issues, they will be with the placement of the superimposed bar, relative to the underlying properly kerned letter.



The MWE uses the ooalign test given in the question to judge the quality of the bar macro, using letter boldness as an indicator for bad kerning. As you can see, there are no thick/boldened letters signifying a kern mismatch. Therefore, with this approach, one must merely judge if the placement of the bar relative to the letter is suitable or not.



While all examples are shown relative to the letter "d", the method, in fact, will perform similarly, regardless of the preceding letter.



EDITED to work across math styles.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
usepackagescalerel
letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!
newcommandtestkern[2][]%
ooalign$#1 dbar#2$cr$#1 d#2$
textwidth 1in
begindocument
noindenttestkerna testkernb testkernc testkernd
testkerne testkernf testkerng testkernh testkerni
testkernj testkernk testkernl testkernm testkernn
testkerno testkernp testkernq testkernr testkerns
testkernt testkernu testkernv testkernw testkernx
testkerny testkernz

noindenttestkern[scriptstyle]a testkern[scriptstyle]b
testkern[scriptstyle]c testkern[scriptstyle]d
testkern[scriptstyle]e testkern[scriptstyle]f
testkern[scriptstyle]g testkern[scriptstyle]h
testkern[scriptstyle]i testkern[scriptstyle]j
testkern[scriptstyle]k testkern[scriptstyle]l
testkern[scriptstyle]m testkern[scriptstyle]n
testkern[scriptstyle]o testkern[scriptstyle]p
testkern[scriptstyle]q testkern[scriptstyle]r
testkern[scriptstyle]s testkern[scriptstyle]t
testkern[scriptstyle]u testkern[scriptstyle]v
testkern[scriptstyle]w testkern[scriptstyle]x
testkern[scriptstyle]y testkern[scriptstyle]z

noindent$2 dbarp^2ne2d p^2$
enddocument


enter image description here






share|improve this answer















A proposal to renew the command of bar as follows:



letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!


This will guarantee proper kerning of the letter, as it is set first thing without the bar. Then, I kern backward across the letter, and apply the bar to a variant of the letter's phantom. In this case, the variant is a shifted phantom, which is then unshifted following the bar, so as not to introduce any stray space.



Therefore, if there are residual kerning issues, they will be with the placement of the superimposed bar, relative to the underlying properly kerned letter.



The MWE uses the ooalign test given in the question to judge the quality of the bar macro, using letter boldness as an indicator for bad kerning. As you can see, there are no thick/boldened letters signifying a kern mismatch. Therefore, with this approach, one must merely judge if the placement of the bar relative to the letter is suitable or not.



While all examples are shown relative to the letter "d", the method, in fact, will perform similarly, regardless of the preceding letter.



EDITED to work across math styles.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackagenewtxmath%instead of usepackage[lite]mtpro2
usepackagescalerel
letsvbarbar
renewcommandbar[1]%
#1ThisStylesetbox0=hbox$SavedStyle#1$kern-wd0svbar,phantom#1!
newcommandtestkern[2][]%
ooalign$#1 dbar#2$cr$#1 d#2$
textwidth 1in
begindocument
noindenttestkerna testkernb testkernc testkernd
testkerne testkernf testkerng testkernh testkerni
testkernj testkernk testkernl testkernm testkernn
testkerno testkernp testkernq testkernr testkerns
testkernt testkernu testkernv testkernw testkernx
testkerny testkernz

noindenttestkern[scriptstyle]a testkern[scriptstyle]b
testkern[scriptstyle]c testkern[scriptstyle]d
testkern[scriptstyle]e testkern[scriptstyle]f
testkern[scriptstyle]g testkern[scriptstyle]h
testkern[scriptstyle]i testkern[scriptstyle]j
testkern[scriptstyle]k testkern[scriptstyle]l
testkern[scriptstyle]m testkern[scriptstyle]n
testkern[scriptstyle]o testkern[scriptstyle]p
testkern[scriptstyle]q testkern[scriptstyle]r
testkern[scriptstyle]s testkern[scriptstyle]t
testkern[scriptstyle]u testkern[scriptstyle]v
testkern[scriptstyle]w testkern[scriptstyle]x
testkern[scriptstyle]y testkern[scriptstyle]z

noindent$2 dbarp^2ne2d p^2$
enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 4 at 14:02

























answered Apr 4 at 11:12









Steven B. SegletesSteven B. Segletes

163k9207419




163k9207419







  • 1





    My always thanks from my first question I asked two and a half years ago :-)

    – Sebastiano
    Apr 4 at 11:21






  • 2





    @Sebastiano It has been my pleasure to assist you.

    – Steven B. Segletes
    Apr 4 at 11:26











  • Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

    – Sebastiano
    Apr 4 at 19:53











  • @Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

    – Steven B. Segletes
    Apr 4 at 19:54











  • I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

    – Sebastiano
    Apr 4 at 19:55












  • 1





    My always thanks from my first question I asked two and a half years ago :-)

    – Sebastiano
    Apr 4 at 11:21






  • 2





    @Sebastiano It has been my pleasure to assist you.

    – Steven B. Segletes
    Apr 4 at 11:26











  • Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

    – Sebastiano
    Apr 4 at 19:53











  • @Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

    – Steven B. Segletes
    Apr 4 at 19:54











  • I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

    – Sebastiano
    Apr 4 at 19:55







1




1





My always thanks from my first question I asked two and a half years ago :-)

– Sebastiano
Apr 4 at 11:21





My always thanks from my first question I asked two and a half years ago :-)

– Sebastiano
Apr 4 at 11:21




2




2





@Sebastiano It has been my pleasure to assist you.

– Steven B. Segletes
Apr 4 at 11:26





@Sebastiano It has been my pleasure to assist you.

– Steven B. Segletes
Apr 4 at 11:26













Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

– Sebastiano
Apr 4 at 19:53





Steven I can't get a green check mark. I'm sorry. The two answers are both beautiful.

– Sebastiano
Apr 4 at 19:53













@Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

– Steven B. Segletes
Apr 4 at 19:54





@Sebastiano No problem. Sometimes, a question without a checkmark brings more eyes, from those thinking it is still unanswered.

– Steven B. Segletes
Apr 4 at 19:54













I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

– Sebastiano
Apr 4 at 19:55





I really appreciate the answers. When I can't choose, they are rare for me, it's because I can't penalize one user over another.

– Sebastiano
Apr 4 at 19:55











16














If I compile



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument

$dbarp$

$dp$

showoutput

enddocument


I get, for the two formulas



....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....vbox(7.88399+2.568)x7.98
.....hbox(7.88399+0.0)x0.0, shifted 3.312
......LMP2/mtt/m/n/12 N
.....kern-5.484
.....hbox(5.484+2.568)x7.98
......LMP1/mtt/m/it/12 p
....mathoff


....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....kern-2.40001
....LMP1/mtt/m/it/12 p
....kern0.48
....mathoff


After removing the call to mtpro2, I get



....mathon
....OML/cmm/m/it/12 d
....vbox(6.77774+2.33331)x5.89717
.....hbox(6.77774+0.0)x0.0, shifted 0.99028
......OT1/cmr/m/n/12 ^^V
.....kern-5.16667
.....hbox(5.16667+2.33331)x5.89717
......OML/cmm/m/it/12 p
....mathoff


....mathon
....OML/cmm/m/it/12 d
....OML/cmm/m/it/12 p
....mathoff


The obvious difference is that d in the font LMP1/mtt/m/it/12 (pointing to mt2mit at 12pt) has an italic correction, which isn't present in the OML/cmm/m/it/12 font (pointing to cmsy10 at 12pt).



Indeed, if I do tftopl mt2mit, I get



(CHARACTER C d
(CHARWD R 0.551)
(CHARHT R 0.717)
(CHARIC R 0.12)
(COMMENT
(KRN O 0 R -0.06)
[...]
(KRN C p R -0.2)
[...]
(KRN C t R -0.04)
[...]
(KRN O 263 R -0.02)
)
)


and with tftopl cmsy10 I get



(CHARACTER O 100
(CHARWD R 0.611113)
(CHARHT R 0.694445)
)


As you can see, there is also a kerning pair with p or t, which moves in the character when there is no accent, but this is not possible when the next item is an Acc atom.



You can manually compute the appropriate kerning.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2

newcommanddwithbar[1]%
dcomputedaccentkern#1bar#1%

makeatletter
newcommandcomputedaccentkern[1]%
mathpalettecomputedaccentkern@#1%

newcommandcomputedaccentkern@[2]%
begingroup
sboxz@$m@th#1d#2$
sboxtw@$m@th#1dkern0pt#2$%
kerndimexprwdz@-wdtw@relax
endgroup

makeatother


begindocument

$dbarp$ $scriptstyle dbarp$

$dwithbarp$ $scriptstyle dwithbarp$

$dp$ $scriptstyle dp$

$dbart$ $scriptstyle dbart$

$dwithbart$ $scriptstyle dwithbart$

$dt$ $scriptstyle dt$

enddocument


You can define similarly for other accents, say dot:



newcommanddwithdot[1]%
dcomputedaccentkern#1dot#1%



or a generic



newcommanddwithacc[2]%
dcomputedaccentkern#2#1#2%



to be called like dwithaccbarp or dwithaccdotp.



enter image description here






share|improve this answer

























  • Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

    – Sebastiano
    Apr 4 at 11:20






  • 2





    @Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

    – egreg
    Apr 4 at 11:21











  • Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

    – Steven B. Segletes
    Apr 4 at 11:57






  • 1





    @StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

    – egreg
    Apr 4 at 12:02











  • @egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

    – Sebastiano
    Apr 4 at 19:52















16














If I compile



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument

$dbarp$

$dp$

showoutput

enddocument


I get, for the two formulas



....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....vbox(7.88399+2.568)x7.98
.....hbox(7.88399+0.0)x0.0, shifted 3.312
......LMP2/mtt/m/n/12 N
.....kern-5.484
.....hbox(5.484+2.568)x7.98
......LMP1/mtt/m/it/12 p
....mathoff


....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....kern-2.40001
....LMP1/mtt/m/it/12 p
....kern0.48
....mathoff


After removing the call to mtpro2, I get



....mathon
....OML/cmm/m/it/12 d
....vbox(6.77774+2.33331)x5.89717
.....hbox(6.77774+0.0)x0.0, shifted 0.99028
......OT1/cmr/m/n/12 ^^V
.....kern-5.16667
.....hbox(5.16667+2.33331)x5.89717
......OML/cmm/m/it/12 p
....mathoff


....mathon
....OML/cmm/m/it/12 d
....OML/cmm/m/it/12 p
....mathoff


The obvious difference is that d in the font LMP1/mtt/m/it/12 (pointing to mt2mit at 12pt) has an italic correction, which isn't present in the OML/cmm/m/it/12 font (pointing to cmsy10 at 12pt).



Indeed, if I do tftopl mt2mit, I get



(CHARACTER C d
(CHARWD R 0.551)
(CHARHT R 0.717)
(CHARIC R 0.12)
(COMMENT
(KRN O 0 R -0.06)
[...]
(KRN C p R -0.2)
[...]
(KRN C t R -0.04)
[...]
(KRN O 263 R -0.02)
)
)


and with tftopl cmsy10 I get



(CHARACTER O 100
(CHARWD R 0.611113)
(CHARHT R 0.694445)
)


As you can see, there is also a kerning pair with p or t, which moves in the character when there is no accent, but this is not possible when the next item is an Acc atom.



You can manually compute the appropriate kerning.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2

newcommanddwithbar[1]%
dcomputedaccentkern#1bar#1%

makeatletter
newcommandcomputedaccentkern[1]%
mathpalettecomputedaccentkern@#1%

newcommandcomputedaccentkern@[2]%
begingroup
sboxz@$m@th#1d#2$
sboxtw@$m@th#1dkern0pt#2$%
kerndimexprwdz@-wdtw@relax
endgroup

makeatother


begindocument

$dbarp$ $scriptstyle dbarp$

$dwithbarp$ $scriptstyle dwithbarp$

$dp$ $scriptstyle dp$

$dbart$ $scriptstyle dbart$

$dwithbart$ $scriptstyle dwithbart$

$dt$ $scriptstyle dt$

enddocument


You can define similarly for other accents, say dot:



newcommanddwithdot[1]%
dcomputedaccentkern#1dot#1%



or a generic



newcommanddwithacc[2]%
dcomputedaccentkern#2#1#2%



to be called like dwithaccbarp or dwithaccdotp.



enter image description here






share|improve this answer

























  • Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

    – Sebastiano
    Apr 4 at 11:20






  • 2





    @Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

    – egreg
    Apr 4 at 11:21











  • Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

    – Steven B. Segletes
    Apr 4 at 11:57






  • 1





    @StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

    – egreg
    Apr 4 at 12:02











  • @egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

    – Sebastiano
    Apr 4 at 19:52













16












16








16







If I compile



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument

$dbarp$

$dp$

showoutput

enddocument


I get, for the two formulas



....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....vbox(7.88399+2.568)x7.98
.....hbox(7.88399+0.0)x0.0, shifted 3.312
......LMP2/mtt/m/n/12 N
.....kern-5.484
.....hbox(5.484+2.568)x7.98
......LMP1/mtt/m/it/12 p
....mathoff


....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....kern-2.40001
....LMP1/mtt/m/it/12 p
....kern0.48
....mathoff


After removing the call to mtpro2, I get



....mathon
....OML/cmm/m/it/12 d
....vbox(6.77774+2.33331)x5.89717
.....hbox(6.77774+0.0)x0.0, shifted 0.99028
......OT1/cmr/m/n/12 ^^V
.....kern-5.16667
.....hbox(5.16667+2.33331)x5.89717
......OML/cmm/m/it/12 p
....mathoff


....mathon
....OML/cmm/m/it/12 d
....OML/cmm/m/it/12 p
....mathoff


The obvious difference is that d in the font LMP1/mtt/m/it/12 (pointing to mt2mit at 12pt) has an italic correction, which isn't present in the OML/cmm/m/it/12 font (pointing to cmsy10 at 12pt).



Indeed, if I do tftopl mt2mit, I get



(CHARACTER C d
(CHARWD R 0.551)
(CHARHT R 0.717)
(CHARIC R 0.12)
(COMMENT
(KRN O 0 R -0.06)
[...]
(KRN C p R -0.2)
[...]
(KRN C t R -0.04)
[...]
(KRN O 263 R -0.02)
)
)


and with tftopl cmsy10 I get



(CHARACTER O 100
(CHARWD R 0.611113)
(CHARHT R 0.694445)
)


As you can see, there is also a kerning pair with p or t, which moves in the character when there is no accent, but this is not possible when the next item is an Acc atom.



You can manually compute the appropriate kerning.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2

newcommanddwithbar[1]%
dcomputedaccentkern#1bar#1%

makeatletter
newcommandcomputedaccentkern[1]%
mathpalettecomputedaccentkern@#1%

newcommandcomputedaccentkern@[2]%
begingroup
sboxz@$m@th#1d#2$
sboxtw@$m@th#1dkern0pt#2$%
kerndimexprwdz@-wdtw@relax
endgroup

makeatother


begindocument

$dbarp$ $scriptstyle dbarp$

$dwithbarp$ $scriptstyle dwithbarp$

$dp$ $scriptstyle dp$

$dbart$ $scriptstyle dbart$

$dwithbart$ $scriptstyle dwithbart$

$dt$ $scriptstyle dt$

enddocument


You can define similarly for other accents, say dot:



newcommanddwithdot[1]%
dcomputedaccentkern#1dot#1%



or a generic



newcommanddwithacc[2]%
dcomputedaccentkern#2#1#2%



to be called like dwithaccbarp or dwithaccdotp.



enter image description here






share|improve this answer















If I compile



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2
begindocument

$dbarp$

$dp$

showoutput

enddocument


I get, for the two formulas



....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....vbox(7.88399+2.568)x7.98
.....hbox(7.88399+0.0)x0.0, shifted 3.312
......LMP2/mtt/m/n/12 N
.....kern-5.484
.....hbox(5.484+2.568)x7.98
......LMP1/mtt/m/it/12 p
....mathoff


....mathon
....LMP1/mtt/m/it/12 d
....kern1.43999
....kern-2.40001
....LMP1/mtt/m/it/12 p
....kern0.48
....mathoff


After removing the call to mtpro2, I get



....mathon
....OML/cmm/m/it/12 d
....vbox(6.77774+2.33331)x5.89717
.....hbox(6.77774+0.0)x0.0, shifted 0.99028
......OT1/cmr/m/n/12 ^^V
.....kern-5.16667
.....hbox(5.16667+2.33331)x5.89717
......OML/cmm/m/it/12 p
....mathoff


....mathon
....OML/cmm/m/it/12 d
....OML/cmm/m/it/12 p
....mathoff


The obvious difference is that d in the font LMP1/mtt/m/it/12 (pointing to mt2mit at 12pt) has an italic correction, which isn't present in the OML/cmm/m/it/12 font (pointing to cmsy10 at 12pt).



Indeed, if I do tftopl mt2mit, I get



(CHARACTER C d
(CHARWD R 0.551)
(CHARHT R 0.717)
(CHARIC R 0.12)
(COMMENT
(KRN O 0 R -0.06)
[...]
(KRN C p R -0.2)
[...]
(KRN C t R -0.04)
[...]
(KRN O 263 R -0.02)
)
)


and with tftopl cmsy10 I get



(CHARACTER O 100
(CHARWD R 0.611113)
(CHARHT R 0.694445)
)


As you can see, there is also a kerning pair with p or t, which moves in the character when there is no accent, but this is not possible when the next item is an Acc atom.



You can manually compute the appropriate kerning.



documentclass[12pt]book
usepackagemathtools
usepackagenewtxtext
usepackage[lite]mtpro2

newcommanddwithbar[1]%
dcomputedaccentkern#1bar#1%

makeatletter
newcommandcomputedaccentkern[1]%
mathpalettecomputedaccentkern@#1%

newcommandcomputedaccentkern@[2]%
begingroup
sboxz@$m@th#1d#2$
sboxtw@$m@th#1dkern0pt#2$%
kerndimexprwdz@-wdtw@relax
endgroup

makeatother


begindocument

$dbarp$ $scriptstyle dbarp$

$dwithbarp$ $scriptstyle dwithbarp$

$dp$ $scriptstyle dp$

$dbart$ $scriptstyle dbart$

$dwithbart$ $scriptstyle dwithbart$

$dt$ $scriptstyle dt$

enddocument


You can define similarly for other accents, say dot:



newcommanddwithdot[1]%
dcomputedaccentkern#1dot#1%



or a generic



newcommanddwithacc[2]%
dcomputedaccentkern#2#1#2%



to be called like dwithaccbarp or dwithaccdotp.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 4 at 12:45









wipet

35.4k4983




35.4k4983










answered Apr 4 at 11:05









egregegreg

736k8919353261




736k8919353261












  • Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

    – Sebastiano
    Apr 4 at 11:20






  • 2





    @Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

    – egreg
    Apr 4 at 11:21











  • Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

    – Steven B. Segletes
    Apr 4 at 11:57






  • 1





    @StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

    – egreg
    Apr 4 at 12:02











  • @egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

    – Sebastiano
    Apr 4 at 19:52

















  • Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

    – Sebastiano
    Apr 4 at 11:20






  • 2





    @Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

    – egreg
    Apr 4 at 11:21











  • Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

    – Steven B. Segletes
    Apr 4 at 11:57






  • 1





    @StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

    – egreg
    Apr 4 at 12:02











  • @egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

    – Sebastiano
    Apr 4 at 19:52
















Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

– Sebastiano
Apr 4 at 11:20





Shocking :-) I dare say amazed. I don't understand almost anything (mathon...mathoff :-) where they come from, CHARACTER etc...) but I can imagine that it's a problem with encoding the different incompatible fonts that I'm using.

– Sebastiano
Apr 4 at 11:20




2




2





@Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

– egreg
Apr 4 at 11:21





@Sebastiano The first part is the analysis of what TeX internally does with the input, in terms of boxes and glue. Then I looked at the metrics for the fonts, finding the correspondence with what we saw in the boxes and glue representation.

– egreg
Apr 4 at 11:21













Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

– Steven B. Segletes
Apr 4 at 11:57





Do i understand your solution correctly that it specifically addresses kerns following the letter "d", or is it universal for any letter combinations?

– Steven B. Segletes
Apr 4 at 11:57




1




1





@StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

– egreg
Apr 4 at 12:02





@StevenB.Segletes It's specifically for d, but could be modified quite easily for other pairs.

– egreg
Apr 4 at 12:02













@egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

– Sebastiano
Apr 4 at 19:52





@egreg Doesn't know who to vote for the two questions to. If I don't, it's because they're both beautiful.

– Sebastiano
Apr 4 at 19:52

















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f483128%2fis-it-canonical-bit-space%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?