@@ -107,6 +107,13 @@ def _mediawiki_row_with_attrs(separator, cell_values, colwidths, colaligns):
107
107
colsep = separator * 2
108
108
return (separator + colsep .join (values_with_attrs )).rstrip ()
109
109
110
+
111
+ def _latex_line_begin_tabular (colwidths , colaligns ):
112
+ alignment = { "left" : "l" , "right" : "r" , "center" : "c" , "decimal" : "r" }
113
+ tabular_columns_fmt = "" .join ([alignment [a ] for a in colaligns ])
114
+ return "\\ begin{tabular}{" + tabular_columns_fmt + "}\n \hline"
115
+
116
+
110
117
_table_formats = {"simple" :
111
118
TableFormat (lineabove = Line ("" , "-" , " " , "" ),
112
119
linebelowheader = Line ("" , "-" , " " , "" ),
@@ -164,8 +171,8 @@ def _mediawiki_row_with_attrs(separator, cell_values, colwidths, colaligns):
164
171
headerrow = partial (_mediawiki_row_with_attrs , "!" ),
165
172
datarow = partial (_mediawiki_row_with_attrs , "|" ),
166
173
padding = 0 , with_header_hide = None ),
167
- "latex" : # TODO: row alignment
168
- TableFormat (lineabove = Line ( " \\ begin{tabular}{r" , "" , "r" , "} \n \hline" ) ,
174
+ "latex" :
175
+ TableFormat (lineabove = _latex_line_begin_tabular ,
169
176
linebelowheader = Line ("\\ hline" , "" , "" , "" ),
170
177
linebetweenrows = None ,
171
178
linebelow = Line ("\\ hline\n \\ end{tabular}" , "" , "" , "" ),
0 commit comments