From: Matthijs Kooijman Date: Wed, 9 Dec 2009 11:49:53 +0000 (+0100) Subject: Require a word (including its subscript) to end in a number or letter. X-Git-Tag: final-thesis~4 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=75ecd039ac5d8da858fa77b44ec882cbde1a37f1;p=matthijs%2Fmaster-project%2Freport.git Require a word (including its subscript) to end in a number or letter. --- diff --git a/pret-lam.lua b/pret-lam.lua index 88e3924..feaa5e4 100644 --- a/pret-lam.lua +++ b/pret-lam.lua @@ -88,8 +88,12 @@ end -- the word taken. local function take_word(str) -- A word must always start with a-z (in particular, λ is not a valid - -- start of a word). - res, newstr = utf.match(str, "^([a-zA-Z][%a%d%+%-%,_]+)(.*)") + -- start of a word). A word must always end with a letter or a digit + res, newstr = utf.match(str, "^([a-zA-Z][%a%d%+%-%,_]*[%a%d]+)(.*)") + if not res then + -- The above does not catch single letter words + res, newstr = utf.match(str, "^([a-zA-Z])(.*)") + end return res, newstr or str end