Skip to content

Commit 1c01fba

Browse files
authored
Merge pull request #25 from nschloe/no-underscore
No underscore
2 parents a3b1651 + ac28d78 commit 1c01fba

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

blacktex/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _replace_obsolete_text_mods(string):
7979

8080

8181
def _add_space_after_single_subsuperscript(string):
82-
string = re.sub("([_\\^])([^{\\\\])([^_\\^\\s\\$})])", r"\1\2 \3", string)
82+
string = re.sub("([\\^])([^{\\\\])([^_\\^\\s\\$})])", r"\1\2 \3", string)
8383
return string
8484

8585

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = blacktex
3-
version = 0.3.5
3+
version = 0.3.6
44
author = Nico Schlömer
55
author_email = [email protected]
66
description = Cleans up your LaTeX files

test/test_blacktex.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ def test_subsuperscript_space():
114114
out = blacktex.clean(input_string)
115115
assert out == "2^n g"
116116

117-
input_string = "2_ng"
118-
out = blacktex.clean(input_string)
119-
assert out == "2_n g"
120-
121117
input_string = "$1/n^3$."
122118
out = blacktex.clean(input_string)
123119
assert out == "$1/n^3$."
@@ -136,11 +132,12 @@ def test_subsuperscript_space():
136132

137133
input_string = "a^2_PP^2"
138134
out = blacktex.clean(input_string)
139-
assert out == "a^2_P P^2"
135+
assert out == "a^2_PP^2"
140136

141-
input_string = "a_2^PP_2"
137+
# Underscore separation just produces too many false positives. Leave as is.
138+
input_string = "2_ng"
142139
out = blacktex.clean(input_string)
143-
assert out == "a_2^P P_2"
140+
assert out == "2_ng"
144141

145142

146143
def test_triple_dots():

0 commit comments

Comments
 (0)