lyx_2_0.py: fix glue length reversion routine again

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30733 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2009-07-21 15:51:36 +00:00
parent ed8b1fb1fd
commit e09862ec15

View File

@ -309,11 +309,23 @@ def latex_length(string):
value = str(float(value)/100)
begin = string[:minus+1]
string = begin + value + "\\paperheight"
# replace + and -, but only when the - is not the first character
string = string.replace("+", " plus ")
if string.find("-") == 0:
minusstring = string[1:]
minusstring = minusstring.replace("-", " minus ")
string = "-" + minusstring
else:
string = string.replace("-", " minus ")
# handle the case that "+-1mm" was used because LaTeX only understands
# "plus 1mm minus 1mm"
if string.find("plus minus"):
lastvaluepos = string.rfind(" ")
lastvalue = string[lastvaluepos:]
string = string.replace(" ", lastvalue + " ")
if percent == False:
return "False," + string
else:
string = string.replace("+", " plus ")
string = string.replace("-", " minus ")
return "True," + string
@ -1078,7 +1090,8 @@ def revert_hspace_glue_lengths(document):
length = length[m+1:]
# revert the HSpace inset to ERT
# allow leading -
if length.rfind("-") <> 0 or (length.rfind("-") == 0 and length.rfind("+") > -1):
n = length.find("-")
if n <> 0 or (n == 0 and (length.rfind("plus") > -1 or length.rfind("minus") > -1)):
if star == True:
subst = [put_cmd_in_ert("\\hspace*{" + length + "}")]
else: