remove center and clean tabular_latex for Dataset

This commit is contained in:
Benjamin Bertrand 2016-01-09 13:20:20 +03:00
parent 03e304ac43
commit 0180f5a37f

View File

@ -316,10 +316,7 @@ On a ainsi $Q_{q} = {val_q}$
return latex
def tabular_latex(self, nbr_lines = 1):
""" Renvoie le code latex pour afficher le tableau
:return : le code latex pour afficher le tableau
"""
""" Latex code to display dataset as a tabular """
d_per_line = self.effectif_total() // nbr_lines
d_last_line = self.effectif_total() % d_per_line
splited_data = [self[x:x+d_per_line] for x in range(0, self.effectif_total(), d_per_line)]
@ -328,14 +325,14 @@ On a ainsi $Q_{q} = {val_q}$
splited_data[-1] += [' ']*(d_per_line - d_last_line)
# Construction du tableau
latex = "\\begin{{center}} \n \t \\begin{{tabular}}{{|c|*{{{nbr_col}}}{{c|}}}} \n".format(nbr_col = d_per_line)
latex = "\\begin{{tabular}}{{|c|*{{{nbr_col}}}{{c|}}}} \n".format(nbr_col = d_per_line)
latex += "\t\t \hline \n"
d_lines = [' & '.join(map(str,l)) for l in splited_data]
latex += " \\\\ \n \\hline \n".join(d_lines)
latex += " \\\\ \n \\hline \n"
latex += "\t \\end{tabular} \n \\end{center}"
latex += "\\end{tabular}"
return latex