OSDN Git Service

version 2.3.0-final.
[putex/putex.git] / src / texsourc / tex5.c
index 578d3c2..474a339 100644 (file)
-#ifdef _WINDOWS
-  #define NOCOMM
-  #define NOSOUND
-  #define NODRIVERS
-  #define STRICT
-  #pragma warning(disable:4115) // kill rpcasync.h complaint
-  #include <windows.h>
-  #define MYLIBAPI __declspec(dllexport)
-#endif
-
-#include "texwin.h"
-
-#pragma warning(disable:4131) // old style declarator
-#pragma warning(disable:4135) // conversion between different integral types 
-#pragma warning(disable:4127) // conditional expression is constant
-
-#include <setjmp.h>
-
-#define EXTERN extern
-
-#include "texd.h"
-
-#pragma warning(disable:4244)       /* 96/Jan/10 */
-
-/* rebox_ used to be in tex4.c */
-/* sec 0715 */
-halfword rebox_(halfword b, scaled w)
-{
-  halfword p;
-  internal_font_number f;
-  scaled v;
-
-  if ((width(b) != w) && (list_ptr(b) != 0))
-  {
-    if (type(b) == vlist_node)
-      b = hpack(b, 0, 1);
-
-    p = list_ptr(b);
-
-    if (((p >= hi_mem_min)) && (link(p) == 0))
-    {
-      f = font(p);
-      v = char_width(f, char_info(f, character(p)));
-
-      if (v != width(b))
-        link(p) = new_kern(width(b) - v);
-    }
-
-    free_node(b, box_node_size);
-    b = new_glue(ss_glue);
-    link(b) = p;
-
-    while (link(p) != 0)
-      p = link(p);
-
-    link(p) = new_glue(ss_glue);
-    return hpack(b, w, exactly);
-  }
-  else
-  {
-    width(b) = w;
-    return b;
-  }
-}
-/* This is to be the start of tex5.c */
-/* sec 0716 */
-halfword math_glue_(halfword g, scaled m)
-{
-  halfword p;
-  integer n;
-  scaled f;
-
-  n = x_over_n(m, 65536L);
-  f = tex_remainder;
-
-  if (f < 0)
-  {
-    decr(n);
-    f = f + 65536L;
-  }
-
-  p = get_node(glue_spec_size);
-  width(p) = mult_and_add(n, width(g), xn_over_d(width(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
-  stretch_order(p) = stretch_order(g);
-
-  if (stretch_order(p) == normal)
-    stretch(p) = mult_and_add(n, stretch(g), xn_over_d(stretch(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
-  else
-    stretch(p) = stretch(g);
-
-  shrink_order(p) = shrink_order(g);
-
-  if (shrink_order(p) == normal)
-    shrink(p) = mult_and_add(n, shrink(g), xn_over_d(shrink(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
-  else
-    shrink(p) = shrink(g);
-
-  return p;
-}
-/* sec 0717 */
-void math_kern_ (halfword p, scaled m)
-{
-  integer n;
-  scaled f;
-
-  if (subtype(p) == mu_glue)
-  {
-    n = x_over_n(m, 65536L);
-    f = tex_remainder;
-
-    if (f < 0)
-    {
-      decr(n);
-      f = f + 65536L;
-    }
-
-    width(p) = mult_and_add(n, width(p), xn_over_d(width(p), f, 65536L), 1073741823L);  /* 2^30 - 1 */
-    subtype(p) = explicit;
-  }
-}
-/* sec 0718 */
-void flush_math (void)
-{
-  flush_node_list(link(head));
-  flush_node_list(incompleat_noad);
-  link(head) = 0;
-  tail = head;
-  incompleat_noad = 0;
-}
-/* sec 0720 */
-halfword clean_box_(halfword p, small_number s)
-{
-  halfword q;
-  small_number save_style;
-  halfword x;
-  halfword r;
-
-  switch(math_type(p))
-  {
-    case math_char:
-      {
-        cur_mlist = new_noad();
-        mem[nucleus(cur_mlist)] = mem[p];
-      }
-      break;
-
-    case sub_box:
-      {
-        q = info(p);
-        goto lab40;
-      }
-      break;
-
-    case sub_mlist:
-      cur_mlist = info(p);
-      break;
-
-    default:
-      {
-        q = new_null_box();
-        goto lab40;
-      }
-    break;
-  }
-
-  save_style = cur_style;
-  cur_style = s;
-  mlist_penalties = false;
-  mlist_to_hlist();
-  q = link(temp_head);
-  cur_style = save_style;
-
-  {
-    if (cur_style < script_style)
-      cur_size = text_size;
-    else
-      cur_size = 16 * ((cur_style - text_style) / 2);
-
-    cur_mu = x_over_n(math_quad(cur_size), 18);
-  }
-lab40:
-  if ((q >= hi_mem_min) || (q == 0))
-    x = hpack(q, 0, 1);
-  else if ((link(q) == 0) && (type(q) <= vlist_node) && (shift_amount(q) == 0))
-    x = q;
-  else
-    x = hpack(q, 0, 1);
-
-  q = list_ptr(x);
-
-  if ((q >= hi_mem_min))
-  {
-    r = link(q);
-
-    if (r != 0)
-      if (link(r) == 0)
-        if (!(r >= hi_mem_min))
-          if (type(r) == kern_node)
-          {
-            free_node(r, small_node_size);
-            link(q) = 0;
-          }
-  }
-
-  return x;
-}
-/* sec 0722 */
-void fetch_(halfword a)
-{
-  cur_c = character(a);
-  cur_f = fam_fnt(fam(a) + cur_size);
-
-  if (cur_f == null_font)
-  {
-    print_err("");
-    print_size(cur_size);
-    print_char(' ');
-    print_int(fam(a));
-    print_string(" is undefined (character ");
-    print(cur_c);
-    print_char(')');
-    help4("Somewhere in the math formula just ended, you used the",
-        "stated character from an undefined font family. For example,",
-        "plain TeX doesn't allow \\it or \\sl in subscripts. Proceed,",
-        "and I'll try to forget that I needed that character.");
-    error();
-    cur_i = null_character;
-    math_type(a) = 0;
-  }
-  else
-  {
-    if ((cur_c >= font_bc[cur_f]) && (cur_c <= font_ec[cur_f]))
-      cur_i = char_info(cur_f, cur_c);
-    else
-      cur_i = null_character;
-
-    if (!((cur_i.b0 > 0)))
-    {
-      char_warning(cur_f, cur_c);
-      math_type(a) = 0;
-    }
-  }
-}
-/* sec 0734 */
-void make_over_(halfword q)
-{
-  info(nucleus(q)) = overbar(clean_box(nucleus(q), 2 * (cur_style / 2) + 1),
-      3 * default_rule_thickness, default_rule_thickness);
-  math_type(nucleus(q)) = sub_box;
-}
-/* sec 0735 */
-void make_under_(halfword q)
-{
-  halfword p, x, y;
-  scaled delta;
-
-  x = clean_box(nucleus(q), cur_style);
-  p = new_kern(3 * default_rule_thickness);
-  link(x) = p;
-  link(p) = fraction_rule(default_rule_thickness);
-  y = vpackage(x, 0, 1, 1073741823L); /* 2^30 - 1 */
-  delta = height(y) + depth(y) + default_rule_thickness;
-  height(y) = height(x);
-  depth(y) = delta - height(y);
-  info(nucleus(q)) = y;
-  math_type(nucleus(q)) = sub_box;
-}
-/* sec 0736 */
-void make_vcenter_(halfword q)
-{ 
-  halfword v;
-  scaled delta;
-
-  v = info(nucleus(q));
-
-  if (type(v) != vlist_node)
-  {
-    confusion("vcenter");
-    return;         // abort_flag set
-  }
-  delta = height(v) + depth(v);
-  height(v) = axis_height(cur_size) + half(delta);
-  depth(v) = delta - height(v);
-}
-/* sec 0737 */
-void make_radical_(halfword q)
-{
-  halfword x, y;
-  scaled delta, clr;
-
-  x = clean_box(nucleus(q), 2 * (cur_style / 2) + 1);
-
-  if (cur_style < text_style)
-    clr = default_rule_thickness + (abs(math_x_height(cur_size)) / 4);
-  else
-  {
-    clr = default_rule_thickness;
-    clr = clr + (abs(clr) / 4);
-  }
-
-  y = var_delimiter(left_delimiter(q), cur_size, height(x) + depth(x) + clr + default_rule_thickness);
-  delta = depth(y) -(height(x) + depth(x) + clr);
-
-  if (delta > 0)
-    clr = clr + half(delta);
-
-  shift_amount(y) = - (integer) (height(x) + clr);
-  link(y) = overbar(x, clr, height(y));
-  info(nucleus(q)) = hpack(y, 0, 1);
-  math_type(nucleus(q)) = sub_box;
-}
-/* sec 0738 */
-void make_math_accent_(halfword q)
-{
-  halfword p, x, y;
-  integer a;
-  quarterword c;
-  internal_font_number f;
-  ffourquarters i;
-  scaled s;
-  scaled h;
-  scaled delta;
-  scaled w;
-
-  fetch(accent_chr(q));
-
-  if ((cur_i.b0 > 0))
-  {
-    i = cur_i;
-    c = cur_c;
-    f = cur_f;
-    s = 0;
-
-    if (math_type(nucleus(q)) == math_char)
-    {
-      fetch(nucleus(q));
-
-      if (char_tag(cur_i) == lig_tag)
-      {
-        a = lig_kern_start(cur_f, cur_i);
-        cur_i = font_info[a].qqqq;
-
-        if (skip_byte(cur_i) > stop_flag)
-        {
-          a = lig_kern_restart(cur_f, cur_i);
-          cur_i = font_info[a].qqqq;
-        }
-
-        while (true)
-        {
-          if (next_char(cur_i) == skew_char[cur_f])
-          {
-            if (op_byte(cur_i) >= kern_flag)
-              if (skip_byte(cur_i) <= stop_flag)
-                s = char_kern(cur_f, cur_i);
-            goto lab31;
-          }
-
-          if (skip_byte(cur_i) >= stop_flag)
-            goto lab31;
-
-          a = a + skip_byte(cur_i) + 1;
-          cur_i = font_info[a].qqqq;
-        }
-      }
-    }
-lab31:;
-    x = clean_box(nucleus(q), cramped_style(cur_style));
-    w = width(x);
-    h = height(x);
-
-    while (true)
-    {
-      if (char_tag(i) != list_tag)
-        goto lab30;
-
-      y = rem_byte(i);
-      i = char_info(f, y);
-
-      if (!(i.b0 > 0))
-        goto lab30;
-
-      if (char_width(f, i) > w)
-        goto lab30;
-
-      c = y;
-    }
-lab30:;
-    if (h < x_height(f))
-      delta = h;
-    else
-      delta = x_height(f);
-
-    if ((math_type(supscr(q)) != 0) || (math_type(subscr(q)) != 0))
-      if (math_type(nucleus(q)) == math_char)
-      {
-        flush_node_list(x);
-        x = new_noad();
-        mem[nucleus(x)]= mem[nucleus(q)];
-        mem[supscr(x)]= mem[supscr(q)];
-        mem[subscr(x)]= mem[subscr(q)];
-        mem[supscr(q)].hh = empty_field;
-        mem[subscr(q)].hh = empty_field;
-        math_type(nucleus(q)) = sub_mlist;
-        info(nucleus(q)) = x;
-        x = clean_box(nucleus(q), cur_style);
-        delta = delta + height(x) - h;
-        h = height(x);
-      }
-
-    y = char_box(f, c);
-    shift_amount(y) = s + half(w - width(y));
-    width(y) = 0;
-    p = new_kern(- (integer) delta);
-    link(p) = x;
-    link(y) = p;
-    y = vpackage(y, 0, 1, 1073741823L);  /* 2^30 - 1 */
-    width(y) = width(x);
-
-    if (height(y) < h)
-    {
-      p = new_kern(h - height(y));
-      link(p) = list_ptr(y);
-      list_ptr(y) = p;
-      height(y) = h;
-    }
-
-    info(nucleus(q)) = y;
-    math_type(nucleus(q)) = sub_box;
-  }
-}
-/* sec 0743 */
-void make_fraction_(halfword q)
-{
-  halfword p, v, x, y, z;
-  scaled delta, delta1, delta2, shift_up, shift_down, clr;
-  
-  if (thickness(q) == default_code) /* 2^30 */
-    thickness(q) = default_rule_thickness;
-
-  x = clean_box(numerator(q), num_style(cur_style));
-  z = clean_box(denominator(q), denom_style(cur_style));
-
-  if (width(x) < width(z))
-    x = rebox(x, width(z));
-  else
-    z = rebox(z, width(x));
-
-  if (cur_style < text_style)
-  {
-    shift_up = num1(cur_size);
-    shift_down = denom1(cur_size);
-  }
-  else
-  {
-    shift_down = denom2(cur_size);
-
-    if (thickness(q) != 0)
-      shift_up = num2(cur_size);
-    else
-      shift_up = num3(cur_size);
-  }
-
-  if (thickness(q) == 0)
-  {
-    if (cur_style < text_style)
-      clr = 7 * default_rule_thickness;
-    else
-      clr = 3 * default_rule_thickness;
-
-    delta = half(clr - ((shift_up - depth(x)) - (height(z) - shift_down)));
-
-    if (delta > 0)
-    {
-      shift_up = shift_up + delta;
-      shift_down = shift_down + delta;
-    }
-  }
-  else
-  {
-    if (cur_style < text_style)
-      clr = 3 * thickness(q);
-    else
-      clr = thickness(q);
-
-    delta = half(thickness(q));
-    delta1 = clr - ((shift_up - depth(x)) - (axis_height(cur_size) + delta));
-    delta2 = clr -((axis_height(cur_size) - delta) - (height(z) - shift_down));
-
-    if (delta1 > 0)
-      shift_up = shift_up + delta1;
-
-    if (delta2 > 0)
-      shift_down = shift_down + delta2;
-  }
-
-  v = new_null_box();
-  type(v) = vlist_node;
-  height(v) = shift_up + height(x);
-  depth(v) = depth(z) + shift_down;
-  width(v) = width(x);
-
-  if (thickness(q) == 0)
-  {
-    p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
-    link(p) = z;
-  }
-  else
-  {
-    y = fraction_rule(thickness(q));
-    p = new_kern((axis_height(cur_size) - delta) - (height(z) - shift_down));
-    link(y) = p;
-    link(p) = z;
-    p = new_kern((shift_up - depth(x)) - (axis_height(cur_size) + delta));
-    link(p) = y;
-  }
-
-  link(x) = p;
-  list_ptr(v) = x;
-
-  if (cur_style < text_style)
-    delta = delim1(cur_size);
-  else
-    delta = delim2(cur_size);
-
-  x = var_delimiter(left_delimiter(q), cur_size, delta);
-  link(x) = v;
-  z = var_delimiter(right_delimiter(q), cur_size, delta);
-  link(v) = z;
-  new_hlist(q) = hpack(x, 0, 1);
-}
-/***************************************************************************/
-/* moved to end to avoid questions about pragma optimize 96/Sep/12 */
-scaled make_op_ (halfword);
-/***************************************************************************/
-/* sec 0752 */
-void make_ord_(halfword q)
-{
-  integer a;
-  halfword p, r;
-
-lab20:
-  if (math_type(subscr(q)) == 0)
-    if (math_type(supscr(q)) == 0)
-      if (math_type(nucleus(q)) == math_char)
-      {
-        p = link(q);
-
-        if (p != 0)
-          if ((type(p) >= ord_noad) && (type(p) <= punct_noad))
-            if (math_type(nucleus(p)) == math_char)
-              if (fam(nucleus(p)) == fam(nucleus(q)))
-              {
-                math_type(nucleus(q)) = math_text_char;
-                fetch(nucleus(q));
-
-                if (char_tag(cur_i) == lig_tag)
-                {
-                  a = lig_kern_start(cur_f, cur_i);
-                  cur_c = character(nucleus(p));
-                  cur_i = font_info[a].qqqq;
-
-                  if (skip_byte(cur_i) > stop_flag)
-                  {
-                    a = lig_kern_restart(cur_f, cur_i);
-                    cur_i = font_info[a].qqqq;
-                  }
-
-                  while (true)
-                  {
-                    if (next_char(cur_i) == cur_c)
-                      if (skip_byte(cur_i) <= stop_flag)
-                        if (op_byte(cur_i) >= kern_flag)
-                        {
-                          p = new_kern(char_kern(cur_f, cur_i));
-                          link(p) = link(q);
-                          link(q) = p;
-                          return;
-                        }
-                        else
-                        {
-                          {
-                            if (interrupt != 0)
-                            {
-                              pause_for_instructions();
-                            }
-                          }
-
-                          switch (op_byte(cur_i))
-                          {
-                            case 1:
-                            case 5:
-                              character(nucleus(q)) = rem_byte(cur_i);
-                              break;
-                            case 2:
-                            case 6:
-                              character(nucleus(p)) = rem_byte(cur_i);
-                              break;
-                            case 3:
-                            case 7:
-                            case 11:
-                              {
-                                r = new_noad();
-                                character(nucleus(r)) = rem_byte(cur_i);
-                                fam(nucleus(r)) = fam(nucleus(q));
-                                link(q) = r;
-                                link(r) = p;
-
-                                if (op_byte(cur_i) < 11)
-                                  math_type(nucleus(r)) = math_char;
-                                else
-                                  math_type(nucleus(r)) = math_text_char;
-                              }
-                              break;
-
-                            default:
-                              {
-                                link(q) = link(p);
-                                character(nucleus(q)) = rem_byte(cur_i);
-                                mem[subscr(q)] = mem[subscr(p)];
-                                mem[supscr(q)] = mem[supscr(p)];
-                                free_node(p, noad_size);
-                              }
-                              break;
-                          }
-
-                          if (op_byte(cur_i) > 3)
-                            return;
-
-                          math_type(nucleus(q)) = math_char;
-                          goto lab20;
-                        }
-
-                    if (skip_byte(cur_i) >= stop_flag)
-                      return;
-
-                    a = a + skip_byte(cur_i) + 1;
-                    cur_i = font_info[a].qqqq;
-                  }
-                }
-              }
-      }
-}
-/***************************************************************************/
-/* moved to end to avoid questions about pragma optimize 96/Sep/12 */
-void make_scripts_ (halfword, scaled);
-/***************************************************************************/
-/* sec 0762 */
-small_number make_left_right_(halfword q, small_number style, scaled max_d, scaled max_h)
-{
-  scaled delta, delta1, delta2;
-
-  if (style < script_style)
-    cur_size = text_size;
-  else
-    cur_size = 16 * ((style - text_style) / 2);
-
-  delta2 = max_d + axis_height(cur_size);
-  delta1 = max_h + max_d - delta2;
-
-  if (delta2 > delta1)
-    delta1 = delta2;
-
-  delta = (delta1 / 500) * delimiter_factor;
-  delta2 = delta1 + delta1 - delimiter_shortfall;
-
-  if (delta < delta2)
-    delta = delta2;
-
-  new_hlist(q) = var_delimiter(delimiter(q), cur_size, delta);
-  return type(q) - (left_noad - open_noad);
-}
-/* sec 0726 */
-void mlist_to_hlist (void)
-{
-  halfword mlist;
-  bool penalties;
-  small_number style;
-  small_number save_style;
-  halfword q;
-  halfword r;
-/*  small_number r_type;  */
-  int r_type;            /* 95/Jan/7 */
-/*  small_number t; */
-  int t;              /* 95/Jan/7 */
-  halfword p, x, y, z;
-  integer pen;
-  small_number s;
-  scaled max_h, max_d;
-  scaled delta;
-
-  mlist = cur_mlist;
-  penalties = mlist_penalties;
-  style = cur_style;
-  q = mlist;
-  r = 0;
-  r_type = op_noad;
-  max_h = 0;
-  max_d = 0;
-
-  {
-    if (cur_style < script_style)
-      cur_size = text_size;
-    else
-      cur_size = 16 * ((cur_style - text_style) / 2);
-
-    cur_mu = x_over_n(math_quad(cur_size), 18);
-  }
-
-  while (q != 0)
-  {
-lab21:
-    delta = 0;
-
-    switch (type(q))
-    {
-      case bin_noad:
-        switch (r_type)
-        {
-          case bin_noad:
-          case op_noad:
-          case rel_noad:
-          case open_noad:
-          case punct_noad:
-          case left_noad:
-            {
-              type(q) = ord_noad;
-              goto lab21;
-            }
-            break;
-
-          default:
-            ;
-            break;
-        }
-        break;
-
-      case rel_noad:
-      case close_noad:
-      case punct_noad:
-      case right_noad:
-        {
-          if (r_type == bin_noad)
-            type(r) = ord_noad;
-
-          if (type(q) == right_noad)
-            goto lab80;
-        }
-        break;
-
-      case left_noad:
-        goto lab80;
-        break;
-
-      case fraction_noad:
-        {
-          make_fraction(q);
-          goto lab82;
-        }
-        break;
-
-      case op_noad:
-        {
-          delta = make_op(q);
-
-          if (subtype(q) == limits)
-            goto lab82;
-        }
-        break;
-
-      case ord_noad:
-        make_ord(q);
-        break;
-
-      case open_noad:
-      case inner_noad:
-        ;
-        break;
-
-      case radical_noad:
-        make_radical(q);
-        break;
-
-      case over_noad:
-        make_over(q);
-        break;
-
-      case under_noad:
-        make_under(q);
-        break;
-
-      case accent_noad:
-        make_math_accent(q);
-        break;
-
-      case vcenter_noad:
-        make_vcenter(q);
-        break;
-
-      case style_node:
-        {
-          cur_style = subtype(q);
-
-          {
-            if (cur_style < script_style)
-              cur_size = text_size;
-            else
-              cur_size = 16 * ((cur_style - text_style) / 2);
-
-            cur_mu = x_over_n(math_quad(cur_size), 18);
-          }
-
-          goto lab81;
-        }
-        break;
-
-      case choice_node:
-        {
-          switch (cur_style / 2)
-          {
-            case 0:
-              {
-                p = display_mlist(q);
-                display_mlist(q) = 0;
-              }
-              break;
-
-            case 1:
-              {
-                p = text_mlist(q);
-                text_mlist(q) = 0;
-              }
-              break;
-
-            case 2:
-              {
-                p = script_mlist(q);
-                script_mlist(q) = 0;
-              }
-              break;
-
-            case 3:
-              {
-                p = script_script_mlist(q);
-                script_script_mlist(q) = 0;
-              }
-              break;
-          }
-
-          flush_node_list(display_mlist(q));
-          flush_node_list(text_mlist(q));
-          flush_node_list(script_mlist(q));
-          flush_node_list(script_script_mlist(q));
-          type(q) = style_node;
-          subtype(q) = cur_style;
-          width(q) = 0;
-          depth(q) = 0;
-
-          if (p != 0)
-          {
-            z = link(q);
-            link(q) = p;
-
-            while (link(p) != 0)
-              p = link(p);
-
-            link(p) = z;
-          }
-          goto lab81;
-        }
-        break;
-
-      case ins_node:
-      case mark_node:
-      case adjust_node:
-      case whatsit_node:
-      case penalty_node:
-      case disc_node:
-        goto lab81;
-        break;
-
-      case rule_node:
-        {
-          if (height(q) > max_h)
-            max_h = height(q);
-
-          if (depth(q) > max_d)
-            max_d = depth(q);
-
-          goto lab81;
-        }
-        break;
-
-      case glue_node:
-        {
-          if (subtype(q) == mu_glue)
-          {
-            x = glue_ptr(q);
-            y = math_glue(x, cur_mu);
-            delete_glue_ref(x);
-            glue_ptr(q) = y;
-            subtype(q) = normal;
-          }
-          else if ((cur_size != text_size) && (subtype(q) == cond_math_glue))
-          {
-            p = link(q);
-
-            if (p != 0)
-              if ((type(q) == glue_node) || (type(p) == kern_node))
-              {
-                link(q) = link(p);
-                link(p) = 0;
-                flush_node_list(p);
-              }
-          }
-          goto lab81;
-        }
-        break;
-
-      case kern_node:
-        {
-          math_kern(q, cur_mu);
-          goto lab81;
-        }
-        break;
-
-      default:
-        {
-          confusion("mlist1");
-          return;       // abort_flag set
-        }
-        break;
-    }
-
-    switch (math_type(nucleus(q)))
-    {
-      case math_char:
-      case math_text_char:
-        {
-          fetch(nucleus(q));
-
-          if ((cur_i.b0 > 0))
-          {
-            delta = char_italic(cur_f, cur_i);
-            p = new_character(cur_f, cur_c);
-
-            if ((math_type(nucleus(q)) == math_text_char) && (space(cur_f) != 0))
-              delta = 0;
-
-            if ((math_type(subscr(q)) == 0) && (delta != 0))
-            {
-              link(p) = new_kern(delta);
-              delta = 0;
-            }
-          }
-          else
-            p = 0;
-        }
-        break;
-
-      case 0:
-        p = 0;
-        break;
-
-      case sub_box:
-        p = info(nucleus(q));
-        break;
-
-      case sub_mlist:
-        {
-          cur_mlist = info(nucleus(q));
-          save_style = cur_style;
-          mlist_penalties = false;
-          mlist_to_hlist();
-          cur_style = save_style;
-
-          {
-            if (cur_style < script_style)
-              cur_size = text_size;
-            else
-              cur_size = 16 * ((cur_style - text_style) / 2);
-
-            cur_mu = x_over_n(math_quad(cur_size), 18);
-          }
-
-          p = hpack(link(temp_head), 0, 1);
-        }
-        break;
-
-      default:
-        {
-          confusion("mlist2");
-          return;       // abort_flag set
-        }
-        break;
-    }
-  
-    new_hlist(q) = p;
-
-    if ((math_type(subscr(q)) == 0) && (math_type(supscr(q)) == 0))
-      goto lab82;
-
-    make_scripts(q, delta);
-lab82:
-    z = hpack(new_hlist(q), 0, 1);
-
-    if (height(z) > max_h)
-      max_h = height(z);
-
-    if (depth(z) > max_d)
-      max_d = depth(z);
-
-    free_node(z, box_node_size);
-lab80:
-    r = q;
-    r_type = type(r);
-lab81:
-    q = link(q);
-  }
-
-  if (r_type == bin_noad)
-    type(r) = ord_noad;
-
-  p = temp_head;
-  link(p) = 0;
-  q = mlist;
-  r_type = 0;
-  cur_style = style;
-
-  {
-    if (cur_style < script_style)
-      cur_size = text_size;
-    else
-      cur_size = 16 *((cur_style - text_style) / 2);
-
-    cur_mu = x_over_n(math_quad(cur_size), 18);
-  }
-
-  while (q != 0)
-  {
-    t = ord_noad;
-    s = noad_size;
-    pen = inf_penalty;
-
-    switch (type(q))
-    {
-      case op_noad:
-      case open_noad:
-      case close_noad:
-      case punct_noad:
-      case inner_noad:
-        t = type(q);
-        break;
-
-      case bin_noad:
-        {
-          t = bin_noad;
-          pen = bin_op_penalty;
-        }
-        break;
-
-      case rel_noad:
-        {
-          t = rel_noad;
-          pen = rel_penalty;
-        }
-        break;
-
-      case ord_noad:
-      case vcenter_noad:
-      case over_noad:
-      case under_noad:
-        ;
-        break;
-
-      case radical_noad:
-        s = radical_noad_size;
-        break;
-
-      case accent_noad:
-        s = accent_noad_size;
-        break;
-
-      case fraction_noad:
-        {
-          t = inner_noad;
-          s = fraction_noad_size;
-        }
-        break;
-
-      case left_noad:
-      case right_noad:
-        t = make_left_right(q, style, max_d, max_h);
-        break;
-
-      case style_node:
-        {
-          cur_style = subtype(q);
-          s = style_node_size;
-
-          {
-            if (cur_style < script_style)
-              cur_size = text_size;
-            else
-              cur_size = 16 *((cur_style - text_style) / 2);
-
-            cur_mu = x_over_n(math_quad(cur_size), 18);
-          }
-
-          goto lab83;
-        }
-        break;
-
-      case whatsit_node:
-      case penalty_node:
-      case rule_node:
-      case disc_node:
-      case adjust_node:
-      case ins_node:
-      case mark_node:
-      case glue_node:
-      case kern_node:
-        {
-          link(p) = q;
-          p = q;
-          q = link(q);
-          link(p) = 0;
-          goto lab30;
-        }
-        break;
-
-      default:
-        {
-          confusion("mlist3");
-          return;       // abort_flag set
-        }
-        break;
-    }
-
-    if (r_type > 0)
-    {
-      switch (str_pool[r_type * 8 + t + magic_offset])
-      {
-        case '0':
-          x = 0;
-          break;
-
-        case '1':
-          if (cur_style < script_style)
-            x = thin_mu_skip_code;
-          else
-            x = 0;
-          break;
-
-        case '2':
-          x = thin_mu_skip_code;
-          break;
-
-        case '3':
-          if (cur_style < script_style)
-            x = med_mu_skip_code;
-          else
-            x = 0;
-          break;
-
-        case '4':
-          if (cur_style < script_style)
-            x = thick_mu_skip_code;
-          else
-            x = 0;
-          break;
-
-        default:
-          {
-            confusion("mlist4");
-            return;       // abort_flag set
-          }
-          break;
-      }
-
-      if (x != 0)
-      {
-        y = math_glue(glue_par(x), cur_mu);
-        z = new_glue(y);
-        glue_ref_count(y) = 0;
-        link(p) = z;
-        p = z;
-        subtype(z) = x + 1;
-      }
-    }
-
-    if (new_hlist(q) != 0)
-    {
-      link(p) = new_hlist(q);
-
-      do
-        {
-          p = link(p);
-        }
-      while (!(link(p) == 0));
-    }
-
-    if (penalties)
-      if (link(q) != 0)
-        if (pen < inf_penalty)
-        {
-          r_type = type(link(q));
-
-          if (r_type != penalty_node)
-            if (r_type != rel_noad)
-            {
-              z = new_penalty(pen);
-              link(p) = z;
-              p = z;
-            }
-        }
-
-    r_type = t;
-lab83:
-    r = q;
-    q = link(q);
-    free_node(r, s);
-lab30:;
-  }
-}
-/* sec 0772 */
-void push_alignment (void)
-{
-  halfword p;
-
-  p = get_node(align_stack_node_size);
-  link(p) = align_ptr;
-  info(p) = cur_align;
-  llink(p) = preamble;
-  rlink(p) = cur_span;
-  mem[p + 2].cint = cur_loop;
-  mem[p + 3].cint = align_state;
-  info(p + 4) = cur_head;
-  link(p + 4) = cur_tail;
-  align_ptr = p;
-  cur_head = get_avail();
-}
-/* sec 0772 */
-void pop_alignment (void)
-{
-  halfword p;
-
-  free_avail(cur_head);
-  p = align_ptr;
-  cur_tail = link(p + 4);
-  cur_head = info(p + 4);
-  align_state = mem[p + 3].cint;
-  cur_loop = mem[p + 2].cint;
-  cur_span = rlink(p);
-  preamble = llink(p);
-  cur_align = info(p);
-  align_ptr = link(p);
-  free_node(p, align_stack_node_size);
-}
-/* sec 0782 */
-void get_preamble_token (void)
-{
-lab20:
-  get_token();
-
-  while ((cur_chr == span_code) && (cur_cmd == tab_mark))
-  {
-    get_token();
-
-    if (cur_cmd > max_command)
-    {
-      expand();
-      get_token();
-    }
-  }
-
-  if (cur_cmd == endv)
-  {
-    fatal_error("(interwoven alignment preambles are not allowed)");
-    return;     // abort_flag set
-  }
-
-  if ((cur_cmd == assign_glue) && (cur_chr == glue_base + tab_skip_code))
-  {
-    scan_optional_equals();
-    scan_glue(glue_val);
-
-    if (global_defs > 0)
-      geq_define(glue_base + tab_skip_code, glue_ref, cur_val);
-    else
-      eq_define(glue_base + tab_skip_code, glue_ref, cur_val);
-
-    goto lab20;
-  }
-}
-/* sec 0774 */
-void init_align (void)
-{
-  halfword save_cs_ptr;
-  halfword p;
-
-  save_cs_ptr = cur_cs;
-  push_alignment();
-  align_state = -1000000L;
-
-  if ((mode == mmode) && ((tail != cur_list.head_field) || (incompleat_noad != 0)))
-  {
-    print_err("Improper ");
-    print_esc("halign");
-    print_string(" inside $$'s");
-    help3("Displays can use special alignments (like \\eqalignno)",
-        "only if nothing but the alignment itself is between $$'s.",
-        "So I've deleted the formulas that preceded this alignment.");
-    error();
-    flush_math();
-  }
-
-  push_nest();
-
-  if (mode == mmode)
-  {
-    mode = -vmode;
-    prev_depth = nest[nest_ptr - 2].aux_field.cint;
-  }
-  else if (mode > 0)
-    mode = - (integer) mode;
-
-  scan_spec(align_group, false);
-  preamble = 0;
-  cur_align = align_head;
-  cur_loop = 0;
-  scanner_status = aligning;
-  warning_index = save_cs_ptr;
-  align_state = -1000000L;
-
-  while (true)
-  {
-    link(cur_align) = new_param_glue(tab_skip_code);
-    cur_align = link(cur_align);
-
-    if (cur_cmd == car_ret)
-      goto lab30;
-
-    p = hold_head;
-    link(p) = 0;
-
-    while (true)
-    {
-      get_preamble_token();
-
-      if (cur_cmd == mac_param)
-        goto lab31;
-
-      if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))
-        if ((p == hold_head) && (cur_loop == 0) && (cur_cmd == tab_mark))
-          cur_loop = cur_align;
-        else
-        {
-          print_err("Missing # inserted in alignment preamble");
-          help3("There should be exactly one # between &'s, when an",
-              "\\halign or \\valign is being set up. In this case you had",
-              "none, so I've put one in; maybe that will work.");
-          back_error();
-          goto lab31;
-        }
-      else if ((cur_cmd != spacer) || (p != hold_head))
-      {
-        link(p) = get_avail();
-        p = link(p);
-        info(p) = cur_tok;
-      }
-    }
-
-lab31:
-    link(cur_align) = new_null_box();
-    cur_align = link(cur_align);
-    info(cur_align) = end_span;
-    width(cur_align) = null_flag;  /* - 2^30 */
-    u_part(cur_align) = link(hold_head);
-    p = hold_head;
-    link(p) = 0;
-
-    while (true)
-    {
-lab22:
-      get_preamble_token();
-
-      if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))
-        goto lab32;
-
-      if (cur_cmd == mac_param)
-      {
-        print_err("Only one # is allowed per tab");
-        help3("There should be exactly one # between &'s, when an",
-            "\\halign or \\valign is being set up. In this case you had",
-            "more than one, so I'm ignoring all but the first.");
-        error();
-        goto lab22;
-      }
-
-      link(p) = get_avail();
-      p = link(p);
-      info(p) = cur_tok;
-    }
-
-lab32:
-    link(p) = get_avail();
-    p = link(p);
-    info(p) = end_template_token;
-    v_part(cur_align) = link(hold_head);
-  }
-
-lab30:
-  scanner_status = 0;
-  new_save_level(align_group);
-
-  if (every_cr != 0)
-    begin_token_list(every_cr, every_cr_text);
-  align_peek();
-}
-/* sec 0787 */
-void init_span_ (halfword p)
-{
-  push_nest();
-
-  if (mode == -hmode)
-    space_factor = 1000;
-  else
-  {
-    cur_list.aux_field.cint = ignore_depth;
-    normal_paragraph();
-  }
-
-  cur_span = p;
-}
-/* sec 0786 */
-void init_row (void)
-{
-  push_nest();
-
-  mode = (-hmode - vmode) - mode;
-
-  if (mode == -hmode)
-    space_factor = 0;
-  else
-    cur_list.aux_field.cint = 0;
-
-  tail_append(new_glue(glue_ptr(preamble)));
-  subtype(tail) = tab_skip_code + 1;
-  cur_align = link(preamble);
-  cur_tail = cur_head;
-  init_span(cur_align);
-}
-/* sec 0788 */
-void init_col (void)
-{
-  extra_info(cur_align) = cur_cmd;
-
-  if (cur_cmd == omit)
-    align_state = 0;
-  else
-  {
-    back_input();
-    begin_token_list(u_part(cur_align), u_template);
-  }
-}
-/* fin_col() moved to end to hide in pragma (g, "off") */
-/* may need to move more ? everything calling new_null_box() ? */
-/* sec 0799 */
-void fin_row (void)
-{
-  halfword p;
-
-  if (mode == -hmode)
-  {
-    p = hpack(link(head), 0, 1);
-    pop_nest();
-    append_to_vlist(p);
-
-    if (cur_head != cur_tail)
-    {
-      link(tail) = link(cur_head);
-      tail = cur_tail;
-    }
-  }
-  else
-  {
-    p = vpackage(link(head), 0, 1, 1073741823L);   /* 2^30 - 1 */
-    pop_nest();
-    link(tail) = p;
-    tail = p;
-    space_factor = 1000;
-  }
-
-  type(p) = unset_node;
-  glue_stretch(p) = 0;
-
-  if (every_cr != 0)
-    begin_token_list(every_cr, every_cr_text);
-
-  align_peek();
-}
-/* sec 0800 */
-void fin_align (void)
-{
-  halfword p, q, r, s, u, v;
-  scaled t, w;
-  scaled o;
-  halfword n;
-  scaled rule_save;
-  memory_word aux_save;
-
-  if (cur_group != align_group)
-  {
-    confusion("align1");
-    return;       // abort_flag set
-  }
-
-  unsave();
-
-  if (cur_group != align_group)
-  {
-    confusion("align0");
-    return;       // abort_flag set
-  }
-
-  unsave();
-
-  if (nest[nest_ptr - 1].mode_field == mmode)
-    o = display_indent;
-  else
-    o = 0;
-
-  q = link(preamble);
-
-  do
-    {
-      flush_list(u_part(q));
-      flush_list(v_part(q));
-      p = link(link(q));
-
-      if (width(q) == null_flag) /* - 2^30 */
-      {
-        width(q) = 0;
-        r = link(q);
-        s = glue_ptr(r);
-
-        if (s != zero_glue)
-        {
-          add_glue_ref(zero_glue);
-          delete_glue_ref(s);
-          glue_ptr(c) = zero_glue;
-        }
-      }
-
-      if (info(q) != end_span)
-      {
-        t = width(q) + width(glue_ptr(link(q)));
-        r = info(q);
-        s = end_span;
-        info(s) = p;
-        n = min_quarterword + 1;
-
-        do
-          {
-            width(r) = width(r) - t;
-            u = info(r);
-
-            while (link(r) > n)
-            {
-              s = info(s);
-              n = link(info(s)) + 1;
-            }
-
-            if (link(r) < n)
-            {
-              info(r) = info(s);
-              info(s) = r;
-              decr(link(r));
-              s = r;
-            }
-            else
-            {
-              if (width(r) > width(info(s)))
-                width(info(s)) = width(r);
-
-              free_node(r, span_node_size);
-            }
-
-            r = u;
-          }
-        while (!(r == end_span));
-      }
-
-      type(q) = unset_node;
-      span_count(q) = min_quarterword;
-      height(q) = 0;
-      depth(q) = 0;
-      glue_order(q) = normal;
-      glue_sign(q) = normal;
-      glue_stretch(q) = 0;
-      glue_shrink(q) = 0;
-      q = p;
-    }
-  while (!(q == 0));
-
-  save_ptr = save_ptr - 2;
-  pack_begin_line = - (integer) mode_line;
-
-  if (mode == -vmode)
-  {
-    rule_save = overfull_rule;
-    overfull_rule = 0;
-    p = hpack(preamble, saved(1), saved(0));
-    overfull_rule = rule_save;
-  }
-  else
-  {
-    q = link(preamble);
-
-    do
-      {
-        height(q) = width(q);
-        width(q) = 0;
-        q = link(link(q));
-      }
-    while (!(q == 0));
-
-    p = vpackage(preamble, saved(1), saved(0), 1073741823L);  /* 2^30 - 1 */
-    q = link(preamble);
-
-    do
-      {
-        width(q) = height(q);
-        height(q) = 0;
-        q = link(link(q));
-      }
-    while (!(q == 0));
-  }
-
-  pack_begin_line = 0;
-  q = link(head);
-  s = head;
-
-  while (q != 0)
-  {
-    if (!(q >= hi_mem_min))
-      if (type(q) == unset_node)
-      {
-        if (mode == -vmode)
-        {
-          type(q) = hlist_node;
-          width(q) = width(p);
-        }
-        else
-        {
-          type(q) = vlist_node;
-          height(q) = height(p);
-        }
-
-        glue_order(q) = glue_order(p);
-        glue_sign(q) = glue_sign(p);
-        glue_set(q) = glue_set(p);
-        shift_amount(q) = o;
-        r = link(list_ptr(q));
-        s = link(list_ptr(p));
-
-        do
-          {
-            n = span_count(r);
-            t = width(s);
-            w = t;
-            u = hold_head;
-
-            while (n > min_quarterword)
-            {
-              decr(n);
-              s = link(s);
-              v = glue_ptr(s);
-              link(u) = new_glue(v);
-              u = link(u);
-              subtype(u) = tab_skip_code + 1;
-              t = t + width(v);
-
-              if (glue_sign(p) == stretching)
-              {
-                if (stretch_order(v) == glue_order(p))
-                  t = t + round(glue_set(p) * stretch(v));
-              }
-              else if (glue_sign(p) == shrinking)
-              {
-                if (shrink_order(v) == glue_order(p))
-                  t = t - round(glue_set(p) * shrink(v));
-              }
-
-              s = link(s);
-              link(u) = new_null_box();
-              u = link(u);
-              t = t + width(s);
-
-              if (mode == -vmode)
-                width(u) = width(s);
-              else
-              {
-                type(u) = vlist_node;
-                height(u) = width(s);
-              }
-            }
-            
-
-            if (mode == -vmode)
-            {
-              height(r) = height(q);
-              depth(r) = depth(q);
-
-              if (t == width(r))
-              {
-                glue_sign(r) = normal;
-                glue_order(r) = normal;
-                glue_set(r) = 0.0;
-              }
-              else if (t > width(r))
-              {
-                glue_sign(r) = stretching;
-
-                if (glue_stretch(r) == 0)
-                  glue_set(r) = 0.0;
-                else
-                  glue_set(r) = (t - width(r)) / ((double) glue_stretch(r));
-              }
-              else
-              {
-                glue_order(r) = glue_sign(r);
-                glue_sign(r) = shrinking;
-
-                if (glue_shrink(r) == 0)
-                  glue_set(r) = 0.0;
-                else if ((glue_order(r) == normal) && (width(r) - t > glue_shrink(r)))
-                  glue_set(r) = 1.0;
-                else
-                  glue_set(r) = (width(r) - t)/ ((double) glue_shrink(r));
-              }
-
-              width(r) = w;
-              type(r) = hlist_node;
-            }
-            else
-            {
-              width(r) = width(q);
-
-              if (t == height(r))
-              {
-                glue_sign(r) = normal;
-                glue_order(r) = normal;
-                glue_set(r) = 0.0;
-              }
-              else if (t > height(r))
-              {
-                glue_sign(r) = stretching;
-
-                if (glue_stretch(r) == 0)
-                  glue_set(r) = 0.0;
-                else
-                  glue_set(r) = (t - height(r)) / ((double) glue_stretch(r));
-              }
-              else
-              {
-                glue_order(r) = glue_sign(r);
-                glue_sign(r) = shrinking;
-
-                if (glue_shrink(r) == 0)
-                  glue_set(r) = 0.0;
-                else if ((glue_order(r) == normal) && (height(r) - t > glue_shrink(r)))
-                  glue_set(r) = 1.0;
-                else
-                  glue_set(r) = (height(r) - t) / ((double) glue_shrink(r));
-              }
-
-              height(r) = w;
-              type(r) = vlist_node;
-            }
-
-            shift_amount(r) = 0;
-
-            if (u != hold_head)
-            {
-              link(u) = link(r);
-              link(r) = link(hold_head);
-              r = u;
-            }
-
-            r = link(link(r));
-            s = link(link(s));
-          }
-        while(!(r == 0));
-      }
-      else if (type(q) == rule_node)
-      {
-        if ((width(q) == -1073741824L))  /* 2^30  */
-          width(q) = width(p);
-
-        if ((height(q) == -1073741824L))  /* 2^30  */
-          height(q) = height(p);
-
-        if ((depth(q) == -1073741824L))  /* 2^30  */
-          depth(q) = depth(p);
-
-        if (o != 0)
-        {
-          r = link(q);
-          link(q) = 0;
-          q = hpack(q, 0, 1);
-          shift_amount(q) = o;
-          link(q) = r;
-          link(s) = q;
-        }
-      }
-    s = q;
-    q = link(q);
-  }
-
-  flush_node_list(p);
-  pop_alignment();
-  aux_save = cur_list.aux_field;
-  p = link(head);
-  q = tail;
-  pop_nest();
-
-  if (mode == mmode)
-  {
-    do_assignments();
-
-    if (cur_cmd != math_shift)
-    {
-      print_err("Missing $$ inserted");
-      help2("Displays can use special alignments (like \\eqalignno)",
-          "only if nothing but the alignment itself is between $$'s.");
-      back_error();
-    }
-    else
-    {
-      get_x_token();
-
-      if (cur_cmd != math_shift)
-      {
-        print_err("Display math should end with $$");
-        help2("The `$' that I just saw supposedly matches a previous `$$'.",
-            "So I shall assume that you typed `$$' both times.");
-        back_error();
-      }
-    }
-
-    pop_nest();
-    tail_append(new_penalty(pre_display_penalty));
-    tail_append(new_param_glue(above_display_skip_code));
-    link(tail) = p;
-
-    if (p != 0)
-      tail = q;
-
-    tail_append(new_penalty(post_display_penalty));
-    tail_append(new_param_glue(below_display_skip_code));
-    cur_list.aux_field.cint = aux_save.cint;
-    resume_after_display();
-  }
-  else
-  {
-    cur_list.aux_field = aux_save;
-    link(tail) = p;
-
-    if (p != 0)
-      tail = q;
-
-    if (mode == vmode)
-    {
-      build_page();
-    }
-  }
-}
-/* used to be align_peek, zfintieshrink, etc in old tex5.c */
-/************************************************************************/
-/* moved down here to avoid questions about pragma optimize */
-/* #pragma optimize("g", off) */
-/* for MC VS compiler */
-/* Moved down here 96/Oct/12 in response to problem with texerror.tex */
-/* pragma optimize("a", off) not strong enough - this may slow things */
-/* sec 0791 */
-bool fin_col (void)
-{
-  halfword p;
-  halfword q, r;
-  halfword s;
-  halfword u;
-  scaled w;
-  glue_ord o;
-  halfword n;
-
-  if (cur_align == 0)
-  {
-    confusion("endv");
-    return 0;       // abort_flag set
-  }
-
-  q = link(cur_align);
-
-  if (q == 0)
-  {
-    confusion("endv");
-    return 0;       // abort_flag set
-  }
-
-  if (align_state < 500000L)
-  {
-    fatal_error("(interwoven alignment preambles are not allowed)");
-    return 0;     // abort_flag set
-  }
-
-  p = link(q);
-
-  if ((p == 0) && (extra_info(cur_align) < cr_code))
-    if (cur_loop != 0)
-    {
-/*  potential problem here if new_null_box causes memory reallocation ??? */
-/*  compiler optimization does not refresh `mem' loaded in registers ? */
-      link(q) = new_null_box();
-      p = link(q);
-      info(p) = end_span;
-      width(p) = null_flag;
-      cur_loop = link(cur_loop);
-      q = hold_head;
-      r = u_part(cur_loop);
-
-      while (r != 0)
-      {
-        link(q) = get_avail();
-        q = link(q);
-        info(q) = info(r);
-        r = link(r);
-      }
-
-      link(q) = 0;
-      u_part(p) = link(hold_head);
-      q = hold_head;
-      r = v_part(cur_loop);
-
-      while (r != 0)
-      {
-        link(q) = get_avail();
-        q = link(q);
-        info(q) = info(r);
-        r = link(r);
-      }
-
-      link(q) = 0;
-      v_part(p) = link(hold_head);
-      cur_loop = link(cur_loop);
-      link(p) = new_glue(glue_ptr(cur_loop));
-    }
-    else
-    {
-      print_err("Extra alignment tab has been changed to ");
-      print_esc("cr");
-      help3("You have given more \\span or & marks than there were",
-          "in the preamble to the \\halign or \\valign now in progress.",
-          "So I'll assume that you meant to type \\cr instead.");
-      extra_info(cur_align) = cr_code;
-      error();
-    }
-
-  if (extra_info(cur_align) != span_code)
-  {
-    unsave();
-
-    new_save_level(align_group);
-
-    {
-      if (mode == -hmode)
-      {
-        adjust_tail = cur_tail;
-        u = hpack(link(head), 0, 1);
-        w = width(u);
-        cur_tail = adjust_tail;
-        adjust_tail = 0;
-      }
-      else
-      {
-        u = vpackage(link(head), 0, 1, 0);
-        w = height(u);
-      }
-
-      n = min_quarterword;
-
-      if (cur_span != cur_align)
-      {
-        q = cur_span;
-
-        do
-          {
-            incr(n);
-            q = link(link(q));
-          }
-        while (!(q == cur_align));
-
-        if (n > max_quarterword)
-        {
-          confusion("256 spans");   /* 256 spans --- message wrong now, but ... */
-          return 0;       // abort_flag set
-        }
-
-        q = cur_span;
-
-        while (link(info(q)) < n)
-          q = info(q);
-
-        if (link(info(q)) > n)
-        {
-          s = get_node(span_node_size);
-          info(s) = info(q);
-          link(s) = n;
-          info(q) = s;
-          width(s) = w;
-        }
-        else if (width(info(q)) < w)
-          width(info(q)) = w;
-      }
-      else if (w > width(cur_align))
-        width(cur_align) = w;
-
-      type(u) = unset_node;
-      span_count(u) = n;
-
-      if (total_stretch[filll] != 0)
-        o = filll;
-      else if (total_stretch[fill] != 0)
-        o = fill;
-      else if (total_stretch[fil] != 0)
-        o = fil;
-      else
-        o = normal;
-
-      glue_order(u) = o;
-      glue_stretch(u) = total_stretch[o];
-
-      if (total_shrink[filll] != 0)
-        o = filll;
-      else if (total_shrink[fill] != 0)
-        o = fill;
-      else if (total_shrink[fil] != 0)
-        o = fil;
-      else
-        o = normal;
-
-      glue_sign(u) = o;
-      glue_shrink(u) = total_shrink[o];
-      pop_nest();
-      link(tail) = u;
-      tail = u;
-    }
-
-    tail_append(new_glue(glue_ptr(link(cur_align))));
-    subtype(tail) = tab_skip_code + 1;
-
-    if (extra_info(cur_align) >= cr_code)
-    {
-      return true;
-    }
-
-    init_span(p);
-  }
-
-  align_state = 1000000L;
-
-  do
-    {
-      get_x_token();
-    }
-  while (!(cur_cmd != spacer));
-
-  cur_align = p;
-  init_col();
-
-  return false;
-}
-/* #pragma optimize ("g", on) */        /* for MC VS compiler */
-/* #pragma optimize ("g",) */         /* 94/Jan/25 */
-/* #pragma optimize ("", on) */           /* 96/Sep/12 */
-/* #pragma optimize("g", off) */          /* for MC VS compiler */
-/* sec 0749 */
-scaled make_op_(halfword q)
-{
-  scaled delta;
-  halfword p, v, x, y, z;
-  quarterword c;
-  ffourquarters i;
-  scaled shift_up, shift_down;
-
-  if ((subtype(q) == normal) && (cur_style < text_style))
-    subtype(q) = limits;
-
-  if (math_type(nucleus(q)) == math_char)
-  {
-    fetch(nucleus(q));
-
-    if ((cur_style < text_style) && (char_tag(cur_i) == list_tag))
-    {
-      c = rem_byte(cur_i);
-      i = char_info(cur_f, c);
-
-      if ((i.b0 > 0))
-      {
-        cur_c = c;
-        cur_i = i;
-        character(nucleus(q)) = c;
-      }
-    }
-
-    delta = char_italic(cur_f, cur_i);
-    x = clean_box(nucleus(q), cur_style);
-
-    if ((math_type(subscr(q)) != 0) && (subtype(q) != limits))
-      width(x) = width(x) - delta;
-
-    shift_amount(x) = half(height(x) - depth(x)) - axis_height(cur_size);
-    math_type(nucleus(q)) = sub_box;
-    info(nucleus(q)) = x;
-  }
-  else
-    delta = 0;
-
-  if (subtype(q) == limits)
-  {
-    x = clean_box(supscr(q), sup_style(cur_style));
-    y = clean_box(nucleus(q), cur_style);
-    z = clean_box(subscr(q), sub_style(cur_style));
-    v = new_null_box();
-    type(v) = vlist_node;
-    width(v) = width(y);
-
-    if (width(x) > width(v))
-      width(v) = width(x);
-
-    if (width(z) > width(v))
-      width(v) = width(z);
-
-    x = rebox(x, width(v));
-    y = rebox(y, width(v));
-    z = rebox(z, width(v));
-    shift_amount(x) = half(delta);
-    shift_amount(z) = - (integer) shift_amount(x);
-    height(v) = height(y);
-    depth(v) = depth(y);
-
-    if (math_type(supscr(q)) == 0)
-    {
-      free_node(x, box_node_size);
-      list_ptr(v) = y;
-    }
-    else
-    {
-      shift_up = big_op_spacing3 - depth(x);
-
-      if (shift_up < big_op_spacing1)
-        shift_up = big_op_spacing1;
-
-      p = new_kern(shift_up);
-      link(p) = y;
-      link(x) = p;
-      p = new_kern(big_op_spacing5);
-      link(p) = x;
-      list_ptr(v) = p;
-      height(v) = height(v) + big_op_spacing5 + height(x) + depth(x) + shift_up;
-    }
-
-    if (math_type(subscr(q)) == 0)
-      free_node(z, box_node_size);
-    else
-    {
-      shift_down = big_op_spacing4 - height(z);
-
-      if (shift_down < big_op_spacing2)
-        shift_down = big_op_spacing2;
-
-      p = new_kern(shift_down);
-      link(y) = p;
-      link(p) = z;
-      p = new_kern(big_op_spacing5);
-      link(z) = p;
-      depth(v) = depth(v) + big_op_spacing5 + height(z) + depth(z) + shift_down;
-    }
-
-    new_hlist(q) = v;
-  }
-
-  return delta;
-}
-/* #pragma optimize ("g", on) */        /* for MC VS compiler */
-/* #pragma optimize ("g",) */         /* 94/Jan/25 */
-/* #pragma optimize ("", on) */           /* 96/Sep/12 */
-/* #pragma optimize ("g", off) */
-/* sec 0756 */
-void make_scripts_(halfword q, scaled delta)
-{
-  halfword p, x, y, z;
-  scaled shift_up, shift_down, clr;
-  small_number t;
-
-  p = new_hlist(q);
-
-  if ((p >= hi_mem_min))
-  {
-    shift_up = 0;
-    shift_down = 0;
-  }
-  else
-  {
-    z = hpack(p, 0, 1);
-
-    if (cur_style < script_style)
-      t = script_size;
-    else
-      t = script_script_size;
-
-    shift_up = height(z) - sup_drop(t);
-    shift_down = depth(z) + sub_drop(t);
-    free_node(z, box_node_size);
-  }
-
-  if (math_type(supscr(q)) == 0)
-  {
-    x = clean_box(subscr(q), sub_style(cur_style));
-    width(x) = width(x) + script_space;
-
-    if (shift_down < sub1(cur_size))
-      shift_down = sub1(cur_size);
-
-    clr = height(x) -(abs(math_x_height(cur_size) * 4) / 5);
-
-    if (shift_down < clr)
-      shift_down = clr;
-
-    shift_amount(x) = shift_down;
-  }
-  else
-  {
-    {
-      x = clean_box(supscr(q), sup_style(cur_style));
-      width(x) = width(x) + script_space;
-
-      if (odd(cur_style))
-        clr = sup3(cur_size);
-      else if (cur_style < text_style)
-        clr = sup1(cur_size);
-      else
-        clr = sup2(cur_size);
-
-      if (shift_up < clr)
-        shift_up = clr;
-
-      clr = depth(x) +(abs(math_x_height(cur_size)) / 4);
-
-      if (shift_up < clr)
-        shift_up = clr;
-    }
-
-    if (math_type(subscr(q)) == 0)
-      shift_amount(x) = - (integer) shift_up;
-    else
-    {
-      y = clean_box(subscr(q), sub_style(cur_style));
-      width(y) = width(y) + script_space;
-
-      if (shift_down < sub2(cur_size))
-        shift_down = sub2(cur_size);
-
-      clr = 4 * default_rule_thickness - ((shift_up - depth(x)) - (height(y) - shift_down));
-
-      if (clr > 0)
-      {
-        shift_down = shift_down + clr;
-
-        clr = (abs(math_x_height(cur_size) * 4) / 5) - (shift_up - depth(x));
-
-        if (clr > 0)
-        {
-          shift_up = shift_up + clr;
-          shift_down = shift_down - clr;
-        }
-      }
-
-      shift_amount(x) = delta;
-      p = new_kern((shift_up - depth(x)) - (height(y) - shift_down));
-      link(x) = p;
-      link(p) = y;
-      x = vpackage(x, 0, 1, 1073741823L);  /* 2^30 - 1 */
-      shift_amount(x) = shift_down;
-    }
-  }
-
-  if (new_hlist(q) == 0)
-    new_hlist(q) = x;
-  else
-  {
-    p = new_hlist(q);
-
-    while (link(p) != 0)
-      p = link(p);
-
-    link(p) = x;
-  }
-}
-/* #pragma optimize ("g", on) */        /* 96/Sep/12 */
-/* #pragma optimize ("g") */          /* 94/Jan/25 */
-/* #pragma optimize ("", on) */           /* 96/Sep/12 */
\ No newline at end of file
+/*\r
+   Copyright 2014 Clerk Ma\r
+\r
+   This program is free software; you can redistribute it and/or modify\r
+   it under the terms of the GNU General Public License as published by\r
+   the Free Software Foundation; either version 2 of the License, or\r
+   (at your option) any later version.\r
+\r
+   This program is distributed in the hope that it will be useful, but\r
+   WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+   General Public License for more details.\r
+\r
+   You should have received a copy of the GNU General Public License\r
+   along with this program; if not, write to the Free Software\r
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
+   02110-1301 USA.\r
+*/\r
+\r
+#define EXTERN extern\r
+#include "yandytex.h"\r
+\r
+/* sec 0715 */\r
+pointer rebox (pointer b, scaled w)\r
+{\r
+  pointer p;\r
+  internal_font_number f;\r
+  scaled v;\r
+\r
+  if ((width(b) != w) && (list_ptr(b) != 0))\r
+  {\r
+    if (type(b) == vlist_node)\r
+      b = hpack(b, 0, 1);\r
+\r
+    p = list_ptr(b);\r
+\r
+    if ((is_char_node(p)) && (link(p) == 0))\r
+    {\r
+      f = font(p);\r
+      v = char_width(f, char_info(f, character(p)));\r
+\r
+      if (v != width(b))\r
+        link(p) = new_kern(width(b) - v);\r
+    }\r
+\r
+    free_node(b, box_node_size);\r
+    b = new_glue(ss_glue);\r
+    link(b) = p;\r
+\r
+    while (link(p) != 0)\r
+      p = link(p);\r
+\r
+    link(p) = new_glue(ss_glue);\r
+    return hpack(b, w, exactly);\r
+  }\r
+  else\r
+  {\r
+    width(b) = w;\r
+    return b;\r
+  }\r
+}\r
+/* sec 0716 */\r
+pointer math_glue (pointer g, scaled m)\r
+{\r
+  pointer p;\r
+  integer n;\r
+  scaled f;\r
+\r
+  n = x_over_n(m, 65536L);\r
+  f = tex_remainder;\r
+\r
+  if (f < 0)\r
+  {\r
+    decr(n);\r
+    f = f + 65536L;\r
+  }\r
+\r
+  p = get_node(glue_spec_size);\r
+  width(p) = mu_mult(width(g));\r
+  stretch_order(p) = stretch_order(g);\r
+\r
+  if (stretch_order(p) == normal)\r
+    stretch(p) = mu_mult(stretch(g));\r
+  else\r
+    stretch(p) = stretch(g);\r
+\r
+  shrink_order(p) = shrink_order(g);\r
+\r
+  if (shrink_order(p) == normal)\r
+    shrink(p) = mu_mult(shrink(g));\r
+  else\r
+    shrink(p) = shrink(g);\r
+\r
+  return p;\r
+}\r
+/* sec 0717 */\r
+void math_kern (pointer p, scaled m)\r
+{\r
+  integer n;\r
+  scaled f;\r
+\r
+  if (subtype(p) == mu_glue)\r
+  {\r
+    n = x_over_n(m, 65536L);\r
+    f = tex_remainder;\r
+\r
+    if (f < 0)\r
+    {\r
+      decr(n);\r
+      f = f + 65536L;\r
+    }\r
+\r
+    width(p) = mu_mult(width(p));\r
+    subtype(p) = explicit;\r
+  }\r
+}\r
+/* sec 0718 */\r
+void flush_math (void)\r
+{\r
+  flush_node_list(link(head));\r
+  flush_node_list(incompleat_noad);\r
+  link(head) = 0;\r
+  tail = head;\r
+  incompleat_noad = 0;\r
+}\r
+/* sec 0720 */\r
+pointer clean_box (pointer p, small_number s)\r
+{\r
+  pointer q;\r
+  small_number save_style;\r
+  pointer x;\r
+  pointer r;\r
+\r
+  switch (math_type(p))\r
+  {\r
+    case math_char:\r
+      {\r
+        cur_mlist = new_noad();\r
+        mem[nucleus(cur_mlist)] = mem[p];\r
+      }\r
+      break;\r
+\r
+    case sub_box:\r
+      {\r
+        q = info(p);\r
+        goto found;\r
+      }\r
+      break;\r
+\r
+    case sub_mlist:\r
+      cur_mlist = info(p);\r
+      break;\r
+\r
+    default:\r
+      {\r
+        q = new_null_box();\r
+        goto found;\r
+      }\r
+    break;\r
+  }\r
+\r
+  save_style = cur_style;\r
+  cur_style = s;\r
+  mlist_penalties = false;\r
+  mlist_to_hlist();\r
+  q = link(temp_head);\r
+  cur_style = save_style;\r
+\r
+  {\r
+    if (cur_style < script_style)\r
+      cur_size = text_size;\r
+    else\r
+      cur_size = 16 * ((cur_style - text_style) / 2);\r
+\r
+    cur_mu = x_over_n(math_quad(cur_size), 18);\r
+  }\r
+\r
+found:\r
+  if (is_char_node(q) || (q == 0))\r
+    x = hpack(q, 0, 1);\r
+  else if ((link(q) == 0) && (type(q) <= vlist_node) && (shift_amount(q) == 0))\r
+    x = q;\r
+  else\r
+    x = hpack(q, 0, 1);\r
+\r
+  q = list_ptr(x);\r
+\r
+  if (is_char_node(q))\r
+  {\r
+    r = link(q);\r
+\r
+    if (r != 0)\r
+      if (link(r) == 0)\r
+        if (!is_char_node(r))\r
+          if (type(r) == kern_node)\r
+          {\r
+            free_node(r, small_node_size);\r
+            link(q) = 0;\r
+          }\r
+  }\r
+\r
+  return x;\r
+}\r
+/* sec 0722 */\r
+void fetch (pointer a)\r
+{\r
+  cur_c = character(a);\r
+  cur_f = fam_fnt(fam(a) + cur_size);\r
+\r
+  if (cur_f == null_font)\r
+  {\r
+    print_err("");\r
+    print_size(cur_size);\r
+    print_char(' ');\r
+    print_int(fam(a));\r
+    prints(" is undefined (character ");\r
+    print(cur_c);\r
+    print_char(')');\r
+    help4("Somewhere in the math formula just ended, you used the",\r
+        "stated character from an undefined font family. For example,",\r
+        "plain TeX doesn't allow \\it or \\sl in subscripts. Proceed,",\r
+        "and I'll try to forget that I needed that character.");\r
+    error();\r
+    cur_i = null_character;\r
+    math_type(a) = 0;\r
+  }\r
+  else\r
+  {\r
+    if ((cur_c >= font_bc[cur_f]) && (cur_c <= font_ec[cur_f]))\r
+      cur_i = char_info(cur_f, cur_c);\r
+    else\r
+      cur_i = null_character;\r
+\r
+    if (!char_exists(cur_i))\r
+    {\r
+      char_warning(cur_f, cur_c);\r
+      math_type(a) = 0;\r
+    }\r
+  }\r
+}\r
+/* sec 0734 */\r
+void make_over (pointer q)\r
+{\r
+  info(nucleus(q)) = overbar(clean_box(nucleus(q), 2 * (cur_style / 2) + 1),\r
+      3 * default_rule_thickness, default_rule_thickness);\r
+  math_type(nucleus(q)) = sub_box;\r
+}\r
+/* sec 0735 */\r
+void make_under (pointer q)\r
+{\r
+  pointer p, x, y;\r
+  scaled delta;\r
+\r
+  x = clean_box(nucleus(q), cur_style);\r
+  p = new_kern(3 * default_rule_thickness);\r
+  link(x) = p;\r
+  link(p) = fraction_rule(default_rule_thickness);\r
+  y = vpackage(x, 0, 1, max_dimen);\r
+  delta = height(y) + depth(y) + default_rule_thickness;\r
+  height(y) = height(x);\r
+  depth(y) = delta - height(y);\r
+  info(nucleus(q)) = y;\r
+  math_type(nucleus(q)) = sub_box;\r
+}\r
+/* sec 0736 */\r
+void make_vcenter (pointer q)\r
+{ \r
+  pointer v;\r
+  scaled delta;\r
+\r
+  v = info(nucleus(q));\r
+\r
+  if (type(v) != vlist_node)\r
+  {\r
+    confusion("vcenter");\r
+    return;\r
+  }\r
+\r
+  delta = height(v) + depth(v);\r
+  height(v) = axis_height(cur_size) + half(delta);\r
+  depth(v) = delta - height(v);\r
+}\r
+/* sec 0737 */\r
+void make_radical (pointer q)\r
+{\r
+  pointer x, y;\r
+  scaled delta, clr;\r
+\r
+  x = clean_box(nucleus(q), 2 * (cur_style / 2) + 1);\r
+\r
+  if (cur_style < text_style)\r
+    clr = default_rule_thickness + (abs(math_x_height(cur_size)) / 4);\r
+  else\r
+  {\r
+    clr = default_rule_thickness;\r
+    clr = clr + (abs(clr) / 4);\r
+  }\r
+\r
+  y = var_delimiter(left_delimiter(q), cur_size, height(x) + depth(x) + clr + default_rule_thickness);\r
+  delta = depth(y) - (height(x) + depth(x) + clr);\r
+\r
+  if (delta > 0)\r
+    clr = clr + half(delta);\r
+\r
+  shift_amount(y) = - (integer) (height(x) + clr);\r
+  link(y) = overbar(x, clr, height(y));\r
+  info(nucleus(q)) = hpack(y, 0, 1);\r
+  math_type(nucleus(q)) = sub_box;\r
+}\r
+/* sec 0738 */\r
+void make_math_accent (pointer q)\r
+{\r
+  pointer p, x, y;\r
+  integer a;\r
+  quarterword c;\r
+  internal_font_number f;\r
+  four_quarters i;\r
+  scaled s;\r
+  scaled h;\r
+  scaled delta;\r
+  scaled w;\r
+\r
+  fetch(accent_chr(q));\r
+\r
+  if (char_exists(cur_i))\r
+  {\r
+    i = cur_i;\r
+    c = cur_c;\r
+    f = cur_f;\r
+    s = 0;\r
+\r
+    if (math_type(nucleus(q)) == math_char)\r
+    {\r
+      fetch(nucleus(q));\r
+\r
+      if (char_tag(cur_i) == lig_tag)\r
+      {\r
+        a = lig_kern_start(cur_f, cur_i);\r
+        cur_i = font_info[a].qqqq;\r
+\r
+        if (skip_byte(cur_i) > stop_flag)\r
+        {\r
+          a = lig_kern_restart(cur_f, cur_i);\r
+          cur_i = font_info[a].qqqq;\r
+        }\r
+\r
+        while (true)\r
+        {\r
+          if (next_char(cur_i) == skew_char[cur_f])\r
+          {\r
+            if (op_byte(cur_i) >= kern_flag)\r
+              if (skip_byte(cur_i) <= stop_flag)\r
+                s = char_kern(cur_f, cur_i);\r
+\r
+            goto done1;\r
+          }\r
+\r
+          if (skip_byte(cur_i) >= stop_flag)\r
+            goto done1;\r
+\r
+          a = a + skip_byte(cur_i) + 1;\r
+          cur_i = font_info[a].qqqq;\r
+        }\r
+      }\r
+    }\r
+\r
+done1:\r
+    x = clean_box(nucleus(q), cramped_style(cur_style));\r
+    w = width(x);\r
+    h = height(x);\r
+\r
+    while (true)\r
+    {\r
+      if (char_tag(i) != list_tag)\r
+        goto done;\r
+\r
+      y = rem_byte(i);\r
+      i = char_info(f, y);\r
+\r
+      if (!char_exists(i))\r
+        goto done;\r
+\r
+      if (char_width(f, i) > w)\r
+        goto done;\r
+\r
+      c = y;\r
+    }\r
+\r
+done:\r
+    if (h < x_height(f))\r
+      delta = h;\r
+    else\r
+      delta = x_height(f);\r
+\r
+    if ((math_type(supscr(q)) != 0) || (math_type(subscr(q)) != 0))\r
+      if (math_type(nucleus(q)) == math_char)\r
+      {\r
+        flush_node_list(x);\r
+        x = new_noad();\r
+        mem[nucleus(x)] = mem[nucleus(q)];\r
+        mem[supscr(x)] = mem[supscr(q)];\r
+        mem[subscr(x)] = mem[subscr(q)];\r
+        mem[supscr(q)].hh = empty_field;\r
+        mem[subscr(q)].hh = empty_field;\r
+        math_type(nucleus(q)) = sub_mlist;\r
+        info(nucleus(q)) = x;\r
+        x = clean_box(nucleus(q), cur_style);\r
+        delta = delta + height(x) - h;\r
+        h = height(x);\r
+      }\r
+\r
+    y = char_box(f, c);\r
+    shift_amount(y) = s + half(w - width(y));\r
+    width(y) = 0;\r
+    p = new_kern(-(integer) delta);\r
+    link(p) = x;\r
+    link(y) = p;\r
+    y = vpackage(y, 0, 1, max_dimen);\r
+    width(y) = width(x);\r
+\r
+    if (height(y) < h)\r
+    {\r
+      p = new_kern(h - height(y));\r
+      link(p) = list_ptr(y);\r
+      list_ptr(y) = p;\r
+      height(y) = h;\r
+    }\r
+\r
+    info(nucleus(q)) = y;\r
+    math_type(nucleus(q)) = sub_box;\r
+  }\r
+}\r
+/* sec 0743 */\r
+void make_fraction (pointer q)\r
+{\r
+  pointer p, v, x, y, z;\r
+  scaled delta, delta1, delta2, shift_up, shift_down, clr;\r
+  \r
+  if (thickness(q) == default_code)\r
+    thickness(q) = default_rule_thickness;\r
+\r
+  x = clean_box(numerator(q), num_style(cur_style));\r
+  z = clean_box(denominator(q), denom_style(cur_style));\r
+\r
+  if (width(x) < width(z))\r
+    x = rebox(x, width(z));\r
+  else\r
+    z = rebox(z, width(x));\r
+\r
+  if (cur_style < text_style)\r
+  {\r
+    shift_up = num1(cur_size);\r
+    shift_down = denom1(cur_size);\r
+  }\r
+  else\r
+  {\r
+    shift_down = denom2(cur_size);\r
+\r
+    if (thickness(q) != 0)\r
+      shift_up = num2(cur_size);\r
+    else\r
+      shift_up = num3(cur_size);\r
+  }\r
+\r
+  if (thickness(q) == 0)\r
+  {\r
+    if (cur_style < text_style)\r
+      clr = 7 * default_rule_thickness;\r
+    else\r
+      clr = 3 * default_rule_thickness;\r
+\r
+    delta = half(clr - ((shift_up - depth(x)) - (height(z) - shift_down)));\r
+\r
+    if (delta > 0)\r
+    {\r
+      shift_up = shift_up + delta;\r
+      shift_down = shift_down + delta;\r
+    }\r
+  }\r
+  else\r
+  {\r
+    if (cur_style < text_style)\r
+      clr = 3 * thickness(q);\r
+    else\r
+      clr = thickness(q);\r
+\r
+    delta = half(thickness(q));\r
+    delta1 = clr - ((shift_up - depth(x)) - (axis_height(cur_size) + delta));\r
+    delta2 = clr - ((axis_height(cur_size) - delta) - (height(z) - shift_down));\r
+\r
+    if (delta1 > 0)\r
+      shift_up = shift_up + delta1;\r
+\r
+    if (delta2 > 0)\r
+      shift_down = shift_down + delta2;\r
+  }\r
+\r
+  v = new_null_box();\r
+  type(v) = vlist_node;\r
+  height(v) = shift_up + height(x);\r
+  depth(v) = depth(z) + shift_down;\r
+  width(v) = width(x);\r
+\r
+  if (thickness(q) == 0)\r
+  {\r
+    p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));\r
+    link(p) = z;\r
+  }\r
+  else\r
+  {\r
+    y = fraction_rule(thickness(q));\r
+    p = new_kern((axis_height(cur_size) - delta) - (height(z) - shift_down));\r
+    link(y) = p;\r
+    link(p) = z;\r
+    p = new_kern((shift_up - depth(x)) - (axis_height(cur_size) + delta));\r
+    link(p) = y;\r
+  }\r
+\r
+  link(x) = p;\r
+  list_ptr(v) = x;\r
+\r
+  if (cur_style < text_style)\r
+    delta = delim1(cur_size);\r
+  else\r
+    delta = delim2(cur_size);\r
+\r
+  x = var_delimiter(left_delimiter(q), cur_size, delta);\r
+  link(x) = v;\r
+  z = var_delimiter(right_delimiter(q), cur_size, delta);\r
+  link(v) = z;\r
+  new_hlist(q) = hpack(x, 0, 1);\r
+}\r
+/* sec 0752 */\r
+void make_ord (pointer q)\r
+{\r
+  integer a;\r
+  pointer p, r;\r
+\r
+restart:\r
+  if (math_type(subscr(q)) == 0)\r
+    if (math_type(supscr(q)) == 0)\r
+      if (math_type(nucleus(q)) == math_char)\r
+      {\r
+        p = link(q);\r
+\r
+        if (p != 0)\r
+          if ((type(p) >= ord_noad) && (type(p) <= punct_noad))\r
+            if (math_type(nucleus(p)) == math_char)\r
+              if (fam(nucleus(p)) == fam(nucleus(q)))\r
+              {\r
+                math_type(nucleus(q)) = math_text_char;\r
+                fetch(nucleus(q));\r
+\r
+                if (char_tag(cur_i) == lig_tag)\r
+                {\r
+                  a = lig_kern_start(cur_f, cur_i);\r
+                  cur_c = character(nucleus(p));\r
+                  cur_i = font_info[a].qqqq;\r
+\r
+                  if (skip_byte(cur_i) > stop_flag)\r
+                  {\r
+                    a = lig_kern_restart(cur_f, cur_i);\r
+                    cur_i = font_info[a].qqqq;\r
+                  }\r
+\r
+                  while (true)\r
+                  {\r
+                    if (next_char(cur_i) == cur_c)\r
+                      if (skip_byte(cur_i) <= stop_flag)\r
+                        if (op_byte(cur_i) >= kern_flag)\r
+                        {\r
+                          p = new_kern(char_kern(cur_f, cur_i));\r
+                          link(p) = link(q);\r
+                          link(q) = p;\r
+                          return;\r
+                        }\r
+                        else\r
+                        {\r
+                          check_interrupt();\r
+\r
+                          switch (op_byte(cur_i))\r
+                          {\r
+                            case 1:\r
+                            case 5:\r
+                              character(nucleus(q)) = rem_byte(cur_i);\r
+                              break;\r
+                            case 2:\r
+                            case 6:\r
+                              character(nucleus(p)) = rem_byte(cur_i);\r
+                              break;\r
+                            case 3:\r
+                            case 7:\r
+                            case 11:\r
+                              {\r
+                                r = new_noad();\r
+                                character(nucleus(r)) = rem_byte(cur_i);\r
+                                fam(nucleus(r)) = fam(nucleus(q));\r
+                                link(q) = r;\r
+                                link(r) = p;\r
+\r
+                                if (op_byte(cur_i) < 11)\r
+                                  math_type(nucleus(r)) = math_char;\r
+                                else\r
+                                  math_type(nucleus(r)) = math_text_char;\r
+                              }\r
+                              break;\r
+\r
+                            default:\r
+                              {\r
+                                link(q) = link(p);\r
+                                character(nucleus(q)) = rem_byte(cur_i);\r
+                                mem[subscr(q)] = mem[subscr(p)];\r
+                                mem[supscr(q)] = mem[supscr(p)];\r
+                                free_node(p, noad_size);\r
+                              }\r
+                              break;\r
+                          }\r
+\r
+                          if (op_byte(cur_i) > 3)\r
+                            return;\r
+\r
+                          math_type(nucleus(q)) = math_char;\r
+                          goto restart;\r
+                        }\r
+\r
+                    if (skip_byte(cur_i) >= stop_flag)\r
+                      return;\r
+\r
+                    a = a + skip_byte(cur_i) + 1;\r
+                    cur_i = font_info[a].qqqq;\r
+                  }\r
+                }\r
+              }\r
+      }\r
+}\r
+/* sec 0762 */\r
+small_number make_left_right (pointer q, small_number style, scaled max_d, scaled max_h)\r
+{\r
+  scaled delta, delta1, delta2;\r
+\r
+  if (style < script_style)\r
+    cur_size = text_size;\r
+  else\r
+    cur_size = 16 * ((style - text_style) / 2);\r
+\r
+  delta2 = max_d + axis_height(cur_size);\r
+  delta1 = max_h + max_d - delta2;\r
+\r
+  if (delta2 > delta1)\r
+    delta1 = delta2;\r
+\r
+  delta = (delta1 / 500) * delimiter_factor;\r
+  delta2 = delta1 + delta1 - delimiter_shortfall;\r
+\r
+  if (delta < delta2)\r
+    delta = delta2;\r
+\r
+  new_hlist(q) = var_delimiter(delimiter(q), cur_size, delta);\r
+\r
+  return type(q) - (left_noad - open_noad);\r
+}\r
+/* sec 0726 */\r
+void mlist_to_hlist (void)\r
+{\r
+  pointer mlist;\r
+  boolean penalties;\r
+  small_number style;\r
+  small_number save_style;\r
+  pointer q;\r
+  pointer r;\r
+  /* small_number r_type; */\r
+  int r_type;\r
+  /* small_number t; */\r
+  int t;\r
+  pointer p, x, y, z;\r
+  integer pen;\r
+  small_number s;\r
+  scaled max_h, max_d;\r
+  scaled delta;\r
+\r
+  mlist = cur_mlist;\r
+  penalties = mlist_penalties;\r
+  style = cur_style;\r
+  q = mlist;\r
+  r = 0;\r
+  r_type = op_noad;\r
+  max_h = 0;\r
+  max_d = 0;\r
+\r
+  {\r
+    if (cur_style < script_style)\r
+      cur_size = text_size;\r
+    else\r
+      cur_size = 16 * ((cur_style - text_style) / 2);\r
+\r
+    cur_mu = x_over_n(math_quad(cur_size), 18);\r
+  }\r
+\r
+  while (q != 0)\r
+  {\r
+reswitch:\r
+    delta = 0;\r
+\r
+    switch (type(q))\r
+    {\r
+      case bin_noad:\r
+        switch (r_type)\r
+        {\r
+          case bin_noad:\r
+          case op_noad:\r
+          case rel_noad:\r
+          case open_noad:\r
+          case punct_noad:\r
+          case left_noad:\r
+            {\r
+              type(q) = ord_noad;\r
+              goto reswitch;\r
+            }\r
+            break;\r
+\r
+          default:\r
+            do_nothing();\r
+            break;\r
+        }\r
+        break;\r
+\r
+      case rel_noad:\r
+      case close_noad:\r
+      case punct_noad:\r
+      case right_noad:\r
+        {\r
+          if (r_type == bin_noad)\r
+            type(r) = ord_noad;\r
+\r
+          if (type(q) == right_noad)\r
+            goto done_with_noad;\r
+        }\r
+        break;\r
+\r
+      case left_noad:\r
+        goto done_with_noad;\r
+        break;\r
+\r
+      case fraction_noad:\r
+        {\r
+          make_fraction(q);\r
+          goto check_dimensions;\r
+        }\r
+        break;\r
+\r
+      case op_noad:\r
+        {\r
+          delta = make_op(q);\r
+\r
+          if (subtype(q) == limits)\r
+            goto check_dimensions;\r
+        }\r
+        break;\r
+\r
+      case ord_noad:\r
+        make_ord(q);\r
+        break;\r
+\r
+      case open_noad:\r
+      case inner_noad:\r
+        do_nothing();\r
+        break;\r
+\r
+      case radical_noad:\r
+        make_radical(q);\r
+        break;\r
+\r
+      case over_noad:\r
+        make_over(q);\r
+        break;\r
+\r
+      case under_noad:\r
+        make_under(q);\r
+        break;\r
+\r
+      case accent_noad:\r
+        make_math_accent(q);\r
+        break;\r
+\r
+      case vcenter_noad:\r
+        make_vcenter(q);\r
+        break;\r
+\r
+      case style_node:\r
+        {\r
+          cur_style = subtype(q);\r
+\r
+          {\r
+            if (cur_style < script_style)\r
+              cur_size = text_size;\r
+            else\r
+              cur_size = 16 * ((cur_style - text_style) / 2);\r
+\r
+            cur_mu = x_over_n(math_quad(cur_size), 18);\r
+          }\r
+\r
+          goto done_with_node;\r
+        }\r
+        break;\r
+\r
+      case choice_node:\r
+        {\r
+          switch (cur_style / 2)\r
+          {\r
+            case 0:\r
+              choose_mlist(display_mlist);\r
+              break;\r
+\r
+            case 1:\r
+              choose_mlist(text_mlist);\r
+              break;\r
+\r
+            case 2:\r
+              choose_mlist(script_mlist);\r
+              break;\r
+\r
+            case 3:\r
+              choose_mlist(script_script_mlist);\r
+              break;\r
+          }\r
+\r
+          flush_node_list(display_mlist(q));\r
+          flush_node_list(text_mlist(q));\r
+          flush_node_list(script_mlist(q));\r
+          flush_node_list(script_script_mlist(q));\r
+          type(q) = style_node;\r
+          subtype(q) = cur_style;\r
+          width(q) = 0;\r
+          depth(q) = 0;\r
+\r
+          if (p != 0)\r
+          {\r
+            z = link(q);\r
+            link(q) = p;\r
+\r
+            while (link(p) != 0)\r
+              p = link(p);\r
+\r
+            link(p) = z;\r
+          }\r
+\r
+          goto done_with_node;\r
+        }\r
+        break;\r
+\r
+      case ins_node:\r
+      case mark_node:\r
+      case adjust_node:\r
+      case whatsit_node:\r
+      case penalty_node:\r
+      case disc_node:\r
+        goto done_with_node;\r
+        break;\r
+\r
+      case rule_node:\r
+        {\r
+          if (height(q) > max_h)\r
+            max_h = height(q);\r
+\r
+          if (depth(q) > max_d)\r
+            max_d = depth(q);\r
+\r
+          goto done_with_node;\r
+        }\r
+        break;\r
+\r
+      case glue_node:\r
+        {\r
+          if (subtype(q) == mu_glue)\r
+          {\r
+            x = glue_ptr(q);\r
+            y = math_glue(x, cur_mu);\r
+            delete_glue_ref(x);\r
+            glue_ptr(q) = y;\r
+            subtype(q) = normal;\r
+          }\r
+          else if ((cur_size != text_size) && (subtype(q) == cond_math_glue))\r
+          {\r
+            p = link(q);\r
+\r
+            if (p != 0)\r
+              if ((type(q) == glue_node) || (type(p) == kern_node))\r
+              {\r
+                link(q) = link(p);\r
+                link(p) = 0;\r
+                flush_node_list(p);\r
+              }\r
+          }\r
+\r
+          goto done_with_node;\r
+        }\r
+        break;\r
+\r
+      case kern_node:\r
+        {\r
+          math_kern(q, cur_mu);\r
+          goto done_with_node;\r
+        }\r
+        break;\r
+\r
+      default:\r
+        {\r
+          confusion("mlist1");\r
+          return;\r
+        }\r
+        break;\r
+    }\r
+\r
+    switch (math_type(nucleus(q)))\r
+    {\r
+      case math_char:\r
+      case math_text_char:\r
+        {\r
+          fetch(nucleus(q));\r
+\r
+          if (char_exists(cur_i))\r
+          {\r
+            delta = char_italic(cur_f, cur_i);\r
+            p = new_character(cur_f, cur_c);\r
+\r
+            if ((math_type(nucleus(q)) == math_text_char) && (space(cur_f) != 0))\r
+              delta = 0;\r
+\r
+            if ((math_type(subscr(q)) == 0) && (delta != 0))\r
+            {\r
+              link(p) = new_kern(delta);\r
+              delta = 0;\r
+            }\r
+          }\r
+          else\r
+            p = 0;\r
+        }\r
+        break;\r
+\r
+      case 0:\r
+        p = 0;\r
+        break;\r
+\r
+      case sub_box:\r
+        p = info(nucleus(q));\r
+        break;\r
+\r
+      case sub_mlist:\r
+        {\r
+          cur_mlist = info(nucleus(q));\r
+          save_style = cur_style;\r
+          mlist_penalties = false;\r
+          mlist_to_hlist();\r
+          cur_style = save_style;\r
+\r
+          {\r
+            if (cur_style < script_style)\r
+              cur_size = text_size;\r
+            else\r
+              cur_size = 16 * ((cur_style - text_style) / 2);\r
+\r
+            cur_mu = x_over_n(math_quad(cur_size), 18);\r
+          }\r
+\r
+          p = hpack(link(temp_head), 0, 1);\r
+        }\r
+        break;\r
+\r
+      default:\r
+        {\r
+          confusion("mlist2");\r
+          return;\r
+        }\r
+        break;\r
+    }\r
+  \r
+    new_hlist(q) = p;\r
+\r
+    if ((math_type(subscr(q)) == 0) && (math_type(supscr(q)) == 0))\r
+      goto check_dimensions;\r
+\r
+    make_scripts(q, delta);\r
+\r
+check_dimensions:\r
+    z = hpack(new_hlist(q), 0, 1);\r
+\r
+    if (height(z) > max_h)\r
+      max_h = height(z);\r
+\r
+    if (depth(z) > max_d)\r
+      max_d = depth(z);\r
+\r
+    free_node(z, box_node_size);\r
+\r
+done_with_noad:\r
+    r = q;\r
+    r_type = type(r);\r
+\r
+done_with_node:\r
+    q = link(q);\r
+  }\r
+\r
+  if (r_type == bin_noad)\r
+    type(r) = ord_noad;\r
+\r
+  p = temp_head;\r
+  link(p) = 0;\r
+  q = mlist;\r
+  r_type = 0;\r
+  cur_style = style;\r
+\r
+  {\r
+    if (cur_style < script_style)\r
+      cur_size = text_size;\r
+    else\r
+      cur_size = 16 *((cur_style - text_style) / 2);\r
+\r
+    cur_mu = x_over_n(math_quad(cur_size), 18);\r
+  }\r
+\r
+  while (q != 0)\r
+  {\r
+    t = ord_noad;\r
+    s = noad_size;\r
+    pen = inf_penalty;\r
+\r
+    switch (type(q))\r
+    {\r
+      case op_noad:\r
+      case open_noad:\r
+      case close_noad:\r
+      case punct_noad:\r
+      case inner_noad:\r
+        t = type(q);\r
+        break;\r
+\r
+      case bin_noad:\r
+        {\r
+          t = bin_noad;\r
+          pen = bin_op_penalty;\r
+        }\r
+        break;\r
+\r
+      case rel_noad:\r
+        {\r
+          t = rel_noad;\r
+          pen = rel_penalty;\r
+        }\r
+        break;\r
+\r
+      case ord_noad:\r
+      case vcenter_noad:\r
+      case over_noad:\r
+      case under_noad:\r
+        do_nothing();\r
+        break;\r
+\r
+      case radical_noad:\r
+        s = radical_noad_size;\r
+        break;\r
+\r
+      case accent_noad:\r
+        s = accent_noad_size;\r
+        break;\r
+\r
+      case fraction_noad:\r
+        {\r
+          t = inner_noad;\r
+          s = fraction_noad_size;\r
+        }\r
+        break;\r
+\r
+      case left_noad:\r
+      case right_noad:\r
+        t = make_left_right(q, style, max_d, max_h);\r
+        break;\r
+\r
+      case style_node:\r
+        {\r
+          cur_style = subtype(q);\r
+          s = style_node_size;\r
+\r
+          {\r
+            if (cur_style < script_style)\r
+              cur_size = text_size;\r
+            else\r
+              cur_size = 16 *((cur_style - text_style) / 2);\r
+\r
+            cur_mu = x_over_n(math_quad(cur_size), 18);\r
+          }\r
+\r
+          goto delete_q;\r
+        }\r
+        break;\r
+\r
+      case whatsit_node:\r
+      case penalty_node:\r
+      case rule_node:\r
+      case disc_node:\r
+      case adjust_node:\r
+      case ins_node:\r
+      case mark_node:\r
+      case glue_node:\r
+      case kern_node:\r
+        {\r
+          link(p) = q;\r
+          p = q;\r
+          q = link(q);\r
+          link(p) = 0;\r
+          goto done;\r
+        }\r
+        break;\r
+\r
+      default:\r
+        {\r
+          confusion("mlist3");\r
+          return;\r
+        }\r
+        break;\r
+    }\r
+\r
+    if (r_type > 0)\r
+    {\r
+      switch (str_pool[r_type * 8 + t + magic_offset])\r
+      {\r
+        case '0':\r
+          x = 0;\r
+          break;\r
+\r
+        case '1':\r
+          if (cur_style < script_style)\r
+            x = thin_mu_skip_code;\r
+          else\r
+            x = 0;\r
+          break;\r
+\r
+        case '2':\r
+          x = thin_mu_skip_code;\r
+          break;\r
+\r
+        case '3':\r
+          if (cur_style < script_style)\r
+            x = med_mu_skip_code;\r
+          else\r
+            x = 0;\r
+          break;\r
+\r
+        case '4':\r
+          if (cur_style < script_style)\r
+            x = thick_mu_skip_code;\r
+          else\r
+            x = 0;\r
+          break;\r
+\r
+        default:\r
+          {\r
+            confusion("mlist4");\r
+            return;\r
+          }\r
+          break;\r
+      }\r
+\r
+      if (x != 0)\r
+      {\r
+        y = math_glue(glue_par(x), cur_mu);\r
+        z = new_glue(y);\r
+        glue_ref_count(y) = 0;\r
+        link(p) = z;\r
+        p = z;\r
+        subtype(z) = x + 1;\r
+      }\r
+    }\r
+\r
+    if (new_hlist(q) != 0)\r
+    {\r
+      link(p) = new_hlist(q);\r
+\r
+      do\r
+        {\r
+          p = link(p);\r
+        }\r
+      while (!(link(p) == 0));\r
+    }\r
+\r
+    if (penalties)\r
+      if (link(q) != 0)\r
+        if (pen < inf_penalty)\r
+        {\r
+          r_type = type(link(q));\r
+\r
+          if (r_type != penalty_node)\r
+            if (r_type != rel_noad)\r
+            {\r
+              z = new_penalty(pen);\r
+              link(p) = z;\r
+              p = z;\r
+            }\r
+        }\r
+\r
+    r_type = t;\r
+\r
+delete_q:\r
+    r = q;\r
+    q = link(q);\r
+    free_node(r, s);\r
+done:;\r
+  }\r
+}\r
+/* sec 0772 */\r
+void push_alignment (void)\r
+{\r
+  pointer p;\r
+\r
+  p = get_node(align_stack_node_size);\r
+  link(p) = align_ptr;\r
+  info(p) = cur_align;\r
+  llink(p) = preamble;\r
+  rlink(p) = cur_span;\r
+  mem[p + 2].cint = cur_loop;\r
+  mem[p + 3].cint = align_state;\r
+  info(p + 4) = cur_head;\r
+  link(p + 4) = cur_tail;\r
+  align_ptr = p;\r
+  cur_head = get_avail();\r
+}\r
+/* sec 0772 */\r
+void pop_alignment (void)\r
+{\r
+  pointer p;\r
+\r
+  free_avail(cur_head);\r
+  p = align_ptr;\r
+  cur_tail = link(p + 4);\r
+  cur_head = info(p + 4);\r
+  align_state = mem[p + 3].cint;\r
+  cur_loop = mem[p + 2].cint;\r
+  cur_span = rlink(p);\r
+  preamble = llink(p);\r
+  cur_align = info(p);\r
+  align_ptr = link(p);\r
+  free_node(p, align_stack_node_size);\r
+}\r
+/* sec 0782 */\r
+void get_preamble_token (void)\r
+{\r
+restart:\r
+  get_token();\r
+\r
+  while ((cur_chr == span_code) && (cur_cmd == tab_mark))\r
+  {\r
+    get_token();\r
+\r
+    if (cur_cmd > max_command)\r
+    {\r
+      expand();\r
+      get_token();\r
+    }\r
+  }\r
+\r
+  if (cur_cmd == endv)\r
+  {\r
+    fatal_error("(interwoven alignment preambles are not allowed)");\r
+    return;\r
+  }\r
+\r
+  if ((cur_cmd == assign_glue) && (cur_chr == glue_base + tab_skip_code))\r
+  {\r
+    scan_optional_equals();\r
+    scan_glue(glue_val);\r
+\r
+    if (global_defs > 0)\r
+      geq_define(glue_base + tab_skip_code, glue_ref, cur_val);\r
+    else\r
+      eq_define(glue_base + tab_skip_code, glue_ref, cur_val);\r
+\r
+    goto restart;\r
+  }\r
+}\r
+/* sec 0774 */\r
+void init_align (void)\r
+{\r
+  pointer save_cs_ptr;\r
+  pointer p;\r
+\r
+  save_cs_ptr = cur_cs;\r
+  push_alignment();\r
+  align_state = -1000000L;\r
+\r
+  if ((mode == mmode) && ((tail != head) || (incompleat_noad != 0)))\r
+  {\r
+    print_err("Improper ");\r
+    print_esc("halign");\r
+    prints(" inside $$'s");\r
+    help3("Displays can use special alignments (like \\eqalignno)",\r
+        "only if nothing but the alignment itself is between $$'s.",\r
+        "So I've deleted the formulas that preceded this alignment.");\r
+    error();\r
+    flush_math();\r
+  }\r
+\r
+  push_nest();\r
+\r
+  if (mode == mmode)\r
+  {\r
+    mode = -vmode;\r
+    prev_depth = nest[nest_ptr - 2].aux_field.cint;\r
+  }\r
+  else if (mode > 0)\r
+    mode = - (integer) mode;\r
+\r
+  scan_spec(align_group, false);\r
+  preamble = 0;\r
+  cur_align = align_head;\r
+  cur_loop = 0;\r
+  scanner_status = aligning;\r
+  warning_index = save_cs_ptr;\r
+  align_state = -1000000L;\r
+\r
+  while (true)\r
+  {\r
+    link(cur_align) = new_param_glue(tab_skip_code);\r
+    cur_align = link(cur_align);\r
+\r
+    if (cur_cmd == car_ret)\r
+      goto done;\r
+\r
+    p = hold_head;\r
+    link(p) = 0;\r
+\r
+    while (true)\r
+    {\r
+      get_preamble_token();\r
+\r
+      if (cur_cmd == mac_param)\r
+        goto done1;\r
+\r
+      if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))\r
+        if ((p == hold_head) && (cur_loop == 0) && (cur_cmd == tab_mark))\r
+          cur_loop = cur_align;\r
+        else\r
+        {\r
+          print_err("Missing # inserted in alignment preamble");\r
+          help3("There should be exactly one # between &'s, when an",\r
+              "\\halign or \\valign is being set up. In this case you had",\r
+              "none, so I've put one in; maybe that will work.");\r
+          back_error();\r
+          goto done1;\r
+        }\r
+      else if ((cur_cmd != spacer) || (p != hold_head))\r
+      {\r
+        link(p) = get_avail();\r
+        p = link(p);\r
+        info(p) = cur_tok;\r
+      }\r
+    }\r
+\r
+done1:\r
+    link(cur_align) = new_null_box();\r
+    cur_align = link(cur_align);\r
+    info(cur_align) = end_span;\r
+    width(cur_align) = null_flag;\r
+    u_part(cur_align) = link(hold_head);\r
+    p = hold_head;\r
+    link(p) = 0;\r
+\r
+    while (true)\r
+    {\r
+continu:\r
+      get_preamble_token();\r
+\r
+      if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))\r
+        goto done2;\r
+\r
+      if (cur_cmd == mac_param)\r
+      {\r
+        print_err("Only one # is allowed per tab");\r
+        help3("There should be exactly one # between &'s, when an",\r
+            "\\halign or \\valign is being set up. In this case you had",\r
+            "more than one, so I'm ignoring all but the first.");\r
+        error();\r
+        goto continu;\r
+      }\r
+\r
+      link(p) = get_avail();\r
+      p = link(p);\r
+      info(p) = cur_tok;\r
+    }\r
+\r
+done2:\r
+    link(p) = get_avail();\r
+    p = link(p);\r
+    info(p) = end_template_token;\r
+    v_part(cur_align) = link(hold_head);\r
+  }\r
+\r
+done:\r
+  scanner_status = 0;\r
+  new_save_level(align_group);\r
+\r
+  if (every_cr != 0)\r
+    begin_token_list(every_cr, every_cr_text);\r
+\r
+  align_peek();\r
+}\r
+/* sec 0787 */\r
+void init_span (pointer p)\r
+{\r
+  push_nest();\r
+\r
+  if (mode == -hmode)\r
+    space_factor = 1000;\r
+  else\r
+  {\r
+    prev_depth = ignore_depth;\r
+    normal_paragraph();\r
+  }\r
+\r
+  cur_span = p;\r
+}\r
+/* sec 0786 */\r
+void init_row (void)\r
+{\r
+  push_nest();\r
+\r
+  mode = (-hmode - vmode) - mode;\r
+\r
+  if (mode == -hmode)\r
+    space_factor = 0;\r
+  else\r
+    prev_depth = 0;\r
+\r
+  tail_append(new_glue(glue_ptr(preamble)));\r
+  subtype(tail) = tab_skip_code + 1;\r
+  cur_align = link(preamble);\r
+  cur_tail = cur_head;\r
+  init_span(cur_align);\r
+}\r
+/* sec 0788 */\r
+void init_col (void)\r
+{\r
+  extra_info(cur_align) = cur_cmd;\r
+\r
+  if (cur_cmd == omit)\r
+    align_state = 0;\r
+  else\r
+  {\r
+    back_input();\r
+    begin_token_list(u_part(cur_align), u_template);\r
+  }\r
+}\r
+/* sec 0799 */\r
+void fin_row (void)\r
+{\r
+  pointer p;\r
+\r
+  if (mode == -hmode)\r
+  {\r
+    p = hpack(link(head), 0, 1);\r
+    pop_nest();\r
+    append_to_vlist(p);\r
+\r
+    if (cur_head != cur_tail)\r
+    {\r
+      link(tail) = link(cur_head);\r
+      tail = cur_tail;\r
+    }\r
+  }\r
+  else\r
+  {\r
+    p = vpackage(link(head), 0, 1, max_dimen);\r
+    pop_nest();\r
+    link(tail) = p;\r
+    tail = p;\r
+    space_factor = 1000;\r
+  }\r
+\r
+  type(p) = unset_node;\r
+  glue_stretch(p) = 0;\r
+\r
+  if (every_cr != 0)\r
+    begin_token_list(every_cr, every_cr_text);\r
+\r
+  align_peek();\r
+}\r
+/* sec 0800 */\r
+void fin_align (void)\r
+{\r
+  pointer p, q, r, s, u, v;\r
+  scaled t, w;\r
+  scaled o;\r
+  halfword n;\r
+  scaled rule_save;\r
+  memory_word aux_save;\r
+\r
+  if (cur_group != align_group)\r
+  {\r
+    confusion("align1");\r
+    return;\r
+  }\r
+\r
+  unsave();\r
+\r
+  if (cur_group != align_group)\r
+  {\r
+    confusion("align0");\r
+    return;\r
+  }\r
+\r
+  unsave();\r
+\r
+  if (nest[nest_ptr - 1].mode_field == mmode)\r
+    o = display_indent;\r
+  else\r
+    o = 0;\r
+\r
+  q = link(preamble);\r
+\r
+  do\r
+    {\r
+      flush_list(u_part(q));\r
+      flush_list(v_part(q));\r
+      p = link(link(q));\r
+\r
+      if (width(q) == null_flag)\r
+      {\r
+        width(q) = 0;\r
+        r = link(q);\r
+        s = glue_ptr(r);\r
+\r
+        if (s != zero_glue)\r
+        {\r
+          add_glue_ref(zero_glue);\r
+          delete_glue_ref(s);\r
+          glue_ptr(c) = zero_glue;\r
+        }\r
+      }\r
+\r
+      if (info(q) != end_span)\r
+      {\r
+        t = width(q) + width(glue_ptr(link(q)));\r
+        r = info(q);\r
+        s = end_span;\r
+        info(s) = p;\r
+        n = min_quarterword + 1;\r
+\r
+        do\r
+          {\r
+            width(r) = width(r) - t;\r
+            u = info(r);\r
+\r
+            while (link(r) > n)\r
+            {\r
+              s = info(s);\r
+              n = link(info(s)) + 1;\r
+            }\r
+\r
+            if (link(r) < n)\r
+            {\r
+              info(r) = info(s);\r
+              info(s) = r;\r
+              decr(link(r));\r
+              s = r;\r
+            }\r
+            else\r
+            {\r
+              if (width(r) > width(info(s)))\r
+                width(info(s)) = width(r);\r
+\r
+              free_node(r, span_node_size);\r
+            }\r
+\r
+            r = u;\r
+          }\r
+        while (!(r == end_span));\r
+      }\r
+\r
+      type(q) = unset_node;\r
+      span_count(q) = min_quarterword;\r
+      height(q) = 0;\r
+      depth(q) = 0;\r
+      glue_order(q) = normal;\r
+      glue_sign(q) = normal;\r
+      glue_stretch(q) = 0;\r
+      glue_shrink(q) = 0;\r
+      q = p;\r
+    }\r
+  while (!(q == 0));\r
+\r
+  save_ptr = save_ptr - 2;\r
+  pack_begin_line = - (integer) mode_line;\r
+\r
+  if (mode == -vmode)\r
+  {\r
+    rule_save = overfull_rule;\r
+    overfull_rule = 0;\r
+    p = hpack(preamble, saved(1), saved(0));\r
+    overfull_rule = rule_save;\r
+  }\r
+  else\r
+  {\r
+    q = link(preamble);\r
+\r
+    do\r
+      {\r
+        height(q) = width(q);\r
+        width(q) = 0;\r
+        q = link(link(q));\r
+      }\r
+    while (!(q == 0));\r
+\r
+    p = vpackage(preamble, saved(1), saved(0), max_dimen);\r
+    q = link(preamble);\r
+\r
+    do\r
+      {\r
+        width(q) = height(q);\r
+        height(q) = 0;\r
+        q = link(link(q));\r
+      }\r
+    while (!(q == 0));\r
+  }\r
+\r
+  pack_begin_line = 0;\r
+  q = link(head);\r
+  s = head;\r
+\r
+  while (q != 0)\r
+  {\r
+    if (!is_char_node(q))\r
+      if (type(q) == unset_node)\r
+      {\r
+        if (mode == -vmode)\r
+        {\r
+          type(q) = hlist_node;\r
+          width(q) = width(p);\r
+        }\r
+        else\r
+        {\r
+          type(q) = vlist_node;\r
+          height(q) = height(p);\r
+        }\r
+\r
+        glue_order(q) = glue_order(p);\r
+        glue_sign(q) = glue_sign(p);\r
+        glue_set(q) = glue_set(p);\r
+        shift_amount(q) = o;\r
+        r = link(list_ptr(q));\r
+        s = link(list_ptr(p));\r
+\r
+        do\r
+          {\r
+            n = span_count(r);\r
+            t = width(s);\r
+            w = t;\r
+            u = hold_head;\r
+\r
+            while (n > min_quarterword)\r
+            {\r
+              decr(n);\r
+              s = link(s);\r
+              v = glue_ptr(s);\r
+              link(u) = new_glue(v);\r
+              u = link(u);\r
+              subtype(u) = tab_skip_code + 1;\r
+              t = t + width(v);\r
+\r
+              if (glue_sign(p) == stretching)\r
+              {\r
+                if (stretch_order(v) == glue_order(p))\r
+                  t = t + round(glue_set(p) * stretch(v));\r
+              }\r
+              else if (glue_sign(p) == shrinking)\r
+              {\r
+                if (shrink_order(v) == glue_order(p))\r
+                  t = t - round(glue_set(p) * shrink(v));\r
+              }\r
+\r
+              s = link(s);\r
+              link(u) = new_null_box();\r
+              u = link(u);\r
+              t = t + width(s);\r
+\r
+              if (mode == -vmode)\r
+                width(u) = width(s);\r
+              else\r
+              {\r
+                type(u) = vlist_node;\r
+                height(u) = width(s);\r
+              }\r
+            }\r
+            \r
+\r
+            if (mode == -vmode)\r
+            {\r
+              height(r) = height(q);\r
+              depth(r) = depth(q);\r
+\r
+              if (t == width(r))\r
+              {\r
+                glue_sign(r) = normal;\r
+                glue_order(r) = normal;\r
+                glue_set(r) = 0.0;\r
+              }\r
+              else if (t > width(r))\r
+              {\r
+                glue_sign(r) = stretching;\r
+\r
+                if (glue_stretch(r) == 0)\r
+                  glue_set(r) = 0.0;\r
+                else\r
+                  glue_set(r) = (t - width(r)) / ((double) glue_stretch(r));\r
+              }\r
+              else\r
+              {\r
+                glue_order(r) = glue_sign(r);\r
+                glue_sign(r) = shrinking;\r
+\r
+                if (glue_shrink(r) == 0)\r
+                  glue_set(r) = 0.0;\r
+                else if ((glue_order(r) == normal) && (width(r) - t > glue_shrink(r)))\r
+                  glue_set(r) = 1.0;\r
+                else\r
+                  glue_set(r) = (width(r) - t)/ ((double) glue_shrink(r));\r
+              }\r
+\r
+              width(r) = w;\r
+              type(r) = hlist_node;\r
+            }\r
+            else\r
+            {\r
+              width(r) = width(q);\r
+\r
+              if (t == height(r))\r
+              {\r
+                glue_sign(r) = normal;\r
+                glue_order(r) = normal;\r
+                glue_set(r) = 0.0;\r
+              }\r
+              else if (t > height(r))\r
+              {\r
+                glue_sign(r) = stretching;\r
+\r
+                if (glue_stretch(r) == 0)\r
+                  glue_set(r) = 0.0;\r
+                else\r
+                  glue_set(r) = (t - height(r)) / ((double) glue_stretch(r));\r
+              }\r
+              else\r
+              {\r
+                glue_order(r) = glue_sign(r);\r
+                glue_sign(r) = shrinking;\r
+\r
+                if (glue_shrink(r) == 0)\r
+                  glue_set(r) = 0.0;\r
+                else if ((glue_order(r) == normal) && (height(r) - t > glue_shrink(r)))\r
+                  glue_set(r) = 1.0;\r
+                else\r
+                  glue_set(r) = (height(r) - t) / ((double) glue_shrink(r));\r
+              }\r
+\r
+              height(r) = w;\r
+              type(r) = vlist_node;\r
+            }\r
+\r
+            shift_amount(r) = 0;\r
+\r
+            if (u != hold_head)\r
+            {\r
+              link(u) = link(r);\r
+              link(r) = link(hold_head);\r
+              r = u;\r
+            }\r
+\r
+            r = link(link(r));\r
+            s = link(link(s));\r
+          }\r
+        while (!(r == 0));\r
+      }\r
+      else if (type(q) == rule_node)\r
+      {\r
+        if (is_running(width(q)))\r
+          width(q) = width(p);\r
+\r
+        if (is_running(height(q)))\r
+          height(q) = height(p);\r
+\r
+        if (is_running(depth(q)))\r
+          depth(q) = depth(p);\r
+\r
+        if (o != 0)\r
+        {\r
+          r = link(q);\r
+          link(q) = 0;\r
+          q = hpack(q, 0, 1);\r
+          shift_amount(q) = o;\r
+          link(q) = r;\r
+          link(s) = q;\r
+        }\r
+      }\r
+    s = q;\r
+    q = link(q);\r
+  }\r
+\r
+  flush_node_list(p);\r
+  pop_alignment();\r
+  aux_save = cur_list.aux_field;\r
+  p = link(head);\r
+  q = tail;\r
+  pop_nest();\r
+\r
+  if (mode == mmode)\r
+  {\r
+    do_assignments();\r
+\r
+    if (cur_cmd != math_shift)\r
+    {\r
+      print_err("Missing $$ inserted");\r
+      help2("Displays can use special alignments (like \\eqalignno)",\r
+          "only if nothing but the alignment itself is between $$'s.");\r
+      back_error();\r
+    }\r
+    else\r
+    {\r
+      get_x_token();\r
+\r
+      if (cur_cmd != math_shift)\r
+      {\r
+        print_err("Display math should end with $$");\r
+        help2("The `$' that I just saw supposedly matches a previous `$$'.",\r
+            "So I shall assume that you typed `$$' both times.");\r
+        back_error();\r
+      }\r
+    }\r
+\r
+    pop_nest();\r
+    tail_append(new_penalty(pre_display_penalty));\r
+    tail_append(new_param_glue(above_display_skip_code));\r
+    link(tail) = p;\r
+\r
+    if (p != 0)\r
+      tail = q;\r
+\r
+    tail_append(new_penalty(post_display_penalty));\r
+    tail_append(new_param_glue(below_display_skip_code));\r
+    prev_depth = aux_save.cint;\r
+    resume_after_display();\r
+  }\r
+  else\r
+  {\r
+    cur_list.aux_field = aux_save;\r
+    link(tail) = p;\r
+\r
+    if (p != 0)\r
+      tail = q;\r
+\r
+    if (mode == vmode)\r
+      build_page();\r
+  }\r
+}\r
+/* sec 0791 */\r
+boolean fin_col (void)\r
+{\r
+  pointer p;\r
+  pointer q, r;\r
+  pointer s;\r
+  pointer u;\r
+  scaled w;\r
+  glue_ord o;\r
+  halfword n;\r
+\r
+  if (cur_align == 0)\r
+  {\r
+    confusion("endv");\r
+    return 0;\r
+  }\r
+\r
+  q = link(cur_align);\r
+\r
+  if (q == 0)\r
+  {\r
+    confusion("endv");\r
+    return 0;\r
+  }\r
+\r
+  if (align_state < 500000L)\r
+  {\r
+    fatal_error("(interwoven alignment preambles are not allowed)");\r
+    return 0;\r
+  }\r
+\r
+  p = link(q);\r
+\r
+  if ((p == 0) && (extra_info(cur_align) < cr_code))\r
+    if (cur_loop != 0)\r
+    {\r
+      link(q) = new_null_box();\r
+      p = link(q);\r
+      info(p) = end_span;\r
+      width(p) = null_flag;\r
+      cur_loop = link(cur_loop);\r
+      q = hold_head;\r
+      r = u_part(cur_loop);\r
+\r
+      while (r != 0)\r
+      {\r
+        link(q) = get_avail();\r
+        q = link(q);\r
+        info(q) = info(r);\r
+        r = link(r);\r
+      }\r
+\r
+      link(q) = 0;\r
+      u_part(p) = link(hold_head);\r
+      q = hold_head;\r
+      r = v_part(cur_loop);\r
+\r
+      while (r != 0)\r
+      {\r
+        link(q) = get_avail();\r
+        q = link(q);\r
+        info(q) = info(r);\r
+        r = link(r);\r
+      }\r
+\r
+      link(q) = 0;\r
+      v_part(p) = link(hold_head);\r
+      cur_loop = link(cur_loop);\r
+      link(p) = new_glue(glue_ptr(cur_loop));\r
+    }\r
+    else\r
+    {\r
+      print_err("Extra alignment tab has been changed to ");\r
+      print_esc("cr");\r
+      help3("You have given more \\span or & marks than there were",\r
+          "in the preamble to the \\halign or \\valign now in progress.",\r
+          "So I'll assume that you meant to type \\cr instead.");\r
+      extra_info(cur_align) = cr_code;\r
+      error();\r
+    }\r
+\r
+  if (extra_info(cur_align) != span_code)\r
+  {\r
+    unsave();\r
+    new_save_level(align_group);\r
+\r
+    {\r
+      if (mode == -hmode)\r
+      {\r
+        adjust_tail = cur_tail;\r
+        u = hpack(link(head), 0, 1);\r
+        w = width(u);\r
+        cur_tail = adjust_tail;\r
+        adjust_tail = 0;\r
+      }\r
+      else\r
+      {\r
+        u = vpackage(link(head), 0, 1, 0);\r
+        w = height(u);\r
+      }\r
+\r
+      n = min_quarterword;\r
+\r
+      if (cur_span != cur_align)\r
+      {\r
+        q = cur_span;\r
+\r
+        do\r
+          {\r
+            incr(n);\r
+            q = link(link(q));\r
+          }\r
+        while (!(q == cur_align));\r
+\r
+        if (n > max_quarterword)\r
+        {\r
+          confusion("256 spans");\r
+          return 0;\r
+        }\r
+\r
+        q = cur_span;\r
+\r
+        while (link(info(q)) < n)\r
+          q = info(q);\r
+\r
+        if (link(info(q)) > n)\r
+        {\r
+          s = get_node(span_node_size);\r
+          info(s) = info(q);\r
+          link(s) = n;\r
+          info(q) = s;\r
+          width(s) = w;\r
+        }\r
+        else if (width(info(q)) < w)\r
+          width(info(q)) = w;\r
+      }\r
+      else if (w > width(cur_align))\r
+        width(cur_align) = w;\r
+\r
+      type(u) = unset_node;\r
+      span_count(u) = n;\r
+\r
+      if (total_stretch[filll] != 0)\r
+        o = filll;\r
+      else if (total_stretch[fill] != 0)\r
+        o = fill;\r
+      else if (total_stretch[fil] != 0)\r
+        o = fil;\r
+      else\r
+        o = normal;\r
+\r
+      glue_order(u) = o;\r
+      glue_stretch(u) = total_stretch[o];\r
+\r
+      if (total_shrink[filll] != 0)\r
+        o = filll;\r
+      else if (total_shrink[fill] != 0)\r
+        o = fill;\r
+      else if (total_shrink[fil] != 0)\r
+        o = fil;\r
+      else\r
+        o = normal;\r
+\r
+      glue_sign(u) = o;\r
+      glue_shrink(u) = total_shrink[o];\r
+      pop_nest();\r
+      link(tail) = u;\r
+      tail = u;\r
+    }\r
+\r
+    tail_append(new_glue(glue_ptr(link(cur_align))));\r
+    subtype(tail) = tab_skip_code + 1;\r
+\r
+    if (extra_info(cur_align) >= cr_code)\r
+    {\r
+      return true;\r
+    }\r
+\r
+    init_span(p);\r
+  }\r
+\r
+  align_state = 1000000L;\r
+\r
+  do\r
+    {\r
+      get_x_token();\r
+    }\r
+  while (!(cur_cmd != spacer));\r
+\r
+  cur_align = p;\r
+  init_col();\r
+\r
+  return false;\r
+}\r
+/* sec 0749 */\r
+scaled make_op (pointer q)\r
+{\r
+  scaled delta;\r
+  pointer p, v, x, y, z;\r
+  quarterword c;\r
+  four_quarters i;\r
+  scaled shift_up, shift_down;\r
+\r
+  if ((subtype(q) == normal) && (cur_style < text_style))\r
+    subtype(q) = limits;\r
+\r
+  if (math_type(nucleus(q)) == math_char)\r
+  {\r
+    fetch(nucleus(q));\r
+\r
+    if ((cur_style < text_style) && (char_tag(cur_i) == list_tag))\r
+    {\r
+      c = rem_byte(cur_i);\r
+      i = char_info(cur_f, c);\r
+\r
+      if (char_exists(i))\r
+      {\r
+        cur_c = c;\r
+        cur_i = i;\r
+        character(nucleus(q)) = c;\r
+      }\r
+    }\r
+\r
+    delta = char_italic(cur_f, cur_i);\r
+    x = clean_box(nucleus(q), cur_style);\r
+\r
+    if ((math_type(subscr(q)) != 0) && (subtype(q) != limits))\r
+      width(x) = width(x) - delta;\r
+\r
+    shift_amount(x) = half(height(x) - depth(x)) - axis_height(cur_size);\r
+    math_type(nucleus(q)) = sub_box;\r
+    info(nucleus(q)) = x;\r
+  }\r
+  else\r
+    delta = 0;\r
+\r
+  if (subtype(q) == limits)\r
+  {\r
+    x = clean_box(supscr(q), sup_style(cur_style));\r
+    y = clean_box(nucleus(q), cur_style);\r
+    z = clean_box(subscr(q), sub_style(cur_style));\r
+    v = new_null_box();\r
+    type(v) = vlist_node;\r
+    width(v) = width(y);\r
+\r
+    if (width(x) > width(v))\r
+      width(v) = width(x);\r
+\r
+    if (width(z) > width(v))\r
+      width(v) = width(z);\r
+\r
+    x = rebox(x, width(v));\r
+    y = rebox(y, width(v));\r
+    z = rebox(z, width(v));\r
+    shift_amount(x) = half(delta);\r
+    shift_amount(z) = - (integer) shift_amount(x);\r
+    height(v) = height(y);\r
+    depth(v) = depth(y);\r
+\r
+    if (math_type(supscr(q)) == 0)\r
+    {\r
+      free_node(x, box_node_size);\r
+      list_ptr(v) = y;\r
+    }\r
+    else\r
+    {\r
+      shift_up = big_op_spacing3 - depth(x);\r
+\r
+      if (shift_up < big_op_spacing1)\r
+        shift_up = big_op_spacing1;\r
+\r
+      p = new_kern(shift_up);\r
+      link(p) = y;\r
+      link(x) = p;\r
+      p = new_kern(big_op_spacing5);\r
+      link(p) = x;\r
+      list_ptr(v) = p;\r
+      height(v) = height(v) + big_op_spacing5 + height(x) + depth(x) + shift_up;\r
+    }\r
+\r
+    if (math_type(subscr(q)) == 0)\r
+      free_node(z, box_node_size);\r
+    else\r
+    {\r
+      shift_down = big_op_spacing4 - height(z);\r
+\r
+      if (shift_down < big_op_spacing2)\r
+        shift_down = big_op_spacing2;\r
+\r
+      p = new_kern(shift_down);\r
+      link(y) = p;\r
+      link(p) = z;\r
+      p = new_kern(big_op_spacing5);\r
+      link(z) = p;\r
+      depth(v) = depth(v) + big_op_spacing5 + height(z) + depth(z) + shift_down;\r
+    }\r
+\r
+    new_hlist(q) = v;\r
+  }\r
+\r
+  return delta;\r
+}\r
+/* sec 0756 */\r
+void make_scripts (pointer q, scaled delta)\r
+{\r
+  pointer p, x, y, z;\r
+  scaled shift_up, shift_down, clr;\r
+  small_number t;\r
+\r
+  p = new_hlist(q);\r
+\r
+  if (is_char_node(p))\r
+  {\r
+    shift_up = 0;\r
+    shift_down = 0;\r
+  }\r
+  else\r
+  {\r
+    z = hpack(p, 0, 1);\r
+\r
+    if (cur_style < script_style)\r
+      t = script_size;\r
+    else\r
+      t = script_script_size;\r
+\r
+    shift_up = height(z) - sup_drop(t);\r
+    shift_down = depth(z) + sub_drop(t);\r
+    free_node(z, box_node_size);\r
+  }\r
+\r
+  if (math_type(supscr(q)) == 0)\r
+  {\r
+    x = clean_box(subscr(q), sub_style(cur_style));\r
+    width(x) = width(x) + script_space;\r
+\r
+    if (shift_down < sub1(cur_size))\r
+      shift_down = sub1(cur_size);\r
+\r
+    clr = height(x) -(abs(math_x_height(cur_size) * 4) / 5);\r
+\r
+    if (shift_down < clr)\r
+      shift_down = clr;\r
+\r
+    shift_amount(x) = shift_down;\r
+  }\r
+  else\r
+  {\r
+    {\r
+      x = clean_box(supscr(q), sup_style(cur_style));\r
+      width(x) = width(x) + script_space;\r
+\r
+      if (odd(cur_style))\r
+        clr = sup3(cur_size);\r
+      else if (cur_style < text_style)\r
+        clr = sup1(cur_size);\r
+      else\r
+        clr = sup2(cur_size);\r
+\r
+      if (shift_up < clr)\r
+        shift_up = clr;\r
+\r
+      clr = depth(x) +(abs(math_x_height(cur_size)) / 4);\r
+\r
+      if (shift_up < clr)\r
+        shift_up = clr;\r
+    }\r
+\r
+    if (math_type(subscr(q)) == 0)\r
+      shift_amount(x) = - (integer) shift_up;\r
+    else\r
+    {\r
+      y = clean_box(subscr(q), sub_style(cur_style));\r
+      width(y) = width(y) + script_space;\r
+\r
+      if (shift_down < sub2(cur_size))\r
+        shift_down = sub2(cur_size);\r
+\r
+      clr = 4 * default_rule_thickness - ((shift_up - depth(x)) - (height(y) - shift_down));\r
+\r
+      if (clr > 0)\r
+      {\r
+        shift_down = shift_down + clr;\r
+\r
+        clr = (abs(math_x_height(cur_size) * 4) / 5) - (shift_up - depth(x));\r
+\r
+        if (clr > 0)\r
+        {\r
+          shift_up = shift_up + clr;\r
+          shift_down = shift_down - clr;\r
+        }\r
+      }\r
+\r
+      shift_amount(x) = delta;\r
+      p = new_kern((shift_up - depth(x)) - (height(y) - shift_down));\r
+      link(x) = p;\r
+      link(p) = y;\r
+      x = vpackage(x, 0, 1, max_dimen);\r
+      shift_amount(x) = shift_down;\r
+    }\r
+  }\r
+\r
+  if (new_hlist(q) == 0)\r
+    new_hlist(q) = x;\r
+  else\r
+  {\r
+    p = new_hlist(q);\r
+\r
+    while (link(p) != 0)\r
+      p = link(p);\r
+\r
+    link(p) = x;\r
+  }\r
+}
\ No newline at end of file