Skip to content

Commit

Permalink
minor improvements to latex for pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjwilson committed Oct 23, 2024
1 parent b7c4aad commit ce8c447
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ecoval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import nctoolkit as nc
import copy
from ecoval.matchall import matchup
from ecoval.differences import differences
from ecoval.fixers import tidy_name
from ecoval.helpers import matchup_starting_point
from ecoval.session import session_info
Expand All @@ -14,6 +15,11 @@
import os
import re

def various_fixes(x):
# a number of fixes to ensure the latex is correct
# Make sure the 2 in R2 is a superscript
x = x.replace("R2", "R$^2$")
return x

def fix_toc(book_dir):
paths = glob.glob(f"{book_dir}/notebooks/*.ipynb")
Expand Down Expand Up @@ -980,11 +986,11 @@ def make_header_bold(x):

return y
if "textbf" not in line:
new_lines.append(make_header_bold(line))
new_lines.append(make_header_bold(various_fixes(line)))
else:
new_lines.append(line)
new_lines.append(various_fixes(line))
else:
new_lines.append(line)
new_lines.append(various_fixes(line))
if i == 0:
new_lines.append("\\hline")
i = 1
Expand Down

0 comments on commit ce8c447

Please sign in to comment.