Gradient symbols and letter f mtpro2

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite












So I notice that the spacing between nabla and f
in math mode when using mtpro2 is really wide (for me, at least). Here is the result of typing nabla f with mtpro2.



gradient of f



I wonder if there is a way we can adjust the symbol nabla
based on the next non-space letter, say:



  1. If the next non-space letter is f, then execute kern -0.2 em f,

  2. else, stay at usual.

I have been looking around, but could not find a satisfying solution. Any help
is highly appreciated.










share|improve this question





















  • Can I ask a question please?
    – Sebastiano
    Sep 9 at 8:21














up vote
7
down vote

favorite












So I notice that the spacing between nabla and f
in math mode when using mtpro2 is really wide (for me, at least). Here is the result of typing nabla f with mtpro2.



gradient of f



I wonder if there is a way we can adjust the symbol nabla
based on the next non-space letter, say:



  1. If the next non-space letter is f, then execute kern -0.2 em f,

  2. else, stay at usual.

I have been looking around, but could not find a satisfying solution. Any help
is highly appreciated.










share|improve this question





















  • Can I ask a question please?
    – Sebastiano
    Sep 9 at 8:21












up vote
7
down vote

favorite









up vote
7
down vote

favorite











So I notice that the spacing between nabla and f
in math mode when using mtpro2 is really wide (for me, at least). Here is the result of typing nabla f with mtpro2.



gradient of f



I wonder if there is a way we can adjust the symbol nabla
based on the next non-space letter, say:



  1. If the next non-space letter is f, then execute kern -0.2 em f,

  2. else, stay at usual.

I have been looking around, but could not find a satisfying solution. Any help
is highly appreciated.










share|improve this question













So I notice that the spacing between nabla and f
in math mode when using mtpro2 is really wide (for me, at least). Here is the result of typing nabla f with mtpro2.



gradient of f



I wonder if there is a way we can adjust the symbol nabla
based on the next non-space letter, say:



  1. If the next non-space letter is f, then execute kern -0.2 em f,

  2. else, stay at usual.

I have been looking around, but could not find a satisfying solution. Any help
is highly appreciated.







spacing letterspacing mtpro gradient






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 at 23:03









weirdo

604




604











  • Can I ask a question please?
    – Sebastiano
    Sep 9 at 8:21
















  • Can I ask a question please?
    – Sebastiano
    Sep 9 at 8:21















Can I ask a question please?
– Sebastiano
Sep 9 at 8:21




Can I ask a question please?
– Sebastiano
Sep 9 at 8:21










1 Answer
1






active

oldest

votes

















up vote
8
down vote



accepted










Here's a LuaLaTeX-based solution. It sets up a Lua function called nabla_f that does most of the work, and it assigns this function to the process_input_buffer callback, making it operate on all inputs before TeX starts is usual processing.



enter image description here



% !TEX TS-program = lualatex
documentclassarticle
usepackagetimes,mtpro2 % text and math fonts
usepackageluacode
beginluacode
function nabla_f ( s )
return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )
end
endluacode
directlualuatexbase.add_to_callback("process_input_buffer", nabla_f , "nablaf" )

begindocument
$nablaf$ $nabla f$ $nabla h$ $nabla k$
enddocument



Addendum: If you also want to change the amount of whitespace between partial and f, while keeping the instruction to change the distance between nabla and f, I suggest you replace



 return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )


with



 s = s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) 
s = s:gsub ( "\partial%s*f", "\partial\mkern-4mu f" )
return s


Of course, you can (and should) change the new instance of -4mu to whatever the optimal adjustment amount may be.






share|improve this answer


















  • 1




    so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
    – weirdo
    Sep 8 at 23:51






  • 1




    @weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
    – Mico
    Sep 9 at 4:52






  • 1




    works like a charm for me :)
    – weirdo
    Sep 9 at 16:25










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f450042%2fgradient-symbols-and-letter-f-mtpro2%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
8
down vote



accepted










Here's a LuaLaTeX-based solution. It sets up a Lua function called nabla_f that does most of the work, and it assigns this function to the process_input_buffer callback, making it operate on all inputs before TeX starts is usual processing.



enter image description here



% !TEX TS-program = lualatex
documentclassarticle
usepackagetimes,mtpro2 % text and math fonts
usepackageluacode
beginluacode
function nabla_f ( s )
return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )
end
endluacode
directlualuatexbase.add_to_callback("process_input_buffer", nabla_f , "nablaf" )

begindocument
$nablaf$ $nabla f$ $nabla h$ $nabla k$
enddocument



Addendum: If you also want to change the amount of whitespace between partial and f, while keeping the instruction to change the distance between nabla and f, I suggest you replace



 return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )


with



 s = s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) 
s = s:gsub ( "\partial%s*f", "\partial\mkern-4mu f" )
return s


Of course, you can (and should) change the new instance of -4mu to whatever the optimal adjustment amount may be.






