José Matos wrote:
>> reLyX doesn't know about these tokens. Should I therefore ignore them? Or
>> should I do as you do and remove the line?
> Ignore them. They were produced by lyx.
>> This is the last outstanding issue:
>> Here's the code. Shall I simply append a '{}' after $name for all of
>> them?
> Yes, that is all. :-)
Well, I believe that the attached patch enables reLyX to output lyxformat
2.16. Do you have a test suite?
--
Angus
Index: lib/reLyX/BasicLyX.pm
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/BasicLyX.pm,v
retrieving revision 1.5
diff -u -p -r1.5 BasicLyX.pm
--- lib/reLyX/BasicLyX.pm 7 Jan 2003 14:30:52 -0000 1.5
+++ lib/reLyX/BasicLyX.pm 5 Feb 2003 18:09:05 -0000
@@ -149,7 +149,9 @@ my %TextTokenTransTable = (
'\j' => '\j',
# Misc simple LaTeX tokens
- '~' => "\n\\protected_separator \n",
+ # '~' was output as \protected_separator. Not now.
+ # Angus 5 Feb 2003, upgrading reLyX to output lyxformat 216.
+ '~' => "\\SpecialChar ~\n",
'@' => "@", # TeX.pm considers this a token, but it's not really
'\@' => "\\SpecialChar \\@",
'\ldots' => "\n\\SpecialChar \\ldots\{\}\n",
@@ -360,6 +362,14 @@ sub basic_lyx {
my $to_print = $TextTokenTransTable{$name};
+ # One special case: if we encounter a '~' inside a lyxcode
+ # environment, then it should be turned into a ' ' rather
+ # than '\SpecialChar ~'
+ # Angus 5 Feb 2003, upgrading reLyX to output lyxformat 216.
+ if ($name eq '~' && $$CurrentLayoutStack[-1] eq 'LyX-Code') {
+ $to_print = ' ';
+ }
+
# \@ has to be specially handled, because it depends on
# the character AFTER the \@
if ($name eq '\@') {
@@ -381,10 +391,13 @@ sub basic_lyx {
} # end special handling for \@
# Handle tokens that LyX translates as a "LatexCommand" inset
+
+ # Append a '{}' after the command.
+ # Angus 5 Feb 2003, upgrading reLyX to output lyxformat 216.
} elsif (grep {$_ eq $name} @LatexCommands) {
&CheckForNewParagraph; #Start new paragraph if necessary
print OUTFILE "$pre_space\n\\begin_inset LatexCommand ",
- $name,
+ $name, '{}'
"\n\n\\end_inset \n\n";
# Math -- copy verbatim until you're done
Index: lib/reLyX/reLyXmain.pl
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/reLyXmain.pl,v
retrieving revision 1.5
diff -u -p -r1.5 reLyXmain.pl
--- lib/reLyX/reLyXmain.pl 20 Jan 2003 19:38:50 -0000 1.5
+++ lib/reLyX/reLyXmain.pl 5 Feb 2003 18:09:07 -0000
@@ -53,7 +53,11 @@ use vars qw($lyxdir $lyxname);
# variables that a user might want to change
@Suffix_List = '\.(ltx|latex|tex)'; # allowed suffixes for LaTeX file
-$LyXFormat = "2.15"; #What to print in \lyxformat command in .lyx file
+
+# What to print in \lyxformat command in .lyx file
+# Angus 5 Feb 2003, upgrading reLyX to output lyxformat 216.
+$LyXFormat = "2.16";
+
my $syntaxname = "syntax.default"; # name of the default syntax file
$dot_lyxdir = $ENV{'HOME'} . "/.$lyxname"; # personal .lyx directory