I am running MiKTeX 2.9 in windows 10 x64.

After making an fresh basic install with basic-miktex-2.9.6942-x64.exe (to keep the old) I run into a problem with a lualatex program. (correction of sidebearings sidebearings and precision left/right alignment)

  1. With the new 2019 basic installation I get an error message

warning (node filter): error: [\directlua]:11: attempt to perform arithmetic on field 'xadvance' (a nil value)

and crash.

  1. The program runs fine switching back to the previous 2018 environment.

  2. I found that if I only exchange the entire directory C:\Program Files\MiKTeX 2.9\miktex with the old one (2018), while keeping everything else, the program now works.

In the new installation the exe files are dated 02-Jan-19 In the old one the exe files are dated 26-Jun-18 and 24-Jun-18

Any help?

Main lualatex code

% !TeX TS-program = lualatex




  \kern-0.1pt %
  \smash{\color{#1}\vrule height 5\baselineskip depth 5pt width 0.1pt}%


\newcommand{\longtitles}{Long titles must be exactly aligned with the vertical green bar.}% the main title

  \dropsidebearings=1  %turn on the effect
%   \longtitles

 \raggedleft\sffamily\fontsize{50}{60}\selectfont\bfseries \longtitles\hairlineiv


luatex code (file: drop_sidebearing.lua)


  local function drop_sidebearing(head, groupcode)
    if tex.count['dropsidebearings'] == 0 then
      return true
    for n in node.traverse_id(node.id'hlist', head) do
      local char = node.has_glyph(n.head)
      if char then
        local f = font.getfont(char.font)
        if f.shared then
          local off = f.shared.rawdata.descriptions[char.char].boundingbox[1]*f.size/1000
           char.xadvance = char.xadvance - off
          char.xoffset = char.xoffset - off
      for ch in node.traverse_id(node.id'glyph', n.head) do
        char = ch
      if char then
        local f = font.getfont(char.font)
        if f.shared then
          local desc = f.shared.rawdata.descriptions[char.char]
         char.xadvance = char.xadvance - (desc.width-desc.boundingbox[3])*f.size/1000
      local new_list = node.hpack(n.head, n.width, 'exactly')
      new_list.head = nil
      n.glue_order = new_list.glue_order 
      n.glue_set = new_list.glue_set
      n.glue_sign = new_list.glue_sign 
    return true
  luatexbase.add_to_callback('post_linebreak_filter', drop_sidebearing, 'Drop sidebearings after linebreaking')
  • I can reproduce the issue on my MikTeX installation. You could make your question more self-contained and easier to navigate for other people if you included a copy of the relevant MWE in your question here. There are three blocks of code in the linked answer and it takes a while (if only a very short one) to find out which code to copy and run. – moewe Jan 10 at 19:53
  • Well it fails with luatex 1.09. I have no idea where @MarcelKrüger found the xadvance field, I don't see it in the documentation. – Ulrike Fischer Jan 10 at 19:57
  • @ moewe I did it now. But I think the issue is related with the latest MiKTeX implementation. I reproduced the behavior in OS win 7 32 bit. – Simon Dispa Jan 10 at 20:41
  • 2
    The field xadvance was removed in LuaTeX 1.08.0 and as far as I can see it was never documented. – Henri Menke Jan 10 at 20:57
  • In that case I think it is best to declare the issue ¨closed¨. I will post a (re)new question on how to drop the sidebearing. – Simon Dispa Jan 11 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.