marking end of words in luatex - problem with math

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












10















I'm trying to mark the end of "words" (including punctuation) with luatex callbacks. (At the end I want to inject space chars at this positions, but the example uses rules for the visualization).



With some code based on countwords from the chickenize package it works quite fine. I only have a problem with math: I would like to avoid to get marks there. Trying to do it with an attribute set in everymath doesn't work as can be seen in the code below: It also affects other places like e.g. tabulars where math mode is used internally.



Has someone an idea how to exclude only "real" math from the mark function?



documentclassarticle
usepackageluacode,amsmath

newattributemathattr

beginluacode

local MATHATTR = luatexbase.registernumber ("mathattr")
local nodetraverseid = node.traverse_id
local nodegetattribute = node.get_attribute
local GLUE = node.id("glue")
local GLYPH = node.id("glyph")

local function insertmark (head,current)
local pdfstring = node.new("whatsit","pdf_literal")
pdfstring.data =
string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
head = node.insert_after(head,current,pdfstring)
return head
end

local markwords = function(head)
for glyph in nodetraverseid(GLYPH,head) do
if glyph.next and (glyph.next.id == GLUE)
and not nodegetattribute(glyph,MATHATTR)
then
insertmark(head,glyph)
end
end
return head
end


luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

endluacode
usepackagelipsum
begindocument


begintabularl
xxx xxx
endtabular

$a=b int f(x) =0quad textabc abc abc abc $

everymathsetattributemathattr1

begintabularl
xxx xxx
endtabular

$a=b int f(x) =0quad textabc abc abc abc $

bigskip

VA VA
lipsum[1]

enddocument


enter image description here










