422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
|
# File 'lib/maruku/output/to_latex.rb', line 422
def to_latex_table
align = self.align
num_columns = align.size
head = @children.slice(0, num_columns)
rows = []
i = num_columns
while i<@children.size
rows << @children.slice(i, num_columns)
i+=num_columns
end
h = {:center=>'c',:left=>'l',:right=>'r'}
align_string = 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}"
s += "\n\n"
s
end
|