Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created January 13, 2011 06:03
Show Gist options
  • Save takuma7/777471 to your computer and use it in GitHub Desktop.
Save takuma7/777471 to your computer and use it in GitHub Desktop.
line = STDIN.gets("\n\n")
tabular = line.split("\n")
#puts tabular
columnNum = tabular[0].split("\t").length
#puts columnNum
puts "\n\nResult:"
puts "\\begin{table}[htbp]\n\t\\caption{***}\n\t\\begin{center}\n\t\\begin{tabular}{#{"|"+"c|"*columnNum}}\\hline"
tabular.each do |row|
puts "\t" + row.gsub("\t", " & ") + " \\\\ \\hline"
end
puts "\t\\end{tabular}\n\t\\end{center}\n\t\\label{***}\n\\end{table}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment