Skip to content

Commit

Permalink
Fix minors in matrix latex
Browse files Browse the repository at this point in the history
  • Loading branch information
belerico committed Apr 19, 2020
1 parent d373243 commit f827e7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
17 changes: 7 additions & 10 deletions py_asciimath/transformer/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,6 @@ def __init__(
self, log=True, start_end_par_pattern="{}{}", visit_tokens=False
):
Transformer.__init__(self, visit_tokens=visit_tokens)
formatted_left_parenthesis = "|".join(["\\(", "\\(:", "\\[", "\\{:"])
formatted_right_parenthesis = "|".join(["\\)", ":\\)", "\\]", ":\\}"])
self.start_end_par_pattern = re.compile(
start_end_par_pattern.format(
formatted_left_parenthesis, formatted_right_parenthesis,
)
)
self._logger_func = logging.info
if not log:
self._logger_func = lambda x: x
Expand All @@ -382,7 +375,7 @@ def decorator(*args, **kwargs):

@log
def exp(self, items):
return " ".join(items)
return "".join(items)

@log
def exp_interm(self, items):
Expand All @@ -406,16 +399,20 @@ def exp_under_super(self, items):

@log
def exp_par(self, items):
left = items[0]
right = items[-1]
left = items[0].value
right = items[-1].value
if left == ".":
left = "{:"
elif left == "\\vert":
left = "|:"
else:
left = l2mml_left[items[0].value]
if right == ".":
right = ":}"
elif right == "\\vert":
right = ":|"
else:
right = l2mml_right[items[-1].value]
return left + " ".join(items[1:-1]) + right

@log
Expand Down
1 change: 0 additions & 1 deletion py_asciimath/translation/latex2asciimath.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
smb.update(get_symbols_for("greek_letters", "asciimath", "latex"))
smb.update(get_symbols_for("arrows", "asciimath", "latex"))
smb = dict(sorted(smb.items(), key=lambda x: (-len(x[0]), x[0])))
smb.pop(".")

0 comments on commit f827e7c

Please sign in to comment.