Change bounding box of math glyphs in LuaTeX












9















I'm trying to use the Garamond-Math font in LuaTeX (despite the documentation saying I should use it with XeTeX only :-). It's working more or less OK with LuaTeX, except for some unfortunate glyph combinations, mostly at the end of inline math, such as “where $T$ is the period”.



I used fbox to draw the bounding box of the glyph and noticed that the bounding boxes are different in LuaTeX:




enter image description here




and in XeTeX:




enter image description here




In XeTeX the glyph fits almost entirely in the bounding box, but in LuaTeX it overshoots far too much.



I'm not a font guy, so I have no idea why this happens. I thought the bounding box was a property of the font, so in my imagination the result should be the same. Thus the first question is: what actually happens that the bounding boxes are different?



The second question, in the title, is: can I change the bounding box of specific glyphs (using LuaTeX) so that the output looks more like XeTeX's?



I tried manually adding some spacing after the glyphs, but this looks hideous and will go down the drain if I happen to change the font or engine, so I'd really like not to do that. I also tried using the italic correction / but it seems to have no effect in math.



Here's the code to produce the pictures above:



documentclass{standalone}
usepackage{unicode-math}
setmathfont{Garamond-Math.otf}
begin{document}
fboxrule=1sp
fboxsep=0pt
In LuaTeX{} this fbox{$T$} looks horrible, but the fbox{$X$} looks OK. Hugefbox{$T$}quad.
end{document}


I'm using TL 2018:



