Method: MaRuKu::Out::Latex#to_latex_table

Defined in:
lib/maruku/output/to_latex.rb

#to_latex_tableObject

[View source]

410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/maruku/output/to_latex.rb', line 410

def to_latex_table
  num_columns = self.align.size

  head, *rows = @children

  h = { :center => 'c' , :left => 'l' , :right => 'r'}
  align_string = self.align.map {|a| h[a] }.join('|')

  s = "\\begin{tabular}{#{align_string}}\n"

  s << array_to_latex(head, '&') + "\\\\" + "\n"

  s << "\\hline \n"

  rows.each do |row|
    s << array_to_latex(row, '&') + "\\\\" + "\n"
  end

  s << "\\end{tabular}"

  # puts table in its own paragraph
  s << "\n\n"
end