Пример #1
0
// This is \begin{tabular}. Should be in an environment (not necessarily)
void Parser::T_start_tabular (subtypes c)
{
  Istring x = the_names[c==zero_code ? np_tabular : np_tabular_star];
  if(the_stack.is_float())
    leave_v_mode();
  else if(the_stack.is_frame(np_fbox)) {}
  else
    leave_h_mode();
  hash_table.eval_let_local("par","@empty");
  the_stack.push1(x,np_table);
  the_stack.add_att_to_last(np_rend,np_inline);
  Xid id = the_stack.get_xid();
  if(c!=0) { // case of tabular*
    Token T = cur_tok;
    TokenList L = mac_arg();
    ScaledInt tab_width = dimen_from_list(T,L);
    if(!tab_width.null())
      id.add_attribute(the_names[np_tab_width],the_main->SH.find_scaled(tab_width));
    get_token();  // eat the relax
    if(!cur_cmd_chr.is_relax()) back_input();
  }
  {
    int pos = get_ctb_opt(false); // Lamport does not mention c, who cares
    if(pos) id.add_attribute(the_names[np_vpos], the_names[pos]);
  }
  new_array_object.run(id,true);
  the_stack.set_array_mode(); // Is the mode ok ?
  start_a_row(-1);
}
Пример #2
0
// If started is true, we have already started one
void Parser::start_a_cell(bool started)
{
  if(!started) {
    the_stack.push_pop_cell(push_only);
    push_level(bt_cell);
  }
  remove_initial_space_and_back_input();
  symcodes S = cur_cmd_chr.get_cmd();
  if(S==unimp_cmd && cur_cmd_chr.get_chr()==omit_code) {
    get_token();
    the_stack.mark_omit_cell();
  } else if(S==end_cmd) { // has to be \end{tabular}
    the_stack.mark_omit_cell();
  } else if(S==multicolumn_cmd) {
    the_stack.mark_omit_cell();
    get_token();
    unprocessed_xml.remove_last_space();
    Xid cid = the_stack.get_top_id();
    new_array_object.run(cid,false);
  } else {
    TokenList L= the_stack.get_u_or_v(true);
    back_input(L);
  }
}