]> git.lyx.org Git - features.git/commitdiff
enable reLyX to cope with \)*
authorAngus Leeming <leeming@lyx.org>
Fri, 7 Feb 2003 15:35:17 +0000 (15:35 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 7 Feb 2003 15:35:17 +0000 (15:35 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6063 a592a061-630c-0410-9148-cb99ea01b6c8

lib/ChangeLog
lib/reLyX/Text/TeX.pm

index afa3ae4dbd407fa4d2b281ddfd6befbcc2f483d3..6cf5075ddf555778f5a7dfd82ed2b35dd0088cb1 100644 (file)
@@ -7,6 +7,9 @@
 
        * reLyX/RelyxTable.pm: provide support for 'm' column descriptors.
 
+       * reLyX/Text/TeX.pm: fix the $macro regex so that it recognises
+       that \) is a valid token but that \)* is a token and a '*'.
+
 2003-02-04  Joao Luis Meloni Assirati  <assirati@fma.if.usp.br>
 
        * images/math/rbracket.xpm: new file.
index a9d2021bb244d7164ab37fd0e8c57f51947c38ad..395ff09e74c3550e2dec7960524e983f54b77a7c 100644 (file)
@@ -96,13 +96,22 @@ $notusualtoks = "\\\\" . '\${}^_~&@%'; # Why \\\\? double interpretation!
 $notusualtokenclass = "[$notusualtoks]";
 $usualtokenclass = "[^$notusualtoks]";
 
-# Original $macro wouldn't recognize, e.g., '\section*'. Added '\*?' - Ak
-# (Had to add it for \section and \\ separately.)
-#    \" or \frac, e.g. Note that it eats whitespace AFTER the token. This is
-# correct LaTeX behavior, but if text follows such a macro, and you just
-# print out the macro & then the text, they will run together.
-$macro = '\\\\(?:[^a-zA-Z]\*?|([a-zA-Z]+\*?)\s*)'; # Has one level of grouping
-#$macro = '\\\\(?:[^a-zA-Z]|([a-zA-Z]+)\s*)'; # Contains one level of grouping
+# The $macro RE matches LaTeX macros. Here's exactly what it does:
+# $macro = \\\\(?:RE)
+# This matches either '\\' or \RE where RE = RE1 or RE2
+# RE1 = '\)', so $macro will match the end of a math environment, '\)'
+# RE2 = (((RE3 or RE4)\*?)\s*) where
+# RE3 and RE4 can each be followed by zero or one asterisks. Either is still
+# a macro. Ditto, trailing whitespace is included in the token because that's
+# what LaTeX does.
+# RE3 = '([^a-zA-Z)])' matches a single non-alphabetic char. We already
+# test for '\)', so that is explictly excluded from RE3 because '\)*' is not
+# a macro. Rather it is '\)' followed by an asterisk.
+# RE4 = '([a-zA-Z]+\*?)'
+# Ie, one or more alphabetic chars followed by zero or 1 asterisks
+# Eg, \section or \section*
+# Putting all this together:
+$macro = '\\\\(?:\)|((([^a-zA-Z)])|([a-zA-Z]+))\*?)\s*)';
 
 # active is a backslashed macro or $$ (same as \[) or ^^ followed by a char
 #    (^^A means ASCII(1), e.g. See the TeXbook) or a special character like ~