fix bug 9

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6013 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-02-01 15:09:10 +00:00
parent bb2a2f5d1f
commit 9009365d05
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2003-02-01 Angus Leeming <leeming@lyx.org>
* reLyX/Text/TeX.pm: fix bug 9: reLyX thinks \)* is a starred version
of the \) command. (End of math environment.)
2003-01-28 Edwin Leuven <e.leuven@uva.nl>
* layouts/amsbook.layout:

View File

@ -96,13 +96,21 @@ $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) followed by an arbitrary amount of trailing
# whitespace, '\s*'
# RE3 = '([^a-zA-Z)]\*?)'
# Ie, a single non-alphabetic char followed by zero or 1 asterisks.
# We already test for the presence of macro \) so this is excluded from
# RE3 because '\)*' is not a macro. 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 ~