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