diff --git a/source/lib/JMSLab/tablefill.py b/source/lib/JMSLab/tablefill.py index 05dfce6..3346d76 100644 --- a/source/lib/JMSLab/tablefill.py +++ b/source/lib/JMSLab/tablefill.py @@ -101,7 +101,7 @@ def insert_tables_lyx(args, tables): while search_table is True: i += 1 if re.match('^.*###', lyx_text[i]): - lyx_text[i] = lyx_text[i].replace('###', tables[tag][entry_count]) + lyx_text[i] = lyx_text[i].replace('###', ToUnicodeMinus(tables[tag][entry_count])) entry_count += 1 elif re.match(r'^.*#\d+#', lyx_text[i]) or re.match(r'^.*#\d+,#', lyx_text[i]): @@ -112,7 +112,7 @@ def insert_tables_lyx(args, tables): rounded_entry = round_entry(entry_tag, tables[tag][entry_count]) if re.match(r'^.*#\d+,#', lyx_text[i]): rounded_entry = insert_commas(rounded_entry) - lyx_text[i] = lyx_text[i].replace('#' + entry_tag + '#', rounded_entry) + lyx_text[i] = lyx_text[i].replace('#' + entry_tag + '#', ToUnicodeMinus(rounded_entry)) entry_count += 1 elif lyx_text[i] == '\n': @@ -137,7 +137,7 @@ def insert_tables_latex(args, tables): lyx_text_i = lyx_text[i].split("&") for col in range(len(lyx_text_i)): if re.match('^.*###', lyx_text_i[col]): - lyx_text_i[col] = lyx_text_i[col].replace('###', tables[tag][entry_count]) + lyx_text_i[col] = lyx_text_i[col].replace('###', ToUnicodeMinus(tables[tag][entry_count])) entry_count += 1 elif re.match(r'^.*#\d+#', lyx_text_i[col]) or re.match(r'^.*#\d+,#', lyx_text_i[col]): @@ -148,7 +148,7 @@ def insert_tables_latex(args, tables): rounded_entry = round_entry(entry_tag, tables[tag][entry_count]) if re.match(r'^.*#\d+,#', lyx_text_i[col]): rounded_entry = insert_commas(rounded_entry) - lyx_text_i[col] = lyx_text_i[col].replace('#' + entry_tag + '#', rounded_entry) + lyx_text_i[col] = lyx_text_i[col].replace('#' + entry_tag + '#', ToUnicodeMinus(rounded_entry)) entry_count += 1 lyx_text[i] = "&".join(lyx_text_i) @@ -157,6 +157,10 @@ def insert_tables_latex(args, tables): return lyx_text +def ToUnicodeMinus(s): + return '\u2212' + s[1:] if s.startswith('-') else s + + def round_entry(entry_tag, entry): round_to = int(entry_tag.replace(',', '')) decimal_place = round(pow(0.1, round_to), round_to)