We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent baf10b6 commit caf7356Copy full SHA for caf7356
tools/fix_longtable.py
@@ -3,6 +3,7 @@
3
"""
4
import re
5
import sys
6
+import codecs
7
8
lt_LL = re.compile(
9
r"longtable}{(L+)}")
@@ -16,8 +17,9 @@ def replacer(match):
16
17
raise RuntimeError("Enter path to tex file only")
18
file_path = sys.argv[1]
19
-unfixed_tex = open(file_path,'rt').readlines()
20
-write_file = open(file_path, 'wt')
21
-for line in unfixed_tex:
22
- line = lt_LL.sub(replacer, line, 1)
23
- write_file.write(line)
+with codecs.open(file_path, 'r', encoding='utf8') as fobj:
+ unfixed_tex = fobj.readlines()
+with codecs.open(file_path, 'w', encoding='utf8') as fobj:
+ for line in unfixed_tex:
24
+ line = lt_LL.sub(replacer, line, 1)
25
+ fobj.write(line)
0 commit comments