share|improve this question




























    10















    I'm trying to mark the end of "words" (including punctuation) with luatex callbacks. (At the end I want to inject space chars at this positions, but the example uses rules for the visualization).



    With some code based on countwords from the chickenize package it works quite fine. I only have a problem with math: I would like to avoid to get marks there. Trying to do it with an attribute set in everymath doesn't work as can be seen in the code below: It also affects other places like e.g. tabulars where math mode is used internally.



    Has someone an idea how to exclude only "real" math from the mark function?



    documentclassarticle
    usepackageluacode,amsmath

    newattributemathattr

    beginluacode

    local MATHATTR = luatexbase.registernumber ("mathattr")
    local nodetraverseid = node.traverse_id
    local nodegetattribute = node.get_attribute
    local GLUE = node.id("glue")
    local GLYPH = node.id("glyph")

    local function insertmark (head,current)
    local pdfstring = node.new("whatsit","pdf_literal")
    pdfstring.data =
    string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
    head = node.insert_after(head,current,pdfstring)
    return head
    end

    local markwords = function(head)
    for glyph in nodetraverseid(GLYPH,head) do
    if glyph.next and (glyph.next.id == GLUE)
    and not nodegetattribute(glyph,MATHATTR)
    then
    insertmark(head,glyph)
    end
    end
    return head
    end


    luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

    luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

    endluacode
    usepackagelipsum
    begindocument


    begintabularl
    xxx xxx
    endtabular

    $a=b int f(x) =0quad textabc abc abc abc $

    everymathsetattributemathattr1

    begintabularl
    xxx xxx
    endtabular

    $a=b int f(x) =0quad textabc abc abc abc $

    bigskip

    VA VA
    lipsum[1]

    enddocument


    enter image description here










    share|improve this question


























      10












      10








      10


      1






      I'm trying to mark the end of "words" (including punctuation) with luatex callbacks. (At the end I want to inject space chars at this positions, but the example uses rules for the visualization).



      With some code based on countwords from the chickenize package it works quite fine. I only have a problem with math: I would like to avoid to get marks there. Trying to do it with an attribute set in everymath doesn't work as can be seen in the code below: It also affects other places like e.g. tabulars where math mode is used internally.



      Has someone an idea how to exclude only "real" math from the mark function?



      documentclassarticle
      usepackageluacode,amsmath

      newattributemathattr

      beginluacode

      local MATHATTR = luatexbase.registernumber ("mathattr")
      local nodetraverseid = node.traverse_id
      local nodegetattribute = node.get_attribute
      local GLUE = node.id("glue")
      local GLYPH = node.id("glyph")

      local function insertmark (head,current)
      local pdfstring = node.new("whatsit","pdf_literal")
      pdfstring.data =
      string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
      head = node.insert_after(head,current,pdfstring)
      return head
      end

      local markwords = function(head)
      for glyph in nodetraverseid(GLYPH,head) do
      if glyph.next and (glyph.next.id == GLUE)
      and not nodegetattribute(glyph,MATHATTR)
      then
      insertmark(head,glyph)
      end
      end
      return head
      end


      luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

      luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

      endluacode
      usepackagelipsum
      begindocument


      begintabularl
      xxx xxx
      endtabular

      $a=b int f(x) =0quad textabc abc abc abc $

      everymathsetattributemathattr1

      begintabularl
      xxx xxx
      endtabular

      $a=b int f(x) =0quad textabc abc abc abc $

      bigskip

      VA VA
      lipsum[1]

      enddocument


      enter image description here










      share|improve this question
















      I'm trying to mark the end of "words" (including punctuation) with luatex callbacks. (At the end I want to inject space chars at this positions, but the example uses rules for the visualization).



      With some code based on countwords from the chickenize package it works quite fine. I only have a problem with math: I would like to avoid to get marks there. Trying to do it with an attribute set in everymath doesn't work as can be seen in the code below: It also affects other places like e.g. tabulars where math mode is used internally.



      Has someone an idea how to exclude only "real" math from the mark function?



      documentclassarticle
      usepackageluacode,amsmath

      newattributemathattr

      beginluacode

      local MATHATTR = luatexbase.registernumber ("mathattr")
      local nodetraverseid = node.traverse_id
      local nodegetattribute = node.get_attribute
      local GLUE = node.id("glue")
      local GLYPH = node.id("glyph")

      local function insertmark (head,current)
      local pdfstring = node.new("whatsit","pdf_literal")
      pdfstring.data =
      string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
      head = node.insert_after(head,current,pdfstring)
      return head
      end

      local markwords = function(head)
      for glyph in nodetraverseid(GLYPH,head) do
      if glyph.next and (glyph.next.id == GLUE)
      and not nodegetattribute(glyph,MATHATTR)
      then
      insertmark(head,glyph)
      end
      end
      return head
      end


      luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

      luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

      endluacode
      usepackagelipsum
      begindocument


      begintabularl
      xxx xxx
      endtabular

      $a=b int f(x) =0quad textabc abc abc abc $

      everymathsetattributemathattr1

      begintabularl
      xxx xxx
      endtabular

      $a=b int f(x) =0quad textabc abc abc abc $

      bigskip

      VA VA
      lipsum[1]

      enddocument


      enter image description here







      math-mode luatex callback






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 18:05







      Ulrike Fischer

















      asked Jan 1 at 17:08









      Ulrike FischerUlrike Fischer

      188k7293673




      188k7293673




















          1 Answer
          1






          active

          oldest

          votes


















          8














          The math content is enclosed by math nodes, with subtype 0 marking beginning, and subtype 1 marking closing of the math:



          documentclassarticle
          usepackageluacode,amsmath

          newattributemathattr

          beginluacode

          local MATHATTR = luatexbase.registernumber ("mathattr")
          local nodetraverseid = node.traverse_id
          local nodetraverse = node.traverse
          local nodegetattribute = node.get_attribute
          local GLUE = node.id("glue")
          local GLYPH = node.id("glyph")
          local MATH = node.id("math")
          local HLIST = node.id("hlist")
          local VLIST = node.id("vlist")


          local function insertmark (head,current)
          local pdfstring = node.new("whatsit","pdf_literal")
          pdfstring.data =
          string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
          head = node.insert_after(head,current,pdfstring)
          return head
          end

          local function markwords(head)
          local inside_math = false
          for n in nodetraverse(head) do
          local id = n.id
          if id == GLYPH then
          local glyph = n
          if glyph.next and (glyph.next.id == GLUE)
          and not (inside_math or nodegetattribute(glyph,MATHATTR))
          then
          insertmark(head,glyph)
          end
          elseif id == MATH then
          inside_math = (n.subtype == 0)
          end
          end
          return head
          end


          luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

          luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

          endluacode
          usepackagelipsum
          begindocument


          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $


          everymathsetattributemathattr1

          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $

          bigskip

          VA VA
          lipsum[1]

          enddocument


          Contrary to your screenshot, the code in your question doesn't put bar behind last word in textabc abc abc abc and at the end of a paragraph:



          enter image description here






          share|improve this answer

























          • elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

            – Herbert
            Jan 1 at 20:09











          • @Herbert thanks

            – michal.h21
            Jan 1 at 20:19











          • Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

            – Ulrike Fischer
            Jan 1 at 23:17











          • @UlrikeFischer ah, it is good to know that it is not an issue

            – michal.h21
            Jan 1 at 23:20











          • I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

            – Ulrike Fischer
            Jan 1 at 23:24











          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%2f468153%2fmarking-end-of-words-in-luatex-problem-with-math%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 math content is enclosed by math nodes, with subtype 0 marking beginning, and subtype 1 marking closing of the math:



          documentclassarticle
          usepackageluacode,amsmath

          newattributemathattr

          beginluacode

          local MATHATTR = luatexbase.registernumber ("mathattr")
          local nodetraverseid = node.traverse_id
          local nodetraverse = node.traverse
          local nodegetattribute = node.get_attribute
          local GLUE = node.id("glue")
          local GLYPH = node.id("glyph")
          local MATH = node.id("math")
          local HLIST = node.id("hlist")
          local VLIST = node.id("vlist")


          local function insertmark (head,current)
          local pdfstring = node.new("whatsit","pdf_literal")
          pdfstring.data =
          string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
          head = node.insert_after(head,current,pdfstring)
          return head
          end

          local function markwords(head)
          local inside_math = false
          for n in nodetraverse(head) do
          local id = n.id
          if id == GLYPH then
          local glyph = n
          if glyph.next and (glyph.next.id == GLUE)
          and not (inside_math or nodegetattribute(glyph,MATHATTR))
          then
          insertmark(head,glyph)
          end
          elseif id == MATH then
          inside_math = (n.subtype == 0)
          end
          end
          return head
          end


          luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

          luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

          endluacode
          usepackagelipsum
          begindocument


          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $


          everymathsetattributemathattr1

          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $

          bigskip

          VA VA
          lipsum[1]

          enddocument


          Contrary to your screenshot, the code in your question doesn't put bar behind last word in textabc abc abc abc and at the end of a paragraph:



          enter image description here






          share|improve this answer

























          • elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

            – Herbert
            Jan 1 at 20:09











          • @Herbert thanks

            – michal.h21
            Jan 1 at 20:19











          • Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

            – Ulrike Fischer
            Jan 1 at 23:17











          • @UlrikeFischer ah, it is good to know that it is not an issue

            – michal.h21
            Jan 1 at 23:20











          • I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

            – Ulrike Fischer
            Jan 1 at 23:24
















          8














          The math content is enclosed by math nodes, with subtype 0 marking beginning, and subtype 1 marking closing of the math:



          documentclassarticle
          usepackageluacode,amsmath

          newattributemathattr

          beginluacode

          local MATHATTR = luatexbase.registernumber ("mathattr")
          local nodetraverseid = node.traverse_id
          local nodetraverse = node.traverse
          local nodegetattribute = node.get_attribute
          local GLUE = node.id("glue")
          local GLYPH = node.id("glyph")
          local MATH = node.id("math")
          local HLIST = node.id("hlist")
          local VLIST = node.id("vlist")


          local function insertmark (head,current)
          local pdfstring = node.new("whatsit","pdf_literal")
          pdfstring.data =
          string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
          head = node.insert_after(head,current,pdfstring)
          return head
          end

          local function markwords(head)
          local inside_math = false
          for n in nodetraverse(head) do
          local id = n.id
          if id == GLYPH then
          local glyph = n
          if glyph.next and (glyph.next.id == GLUE)
          and not (inside_math or nodegetattribute(glyph,MATHATTR))
          then
          insertmark(head,glyph)
          end
          elseif id == MATH then
          inside_math = (n.subtype == 0)
          end
          end
          return head
          end


          luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

          luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

          endluacode
          usepackagelipsum
          begindocument


          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $


          everymathsetattributemathattr1

          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $

          bigskip

          VA VA
          lipsum[1]

          enddocument


          Contrary to your screenshot, the code in your question doesn't put bar behind last word in textabc abc abc abc and at the end of a paragraph:



          enter image description here






          share|improve this answer

























          • elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

            – Herbert
            Jan 1 at 20:09











          • @Herbert thanks

            – michal.h21
            Jan 1 at 20:19











          • Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

            – Ulrike Fischer
            Jan 1 at 23:17











          • @UlrikeFischer ah, it is good to know that it is not an issue

            – michal.h21
            Jan 1 at 23:20











          • I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

            – Ulrike Fischer
            Jan 1 at 23:24














          8












          8








          8







          The math content is enclosed by math nodes, with subtype 0 marking beginning, and subtype 1 marking closing of the math:



          documentclassarticle
          usepackageluacode,amsmath

          newattributemathattr

          beginluacode

          local MATHATTR = luatexbase.registernumber ("mathattr")
          local nodetraverseid = node.traverse_id
          local nodetraverse = node.traverse
          local nodegetattribute = node.get_attribute
          local GLUE = node.id("glue")
          local GLYPH = node.id("glyph")
          local MATH = node.id("math")
          local HLIST = node.id("hlist")
          local VLIST = node.id("vlist")


          local function insertmark (head,current)
          local pdfstring = node.new("whatsit","pdf_literal")
          pdfstring.data =
          string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
          head = node.insert_after(head,current,pdfstring)
          return head
          end

          local function markwords(head)
          local inside_math = false
          for n in nodetraverse(head) do
          local id = n.id
          if id == GLYPH then
          local glyph = n
          if glyph.next and (glyph.next.id == GLUE)
          and not (inside_math or nodegetattribute(glyph,MATHATTR))
          then
          insertmark(head,glyph)
          end
          elseif id == MATH then
          inside_math = (n.subtype == 0)
          end
          end
          return head
          end


          luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

          luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

          endluacode
          usepackagelipsum
          begindocument


          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $


          everymathsetattributemathattr1

          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $

          bigskip

          VA VA
          lipsum[1]

          enddocument


          Contrary to your screenshot, the code in your question doesn't put bar behind last word in textabc abc abc abc and at the end of a paragraph:



          enter image description here






          share|improve this answer















          The math content is enclosed by math nodes, with subtype 0 marking beginning, and subtype 1 marking closing of the math:



          documentclassarticle
          usepackageluacode,amsmath

          newattributemathattr

          beginluacode

          local MATHATTR = luatexbase.registernumber ("mathattr")
          local nodetraverseid = node.traverse_id
          local nodetraverse = node.traverse
          local nodegetattribute = node.get_attribute
          local GLUE = node.id("glue")
          local GLYPH = node.id("glyph")
          local MATH = node.id("math")
          local HLIST = node.id("hlist")
          local VLIST = node.id("vlist")


          local function insertmark (head,current)
          local pdfstring = node.new("whatsit","pdf_literal")
          pdfstring.data =
          string.format("q 1 0 0 RG 1 0 0 rg 0.4 w 0 %g m 0 %g l S Q",-3,10)
          head = node.insert_after(head,current,pdfstring)
          return head
          end

          local function markwords(head)
          local inside_math = false
          for n in nodetraverse(head) do
          local id = n.id
          if id == GLYPH then
          local glyph = n
          if glyph.next and (glyph.next.id == GLUE)
          and not (inside_math or nodegetattribute(glyph,MATHATTR))
          then
          insertmark(head,glyph)
          end
          elseif id == MATH then
          inside_math = (n.subtype == 0)
          end
          end
          return head
          end


          luatexbase.add_to_callback("pre_linebreak_filter",markwords,"markwords")

          luatexbase.add_to_callback("hpack_filter",markwords,"markwords")

          endluacode
          usepackagelipsum
          begindocument


          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $


          everymathsetattributemathattr1

          begintabularl
          xxx xxx
          endtabular

          $a=b int f(x) =0quad textabc abc abc abc $

          bigskip

          VA VA
          lipsum[1]

          enddocument


          Contrary to your screenshot, the code in your question doesn't put bar behind last word in textabc abc abc abc and at the end of a paragraph:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 1 at 20:18

























          answered Jan 1 at 19:57









          michal.h21michal.h21

          30.4k447104




          30.4k447104












          • elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

            – Herbert
            Jan 1 at 20:09











          • @Herbert thanks

            – michal.h21
            Jan 1 at 20:19











          • Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

            – Ulrike Fischer
            Jan 1 at 23:17











          • @UlrikeFischer ah, it is good to know that it is not an issue

            – michal.h21
            Jan 1 at 23:20











          • I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

            – Ulrike Fischer
            Jan 1 at 23:24


















          • elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

            – Herbert
            Jan 1 at 20:09











          • @Herbert thanks

            – michal.h21
            Jan 1 at 20:19











          • Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

            – Ulrike Fischer
            Jan 1 at 23:17











          • @UlrikeFischer ah, it is good to know that it is not an issue

            – michal.h21
            Jan 1 at 23:20











          • I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

            – Ulrike Fischer
            Jan 1 at 23:24

















          elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

          – Herbert
          Jan 1 at 20:09





          elseif id == MATH then inside_math =(n.subtype == 0) end is a bit shorter

          – Herbert
          Jan 1 at 20:09













          @Herbert thanks

          – michal.h21
          Jan 1 at 20:19





          @Herbert thanks

          – michal.h21
          Jan 1 at 20:19













          Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

          – Ulrike Fischer
          Jan 1 at 23:17





          Thanks, that seems to do exactly what I want. And I don't have a bar after the last abc in text too, but you can't see it, as my screenshot has been clipped and shows only the first tree words.

          – Ulrike Fischer
          Jan 1 at 23:17













          @UlrikeFischer ah, it is good to know that it is not an issue

          – michal.h21
          Jan 1 at 23:20





          @UlrikeFischer ah, it is good to know that it is not an issue

          – michal.h21
          Jan 1 at 23:20













          I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

          – Ulrike Fischer
          Jan 1 at 23:24






          I also removed the attribute from the test, it is not needed with your code, and I added a test for the glyph width, to avoid that 0-space gets marked: glyph.next and (glyph.next.id == GLUE) and not inside_math and (glyph.next.width >0).

          – Ulrike Fischer
          Jan 1 at 23:24


















          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%2f468153%2fmarking-end-of-words-in-luatex-problem-with-math%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

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay