Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions source/lib/JMSLab/tablefill.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]):
Expand All @@ -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] == '</lyxtabular>\n':
Expand All @@ -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]):
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading