Skip to content

Commit

Permalink
Latex - Fix escaping of special chars (tilde, circumflex, dollar)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanlippuner committed Mar 5, 2024
1 parent ffecc70 commit 949a7f4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion proto/cheby/print_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ def escape_printable(text):
if idx % 2 == 0:

# Escape special characters
SPECIAL_CHARS = ['\\', '&', '%', '#', '_', '{', '}', '~', '^'] # '$'
SPECIAL_CHARS = ['\\', '&', '%', '#', '_', '{', '}']
for char in SPECIAL_CHARS:
text_part = text_part.replace(char, '\\' + char)

text_part.replace('~', '\\textasciitilde')
text_part.replace('^', '\\textasciicircum')

# Allow line breaks after '_' and '.' in long strings
ALLOW_BREAK_CHARS = ['.', '_']
for char in ALLOW_BREAK_CHARS:
Expand Down

0 comments on commit 949a7f4

Please sign in to comment.