This is LuaTeX, Version 1.07.0 (TeX Live 2018)  (format=lualatex 2019.3.29)  13 APR 2019 12:43
restricted system commands enabled.
**test.tex
(./test.tex
LaTeX2e <2018-12-01>
Lua module: luaotfload-main 2019-02-14 2.96 luaotfload entry point









share|improve this question



























    9















    I'm trying to use the Garamond-Math font in LuaTeX (despite the documentation saying I should use it with XeTeX only :-). It's working more or less OK with LuaTeX, except for some unfortunate glyph combinations, mostly at the end of inline math, such as “where $T$ is the period”.



    I used fbox to draw the bounding box of the glyph and noticed that the bounding boxes are different in LuaTeX:




    enter image description here




    and in XeTeX:




    enter image description here




    In XeTeX the glyph fits almost entirely in the bounding box, but in LuaTeX it overshoots far too much.



    I'm not a font guy, so I have no idea why this happens. I thought the bounding box was a property of the font, so in my imagination the result should be the same. Thus the first question is: what actually happens that the bounding boxes are different?



    The second question, in the title, is: can I change the bounding box of specific glyphs (using LuaTeX) so that the output looks more like XeTeX's?



    I tried manually adding some spacing after the glyphs, but this looks hideous and will go down the drain if I happen to change the font or engine, so I'd really like not to do that. I also tried using the italic correction / but it seems to have no effect in math.



    Here's the code to produce the pictures above:



    documentclass{standalone}
    usepackage{unicode-math}
    setmathfont{Garamond-Math.otf}
    begin{document}
    fboxrule=1sp
    fboxsep=0pt
    In LuaTeX{} this fbox{$T$} looks horrible, but the fbox{$X$} looks OK. Hugefbox{$T$}quad.
    end{document}


    I'm using TL 2018:



    This is LuaTeX, Version 1.07.0 (TeX Live 2018)  (format=lualatex 2019.3.29)  13 APR 2019 12:43
    restricted system commands enabled.
    **test.tex
    (./test.tex
    LaTeX2e <2018-12-01>
    Lua module: luaotfload-main 2019-02-14 2.96 luaotfload entry point









    share|improve this question

























      9












      9








      9








      I'm trying to use the Garamond-Math font in LuaTeX (despite the documentation saying I should use it with XeTeX only :-). It's working more or less OK with LuaTeX, except for some unfortunate glyph combinations, mostly at the end of inline math, such as “where $T$ is the period”.



      I used fbox to draw the bounding box of the glyph and noticed that the bounding boxes are different in LuaTeX:




      enter image description here




      and in XeTeX:




      enter image description here




      In XeTeX the glyph fits almost entirely in the bounding box, but in LuaTeX it overshoots far too much.



      I'm not a font guy, so I have no idea why this happens. I thought the bounding box was a property of the font, so in my imagination the result should be the same. Thus the first question is: what actually happens that the bounding boxes are different?



      The second question, in the title, is: can I change the bounding box of specific glyphs (using LuaTeX) so that the output looks more like XeTeX's?



      I tried manually adding some spacing after the glyphs, but this looks hideous and will go down the drain if I happen to change the font or engine, so I'd really like not to do that. I also tried using the italic correction / but it seems to have no effect in math.



      Here's the code to produce the pictures above:



      documentclass{standalone}
      usepackage{unicode-math}
      setmathfont{Garamond-Math.otf}
      begin{document}
      fboxrule=1sp
      fboxsep=0pt
      In LuaTeX{} this fbox{$T$} looks horrible, but the fbox{$X$} looks OK. Hugefbox{$T$}quad.
      end{document}


      I'm using TL 2018:



      This is LuaTeX, Version 1.07.0 (TeX Live 2018)  (format=lualatex 2019.3.29)  13 APR 2019 12:43
      restricted system commands enabled.
      **test.tex
      (./test.tex
      LaTeX2e <2018-12-01>
      Lua module: luaotfload-main 2019-02-14 2.96 luaotfload entry point









      share|improve this question














      I'm trying to use the Garamond-Math font in LuaTeX (despite the documentation saying I should use it with XeTeX only :-). It's working more or less OK with LuaTeX, except for some unfortunate glyph combinations, mostly at the end of inline math, such as “where $T$ is the period”.



      I used fbox to draw the bounding box of the glyph and noticed that the bounding boxes are different in LuaTeX:




      enter image description here




      and in XeTeX:




      enter image description here




      In XeTeX the glyph fits almost entirely in the bounding box, but in LuaTeX it overshoots far too much.



      I'm not a font guy, so I have no idea why this happens. I thought the bounding box was a property of the font, so in my imagination the result should be the same. Thus the first question is: what actually happens that the bounding boxes are different?



      The second question, in the title, is: can I change the bounding box of specific glyphs (using LuaTeX) so that the output looks more like XeTeX's?



      I tried manually adding some spacing after the glyphs, but this looks hideous and will go down the drain if I happen to change the font or engine, so I'd really like not to do that. I also tried using the italic correction / but it seems to have no effect in math.



      Here's the code to produce the pictures above:



      documentclass{standalone}
      usepackage{unicode-math}
      setmathfont{Garamond-Math.otf}
      begin{document}
      fboxrule=1sp
      fboxsep=0pt
      In LuaTeX{} this fbox{$T$} looks horrible, but the fbox{$X$} looks OK. Hugefbox{$T$}quad.
      end{document}


      I'm using TL 2018:



      This is LuaTeX, Version 1.07.0 (TeX Live 2018)  (format=lualatex 2019.3.29)  13 APR 2019 12:43
      restricted system commands enabled.
      **test.tex
      (./test.tex
      LaTeX2e <2018-12-01>
      Lua module: luaotfload-main 2019-02-14 2.96 luaotfload entry point






      fonts xetex luatex bounding-box






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 13 at 15:49









      Phelype OleinikPhelype Oleinik

      25.7k54690




      25.7k54690






















          1 Answer
          1






          active

          oldest

          votes


















          8














          The problem is that you are at the end of the math and luatex doesn't insert the italic correction at the boundary between math and text. You can avoid the problem by inserting some invisible char but it is not quite clear which char is the best choice, in the chat we discussed this a few times and suggestions were Uchar"200B and 🦆:



          documentclass{standalone}
          usepackage{unicode-math}
          setmathfont{Garamond-Math.otf}
          begin{document}
          fboxrule=1sp
          fboxsep=0pt
          In LuaTeX{} this fbox{$T$} looks horrible,
          but fbox{$TUchar"200B$} and Hugefbox{$T🦆$} looks ok.


          end{document}


          enter image description here






          share|improve this answer





















          • 3





            I should have imagined that a duck would save the day :-)

            – Phelype Oleinik
            Apr 13 at 16:19












          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%2f484667%2fchange-bounding-box-of-math-glyphs-in-luatex%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          8














          The problem is that you are at the end of the math and luatex doesn't insert the italic correction at the boundary between math and text. You can avoid the problem by inserting some invisible char but it is not quite clear which char is the best choice, in the chat we discussed this a few times and suggestions were Uchar"200B and 🦆:



          documentclass{standalone}
          usepackage{unicode-math}
          setmathfont{Garamond-Math.otf}
          begin{document}
          fboxrule=1sp
          fboxsep=0pt
          In LuaTeX{} this fbox{$T$} looks horrible,
          but fbox{$TUchar"200B$} and Hugefbox{$T🦆$} looks ok.


          end{document}


          enter image description here






          share|improve this answer





















          • 3





            I should have imagined that a duck would save the day :-)

            – Phelype Oleinik
            Apr 13 at 16:19
















          8














          The problem is that you are at the end of the math and luatex doesn't insert the italic correction at the boundary between math and text. You can avoid the problem by inserting some invisible char but it is not quite clear which char is the best choice, in the chat we discussed this a few times and suggestions were Uchar"200B and 🦆:



          documentclass{standalone}
          usepackage{unicode-math}
          setmathfont{Garamond-Math.otf}
          begin{document}
          fboxrule=1sp
          fboxsep=0pt
          In LuaTeX{} this fbox{$T$} looks horrible,
          but fbox{$TUchar"200B$} and Hugefbox{$T🦆$} looks ok.


          end{document}


          enter image description here






          share|improve this answer





















          • 3





            I should have imagined that a duck would save the day :-)

            – Phelype Oleinik
            Apr 13 at 16:19














          8












          8








          8







          The problem is that you are at the end of the math and luatex doesn't insert the italic correction at the boundary between math and text. You can avoid the problem by inserting some invisible char but it is not quite clear which char is the best choice, in the chat we discussed this a few times and suggestions were Uchar"200B and 🦆:



          documentclass{standalone}
          usepackage{unicode-math}
          setmathfont{Garamond-Math.otf}
          begin{document}
          fboxrule=1sp
          fboxsep=0pt
          In LuaTeX{} this fbox{$T$} looks horrible,
          but fbox{$TUchar"200B$} and Hugefbox{$T🦆$} looks ok.


          end{document}


          enter image description here






          share|improve this answer















          The problem is that you are at the end of the math and luatex doesn't insert the italic correction at the boundary between math and text. You can avoid the problem by inserting some invisible char but it is not quite clear which char is the best choice, in the chat we discussed this a few times and suggestions were Uchar"200B and 🦆:



          documentclass{standalone}
          usepackage{unicode-math}
          setmathfont{Garamond-Math.otf}
          begin{document}
          fboxrule=1sp
          fboxsep=0pt
          In LuaTeX{} this fbox{$T$} looks horrible,
          but fbox{$TUchar"200B$} and Hugefbox{$T🦆$} looks ok.


          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 13 at 16:20

























          answered Apr 13 at 16:15









          Ulrike FischerUlrike Fischer

          200k9306693




          200k9306693








          • 3





            I should have imagined that a duck would save the day :-)

            – Phelype Oleinik
            Apr 13 at 16:19














          • 3





            I should have imagined that a duck would save the day :-)

            – Phelype Oleinik
            Apr 13 at 16:19








          3




          3





          I should have imagined that a duck would save the day :-)

          – Phelype Oleinik
          Apr 13 at 16:19





          I should have imagined that a duck would save the day :-)

          – Phelype Oleinik
          Apr 13 at 16:19


















          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%2f484667%2fchange-bounding-box-of-math-glyphs-in-luatex%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

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...