Show More
@@ -36,6 +36,7 b' class LatexTransformer(ActivatableTransformer):' | |||
|
36 | 36 | |
|
37 | 37 | Returns modified cell and resource dict. |
|
38 | 38 | """ |
|
39 | ||
|
39 | 40 | if hasattr(cell, "source") and cell.cell_type == "markdown": |
|
40 | 41 | cell.source = rm_math_space(cell.source) |
|
41 | 42 | return cell, other |
@@ -60,8 +61,10 b' def rm_math_space(text):' | |||
|
60 | 61 | last_character = "" |
|
61 | 62 | skip = False |
|
62 | 63 | for index, char in enumerate(text): |
|
64 | ||
|
63 | 65 | #Make sure the character isn't preceeded by a backslash |
|
64 | 66 | if (char == "$" and last_character != "\\"): |
|
67 | ||
|
65 | 68 | # Close the math region if this is an ending $ |
|
66 | 69 | if within_math: |
|
67 | 70 | within_math = False |
@@ -69,10 +72,12 b' def rm_math_space(text):' | |||
|
69 | 72 | ptext = ptext+'$'+text[math_start_index+1:index].strip()+'$' |
|
70 | 73 | math_regions.append([math_start_index, index+1]) |
|
71 | 74 | else: |
|
75 | ||
|
72 | 76 | # Start a new math region |
|
73 | 77 | within_math = True |
|
74 | 78 | math_start_index = index |
|
75 | 79 | math_lines = 0 |
|
80 | ||
|
76 | 81 | # If we are in a math region, count the number of lines parsed. |
|
77 | 82 | # Cancel the math region if we find two line breaks! |
|
78 | 83 | elif char == "\n": |
General Comments 0
You need to be logged in to leave comments.
Login now