share|improve this answer


















  • 1




    so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
    – weirdo
    Sep 8 at 23:51






  • 1




    @weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
    – Mico
    Sep 9 at 4:52






  • 1




    works like a charm for me :)
    – weirdo
    Sep 9 at 16:25














up vote
8
down vote



accepted










Here's a LuaLaTeX-based solution. It sets up a Lua function called nabla_f that does most of the work, and it assigns this function to the process_input_buffer callback, making it operate on all inputs before TeX starts is usual processing.



enter image description here



% !TEX TS-program = lualatex
documentclassarticle
usepackagetimes,mtpro2 % text and math fonts
usepackageluacode
beginluacode
function nabla_f ( s )
return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )
end
endluacode
directlualuatexbase.add_to_callback("process_input_buffer", nabla_f , "nablaf" )

begindocument
$nablaf$ $nabla f$ $nabla h$ $nabla k$
enddocument



Addendum: If you also want to change the amount of whitespace between partial and f, while keeping the instruction to change the distance between nabla and f, I suggest you replace



 return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )


with



 s = s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) 
s = s:gsub ( "\partial%s*f", "\partial\mkern-4mu f" )
return s


Of course, you can (and should) change the new instance of -4mu to whatever the optimal adjustment amount may be.






share|improve this answer


















  • 1




    so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
    – weirdo
    Sep 8 at 23:51






  • 1




    @weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
    – Mico
    Sep 9 at 4:52






  • 1




    works like a charm for me :)
    – weirdo
    Sep 9 at 16:25












up vote
8
down vote



accepted







up vote
8
down vote



accepted






Here's a LuaLaTeX-based solution. It sets up a Lua function called nabla_f that does most of the work, and it assigns this function to the process_input_buffer callback, making it operate on all inputs before TeX starts is usual processing.



enter image description here



% !TEX TS-program = lualatex
documentclassarticle
usepackagetimes,mtpro2 % text and math fonts
usepackageluacode
beginluacode
function nabla_f ( s )
return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )
end
endluacode
directlualuatexbase.add_to_callback("process_input_buffer", nabla_f , "nablaf" )

begindocument
$nablaf$ $nabla f$ $nabla h$ $nabla k$
enddocument



Addendum: If you also want to change the amount of whitespace between partial and f, while keeping the instruction to change the distance between nabla and f, I suggest you replace



 return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )


with



 s = s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) 
s = s:gsub ( "\partial%s*f", "\partial\mkern-4mu f" )
return s


Of course, you can (and should) change the new instance of -4mu to whatever the optimal adjustment amount may be.






share|improve this answer














Here's a LuaLaTeX-based solution. It sets up a Lua function called nabla_f that does most of the work, and it assigns this function to the process_input_buffer callback, making it operate on all inputs before TeX starts is usual processing.



enter image description here



% !TEX TS-program = lualatex
documentclassarticle
usepackagetimes,mtpro2 % text and math fonts
usepackageluacode
beginluacode
function nabla_f ( s )
return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )
end
endluacode
directlualuatexbase.add_to_callback("process_input_buffer", nabla_f , "nablaf" )

begindocument
$nablaf$ $nabla f$ $nabla h$ $nabla k$
enddocument



Addendum: If you also want to change the amount of whitespace between partial and f, while keeping the instruction to change the distance between nabla and f, I suggest you replace



 return ( s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) )


with



 s = s:gsub ( "\nabla%s*f" , "\nabla\mkern-4mu f" ) 
s = s:gsub ( "\partial%s*f", "\partial\mkern-4mu f" )
return s


Of course, you can (and should) change the new instance of -4mu to whatever the optimal adjustment amount may be.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 9 at 4:56

























answered Sep 8 at 23:26









Mico

263k30355731




263k30355731







  • 1




    so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
    – weirdo
    Sep 8 at 23:51






  • 1




    @weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
    – Mico
    Sep 9 at 4:52






  • 1




    works like a charm for me :)
    – weirdo
    Sep 9 at 16:25












  • 1




    so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
    – weirdo
    Sep 8 at 23:51






  • 1




    @weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
    – Mico
    Sep 9 at 4:52






  • 1




    works like a charm for me :)
    – weirdo
    Sep 9 at 16:25







1




1




so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
– weirdo
Sep 8 at 23:51




so I guess this works for other things like partial f by replacing nabla with partial? I am excited about this :)
– weirdo
Sep 8 at 23:51




1




1




@weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
– Mico
Sep 9 at 4:52




@weirdo - Indeed, the code can be modified to allow further types of adjustments. I posted an addendum to show how this might be done for the case of partial and f.
– Mico
Sep 9 at 4:52




1




1




works like a charm for me :)
– weirdo
Sep 9 at 16:25




works like a charm for me :)
– weirdo
Sep 9 at 16:25

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450042%2fgradient-symbols-and-letter-f-mtpro2%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?