Re: A question about lengths and reLyX
Andre Poenitz wrote: On Tue, Feb 11, 2003 at 09:47:13PM +0100, Georg Baum wrote: Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) While you are at it: 4,5cm (with comma) is also valid latex (learned that the other day when I fed some more old tex files to reLyX. And I believe '4.5 Cm' and '4.5 cM' are valid as well... Geeez. Would this suffice do you think? Angus $ ./trial ' - 3.5 cM' ' + 4,5 Cm ' ' + 4.5 \columnWidth ' ' - 3.5 cM' becomes '-3.5cm' ' + 4,5 Cm ' becomes '+4.5cm' ' + 4.5 \columnWidth ' becomes '+4.5\columnWidth' where 'trial' is: #! /usr/bin/perl sub regularizeLatexLength { my $LatexLength = shift; # '4,5cm', '4.5 Cm' and '4.5 cM' are all valid LaTeX. # Turn them into a common, standard form. # First, deal with '- 5,5 ' as '-5.5' $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; # Now ensure that 'Cm', 'cM' are output as 'cm'. # This does not act on \macro $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; # Strip off any trailing whitespace $LatexLength =~ s/\s*$//; return $LatexLength; } foreach (@ARGV) {#while () { chomp; print '$_' becomes ', regularizeLatexLength($_), '\n; }
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 09:21:12AM +, Angus Leeming wrote: And I believe '4.5 Cm' and '4.5 cM' are valid as well... Geeez. Someone should check it first Would this suffice do you think? $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; # Now ensure that 'Cm', 'cM' are output as 'cm'. # This does not act on \macro $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; [a-z]* does not match CM, does it? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 9:31 am, Andre Poenitz wrote: On Wed, Feb 12, 2003 at 09:21:12AM +, Angus Leeming wrote: And I believe '4.5 Cm' and '4.5 cM' are valid as well... Geeez. Someone should check it first That's why I gave you a little program to run, you noodle ;-) Would this suffice do you think? $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; # Now ensure that 'Cm', 'cM' are output as 'cm'. # This does not act on \macro $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; [a-z]* does not match CM, does it? Yes. That's what the 'i' on the end does --- case insensitive matching. The '\L' forces $2 to be lower case. Should I write the equivalent of this as a function for tex2lyx using the boost regex library? Angus
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 09:38:06AM +, Angus Leeming wrote: Should I write the equivalent of this as a function for tex2lyx using the boost regex library? Overkill. Better use a simple loop over the string than adding a dependance on boost stuff. Currently I like the idea of tex2lyx being small and independent very much. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre Currently I like the idea of tex2lyx being small and Andre independent very much. While I agree about being independent from boost, you will have to have some dependency on the lyx sources: the parsing of things like \section depends on the .layout files, and I do not think it would be wise to do a re-implmentation of LyXTextClass and friends just for the pleasure of being independent. JMarc
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 11:00:33AM +0100, Jean-Marc Lasgouttes wrote: While I agree about being independent from boost, you will have to have some dependency on the lyx sources: the parsing of things like \section depends on the .layout files, and I do not think it would be wise to do a re-implmentation of LyXTextClass and friends just for the pleasure of being independent. Rest assured that I certainly won't do that. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 9:40 am, Andre Poenitz wrote: On Wed, Feb 12, 2003 at 09:38:06AM +, Angus Leeming wrote: Should I write the equivalent of this as a function for tex2lyx using the boost regex library? Overkill. Better use a simple loop over the string than adding a dependance on boost stuff. Currently I like the idea of tex2lyx being small and independent very much. Sure. One question. Would ' - 4,5 cM ' count as one token or two? Angus
Re: A question about lengths and reLyX
-BEGIN PGP SIGNED MESSAGE- On Mittwoch, 12. Februar 2003 10:21, Angus Leeming wrote: ... $ ./trial ' - 3.5 cM' ' + 4,5 Cm ' ' + 4.5 \columnWidth ' ' - 3.5 cM' becomes '-3.5cm' ' + 4,5 Cm ' becomes '+4.5cm' ' + 4.5 \columnWidth ' becomes '+4.5\columnWidth' You may miss '.3 cm' sub regularizeLatexLength { my $LatexLength = shift; # '4,5cm', '4.5 Cm' and '4.5 cM' are all valid LaTeX. # Turn them into a common, standard form. # First, deal with '- 5,5 ' as '-5.5' $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; maybe here $LatexLength =~ s/^\s*([+-]?)\s*(\d*)[.,]?(\d*)\s*/$1$2.$3/; Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: PGP 6.5.8 iQCVAwUBPkofP7ewfbDGmeqhAQEsowP/XecndM1TUIEO6ptN0EiDtKgshCepkp1m OCKqfb6nckrJnyhRew9YYWkFvWhX8lFcjDXY3CywYZmlLNkDgqe83KwzNF5lw2Qg yi/OFhG0hWJC8DExzg9GatDso4Nk95XlXKQgegzl8VGKGJEfjDw1ORV5m4ld0N9V uhnHZMkHwy8= =h8qP -END PGP SIGNATURE-
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 10:06:56AM +, Angus Leeming wrote: Currently I like the idea of tex2lyx being small and independent very much. Sure. One question. Would ' - 4,5 cM ' count as one token or two? Six. - 4 5 , c M. The conversion has to be done on output. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre Poenitz wrote: On Wed, Feb 12, 2003 at 10:06:56AM +, Angus Leeming wrote: Currently I like the idea of tex2lyx being small and independent very much. Sure. One question. Would ' - 4,5 cM ' count as one token or two? Six. - 4 5 , c M. The conversion has to be done on output. ??? Ok. You tokenise and then parse. Fair enough. But presumably these 6 tokens are used to initialise the width argument of a minibuffer for example. So, having created the contents of the width argument I have a single variable to 'regularize'. If not, could you paint a picture of what you expect to happen because you're confusing me. -- Angus
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 10:50:30AM +, Angus Leeming wrote: Sure. One question. Would ' - 4,5 cM ' count as one token or two? Six. - 4 5 , c M. The conversion has to be done on output. ??? Ok. You tokenise and then parse. Fair enough. But wrong. Tokenization should happen lazy. But presumably these 6 tokens are used to initialise the width argument of a minibuffer for example. So, having created the contents of the width argument I have a single variable to 'regularize'. If not, could you paint a picture of what you expect to happen because you're confusing me. I expect to use if (name == minipage) { string width = p.verbatimItem(); os begin_inset Minipage canonicalLength(width); parse(p, os, FLAG_END); os end_inset; } Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 10:55 am, Andre Poenitz wrote: On Wed, Feb 12, 2003 at 10:50:30AM +, Angus Leeming wrote: Sure. One question. Would ' - 4,5 cM ' count as one token or two? Six. - 4 5 , c M. The conversion has to be done on output. ??? Ok. You tokenise and then parse. Fair enough. But wrong. Tokenization should happen lazy. But presumably these 6 tokens are used to initialise the width argument of a minibuffer for example. So, having created the contents of the width argument I have a single variable to 'regularize'. If not, could you paint a picture of what you expect to happen because you're confusing me. I expect to use if (name == minipage) { string width = p.verbatimItem(); os begin_inset Minipage canonicalLength(width); parse(p, os, FLAG_END); os end_inset; } Thank you. All is clearer now. Would verbatimItem return '4.5 \columnwidth' too? One more thing: LyX can read all of minipage's optional args too (although I have no idea how it expects to receive inner_pos because although read it is never used.) A
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 11:02:52AM +, Angus Leeming wrote: Thank you. All is clearer now. Would verbatimItem return '4.5 \columnwidth' too? Yes. It looks for something within balanced braces. Not entirely correct, but not too far off. One more thing: LyX can read all of minipage's optional args too (although I have no idea how it expects to receive inner_pos because although read it is never used.) I don't know either. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre Poenitz wrote: > On Tue, Feb 11, 2003 at 09:47:13PM +0100, Georg Baum wrote: >> Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: >> > I have a trivial patch to the reLyX minibuffer output: >> > >> > * reLyX/BasicLyX.pm: Wrap minipage width and height output in >> > inverted commas to keep the LyX parser happy with "4.5 cm". >> > (Note the space.) >> >> While you are at it: "4,5cm" (with comma) is also valid latex (learned >> that the other day when I fed some more old tex files to reLyX. > > And I believe '4.5 Cm' and '4.5 cM' are valid as well... Geeez. Would this suffice do you think? Angus $ ./trial ' - 3.5 cM' ' + 4,5 Cm ' ' + 4.5 \columnWidth ' ' - 3.5 cM' becomes '-3.5cm' ' + 4,5 Cm ' becomes '+4.5cm' ' + 4.5 \columnWidth ' becomes '+4.5\columnWidth' where 'trial' is: #! /usr/bin/perl sub regularizeLatexLength { my $LatexLength = shift; # '4,5cm', '4.5 Cm' and '4.5 cM' are all valid LaTeX. # Turn them into a common, standard form. # First, deal with '- 5,5 ' as '-5.5' $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; # Now ensure that 'Cm', 'cM' are output as 'cm'. # This does not act on \macro $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; # Strip off any trailing whitespace $LatexLength =~ s/\s*$//; return $LatexLength; } foreach (@ARGV) {#while (<>) { chomp; print "'$_' becomes '", regularizeLatexLength($_), "'\n"; }
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 09:21:12AM +, Angus Leeming wrote: > > And I believe '4.5 Cm' and '4.5 cM' are valid as well... > > Geeez. Someone should check it first > Would this suffice do you think? > $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; > # Now ensure that 'Cm', 'cM' are output as 'cm'. > # This does not act on \macro > $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; [a-z]* does not match CM, does it? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 9:31 am, Andre Poenitz wrote: > On Wed, Feb 12, 2003 at 09:21:12AM +, Angus Leeming wrote: > > > And I believe '4.5 Cm' and '4.5 cM' are valid as well... > > > > Geeez. > > Someone should check it first That's why I gave you a little program to run, you noodle ;-) > > Would this suffice do you think? > > > > $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; > > # Now ensure that 'Cm', 'cM' are output as 'cm'. > > # This does not act on \macro > > $LatexLength =~ s/(\d+\.?\d*)([a-z]*)/$1\L$2/i; > > [a-z]* does not match CM, does it? Yes. That's what the 'i' on the end does --- case insensitive matching. The '\L' forces $2 to be lower case. Should I write the equivalent of this as a function for tex2lyx using the boost regex library? Angus
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 09:38:06AM +, Angus Leeming wrote: > Should I write the equivalent of this as a function for tex2lyx using the > boost regex library? Overkill. Better use a simple loop over the string than adding a dependance on boost stuff. Currently I like the idea of tex2lyx being small and independent very much. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: Andre> Currently I like the idea of tex2lyx being small and Andre> independent very much. While I agree about being independent from boost, you will have to have some dependency on the lyx sources: the parsing of things like \section depends on the .layout files, and I do not think it would be wise to do a re-implmentation of LyXTextClass and friends just for the pleasure of being independent. JMarc
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 11:00:33AM +0100, Jean-Marc Lasgouttes wrote: > While I agree about being independent from boost, you will have to > have some dependency on the lyx sources: the parsing of things like > \section depends on the .layout files, and I do not think it would be > wise to do a re-implmentation of LyXTextClass and friends just for the > pleasure of being independent. Rest assured that I certainly won't do that. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 9:40 am, Andre Poenitz wrote: > On Wed, Feb 12, 2003 at 09:38:06AM +, Angus Leeming wrote: > > Should I write the equivalent of this as a function for tex2lyx using the > > boost regex library? > > Overkill. > > Better use a simple loop over the string than adding a dependance on boost > stuff. > > Currently I like the idea of tex2lyx being small and independent very much. Sure. One question. Would ' - 4,5 cM ' count as one token or two? Angus
Re: A question about lengths and reLyX
-BEGIN PGP SIGNED MESSAGE- On Mittwoch, 12. Februar 2003 10:21, Angus Leeming wrote: ... > > $ ./trial ' - 3.5 cM' ' + 4,5 Cm ' ' + 4.5 \columnWidth ' > ' - 3.5 cM' becomes '-3.5cm' > ' + 4,5 Cm ' becomes '+4.5cm' > ' + 4.5 \columnWidth ' becomes '+4.5\columnWidth' You may miss '.3 cm' > sub regularizeLatexLength { > my $LatexLength = shift; > > # '4,5cm', '4.5 Cm' and '4.5 cM' are all valid LaTeX. > # Turn them into a common, standard form. > # First, deal with '- 5,5 ' as '-5.5' > $LatexLength =~ s/^\s*([+-]?)\s*(\d+)[.,]?(\d*)\s*/$1$2.$3/; maybe here $LatexLength =~ s/^\s*([+-]?)\s*(\d*)[.,]?(\d*)\s*/$1$2.$3/; Kornel - -- Kornel Benko [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: PGP 6.5.8 iQCVAwUBPkofP7ewfbDGmeqhAQEsowP/XecndM1TUIEO6ptN0EiDtKgshCepkp1m OCKqfb6nckrJnyhRew9YYWkFvWhX8lFcjDXY3CywYZmlLNkDgqe83KwzNF5lw2Qg yi/OFhG0hWJC8DExzg9GatDso4Nk95XlXKQgegzl8VGKGJEfjDw1ORV5m4ld0N9V uhnHZMkHwy8= =h8qP -END PGP SIGNATURE-
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 10:06:56AM +, Angus Leeming wrote: > > Currently I like the idea of tex2lyx being small and independent very much. > > Sure. One question. Would ' - 4,5 cM ' count as one token or two? Six. - 4 5 , c M. The conversion has to be done on output. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre Poenitz wrote: > On Wed, Feb 12, 2003 at 10:06:56AM +, Angus Leeming wrote: >> > Currently I like the idea of tex2lyx being small and independent very >> > much. >> >> Sure. One question. Would ' - 4,5 cM ' count as one token or two? > > Six. - 4 5 , c M. > > The conversion has to be done on output. ??? Ok. You tokenise and then parse. Fair enough. But presumably these 6 tokens are used to initialise the width argument of a minibuffer for example. So, having created the contents of the width argument I have a single variable to 'regularize'. If not, could you paint a picture of what you expect to happen because you're confusing me. -- Angus
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 10:50:30AM +, Angus Leeming wrote: > >> Sure. One question. Would ' - 4,5 cM ' count as one token or two? > > > > Six. - 4 5 , c M. > > > > The conversion has to be done on output. > > ??? Ok. You tokenise and then parse. Fair enough. But wrong. Tokenization should happen "lazy". > But presumably these 6 tokens are used to initialise the width argument of a > minibuffer for example. So, having created the contents of the width > argument I have a single variable to 'regularize'. > > If not, could you paint a picture of what you expect to happen because > you're confusing me. I expect to use if (name == "minipage") { string width = p.verbatimItem(); os << "begin_inset Minipage " << canonicalLength(width); parse(p, os, FLAG_END); os << "end_inset; } Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Wednesday 12 February 2003 10:55 am, Andre Poenitz wrote: > On Wed, Feb 12, 2003 at 10:50:30AM +, Angus Leeming wrote: > > >> Sure. One question. Would ' - 4,5 cM ' count as one token or two? > > > > > > Six. - 4 5 , c M. > > > > > > The conversion has to be done on output. > > > > ??? Ok. You tokenise and then parse. Fair enough. > > But wrong. Tokenization should happen "lazy". > > > But presumably these 6 tokens are used to initialise the width argument > > of a minibuffer for example. So, having created the contents of the width > > argument I have a single variable to 'regularize'. > > > > If not, could you paint a picture of what you expect to happen because > > you're confusing me. > > I expect to use > >if (name == "minipage") { > string width = p.verbatimItem(); > os << "begin_inset Minipage " << canonicalLength(width); > parse(p, os, FLAG_END); > os << "end_inset; >} Thank you. All is clearer now. Would verbatimItem return '4.5 \columnwidth' too? One more thing: LyX can read all of minipage's optional args too (although I have no idea how it expects to receive inner_pos because although read it is never used.) A
Re: A question about lengths and reLyX
On Wed, Feb 12, 2003 at 11:02:52AM +, Angus Leeming wrote: > Thank you. All is clearer now. Would verbatimItem return '4.5 \columnwidth' > too? Yes. It looks for something within balanced braces. Not entirely correct, but not too far off. > One more thing: LyX can read all of minipage's optional args too (although I > have no idea how it expects to receive inner_pos because although read it is > never used.) I don't know either. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
A question about lengths and reLyX
I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) However, I wonder whether I should do this or whether I should strip out the space instead? -- Angus
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) However, I wonder whether I should do this or whether I should strip out the space instead? I wonder whether this is not wasted effort. Could you have a look at the tex2lyx I just commited and try to figure out whether it is would be worthwhile to start from there instead of fixing reLyX? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Tuesday 11 February 2003 12:39 pm, Andre Poenitz wrote: On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) However, I wonder whether I should do this or whether I should strip out the space instead? I wonder whether this is not wasted effort. I wonder too. However, my motivation has been: 1. learn enough perl to feel comfortable when confronted with it. 2. LyX 1.3 will be around for at least 6 months. Could you have a look at the tex2lyx I just commited and try to figure out whether it is would be worthwhile to start from there instead of fixing reLyX? Certainly. But I would note that reLyX isn't very broken. The only _real_ problem is due to the foobarred state of the current LyX table format, about which I've already moaned. Anyway, I'll go look. Angus Andre'
Re: A question about lengths and reLyX
Andre Poenitz wrote: On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) However, I wonder whether I should do this or whether I should strip out the space instead? I wonder whether this is not wasted effort. Could you have a look at the tex2lyx I just commited and try to figure out whether it is would be worthwhile to start from there instead of fixing reLyX? Andre' Points so far: s/stared/starred/ As JMarc noted yesterday, this approach: else if (t.cs() == usepackage) { string const options = getArg('[', ']'); string const name = getArg('{', '}'); if (name == a4wide) { h_papersize = a4; h_paperpackage = widemarginsa4; fails for \usepackage{amsmath, natbib}. I see a nice 'split' function. Shall I give you the first external contribution? Interestingly, compilation fails with Makefile:308: .deps/tex2lyx.Po: No such file or directory $ mkdir src/tex2lyx/.deps $ touch src/tex2lyx/.deps/tex2lyx.Po solves the problem. Should it be generated automatically or cvs added? I also needed a few using directives. See attached. -- Angus Index: src/tex2lyx/tex2lyx.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/tex2lyx.C,v retrieving revision 1.1 diff -u -p -r1.1 tex2lyx.C --- src/tex2lyx/tex2lyx.C 11 Feb 2003 12:37:27 - 1.1 +++ src/tex2lyx/tex2lyx.C 11 Feb 2003 13:09:46 - @@ -21,8 +21,13 @@ using std::endl; using std::fill; using std::getline; using std::ios; +using std::ifstream; using std::istream; +using std::istringstream; using std::ostream; +using std::ostringstream; +using std::stack; +using std::string; using std::vector; @@ -150,7 +155,7 @@ mode_type asMode(mode_type oldmode, stri } -bool stared(string const s) +bool starred(string const s) { string::size_type const n = s.size(); return n s[n - 1] == '*';
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 12:51:24PM +, Angus Leeming wrote: I wonder too. However, my motivation has been: 1. learn enough perl to feel comfortable when confronted with it. 2. LyX 1.3 will be around for at least 6 months. Currently there is no dependency on LyX in tex2lyx (quite contrary to what I expected initially) so we would not need to wait six month do release it. Certainly. But I would note that reLyX isn't very broken. It is sort of ok for standard basic stuff and one or two things it supports. I've never seen it working for real world examples (i.e. $U_\epsilon$ of my desk with $\epsilon 3m$) Anyway, I'll go look. The tokenizer should be ok unless someone starts changing catcodes ore redefines macros. The backend (i.e. writing the proper .lyx constructs) is far from working, let alone complete... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 01:12:33PM +, Angus Leeming wrote: As JMarc noted yesterday, this approach: else if (t.cs() == usepackage) { string const options = getArg('[', ']'); string const name = getArg('{', '}'); if (name == a4wide) { h_papersize = a4; h_paperpackage = widemarginsa4; fails for \usepackage{amsmath, natbib}. I see a nice 'split' function. Shall I give you the first external contribution? Sure, why not. $ mkdir src/tex2lyx/.deps $ touch src/tex2lyx/.deps/tex2lyx.Po solves the problem. Should it be generated automatically or cvs added? I don't know. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre Poenitz [EMAIL PROTECTED] writes: | $ mkdir src/tex2lyx/.deps | $ touch src/tex2lyx/.deps/tex2lyx.Po | | solves the problem. Should it be generated automatically or cvs added? No! That was something wrong on your end. a autogen, re-configure, make distclean etc would have fixed it. -- Lgb
Re: A question about lengths and reLyX
On Tuesday 11 February 2003 1:21 pm, Lars Gullik Bjønnes wrote: Andre Poenitz [EMAIL PROTECTED] writes: | $ mkdir src/tex2lyx/.deps | $ touch src/tex2lyx/.deps/tex2lyx.Po | | solves the problem. Should it be generated automatically or cvs added? No! That was something wrong on your end. a autogen, re-configure, make distclean etc would have fixed it. Thanks for the info
Re: A question about lengths and reLyX
Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre The tokenizer should be ok unless someone starts changing Andre catcodes ore redefines macros. The backend (i.e. writing the Andre proper .lyx constructs) is far from working, let alone Andre complete... Are you sure that producing a .lyx file is the way to go? Another way would be to build a lyx document and then write it. This would mean that you do not need to update the program everytime there is a change of interfaces. I presume that you thought about that. So what are your reasons for doing it like you do now? JMarc
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 02:46:48PM +0100, Jean-Marc Lasgouttes wrote: Andre The tokenizer should be ok unless someone starts changing Andre catcodes ore redefines macros. The backend (i.e. writing the Andre proper .lyx constructs) is far from working, let alone Andre complete... Are you sure that producing a .lyx file is the way to go? No. But it has certain benefits: - No dependence on LyX proper. - Small. - No need to access fragile LyX internals. Another way would be to build a lyx document and then write it. Yes. Actually that's what I intended originally. But it turned out while removing stuff from the math parser, that writing the .lyx is feasible and less effort. And as long as the LyX core is the mess it is I'd rather avoid internal interfaces as these are more likely to change than the comparatively stable external format. This would mean that you do not need to update the program everytime there is a change of interfaces. I do not have to. If all tex2lyx does is to produced lyxformat 222 reliably, the burden to create future formats is shifted to lyx2lyx. Of course, if at one point of time the format has evolved too far, tex2lyx might get an update. I presume that you thought about that. So what are your reasons for doing it like you do now? See above. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre == Andre Poenitz [EMAIL PROTECTED] writes: Andre But it has certain benefits: Andre - No dependence on LyX proper. - Small. - No need to access Andre fragile LyX internals. Indeed. But at least, when the internals change, you know about it because it does not compile anymore. This would mean that you do not need to update the program everytime there is a change of interfaces. Andre I do not have to. If all tex2lyx does is to produced lyxformat Andre 222 reliably, the burden to create future formats is shifted to Andre lyx2lyx. Andre Of course, if at one point of time the format has evolved too Andre far, tex2lyx might get an update. Like reLyX that produces a strange file format with a mix of old constructs and new ones... JMarc
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 03:02:52PM +0100, Jean-Marc Lasgouttes wrote: Andre Of course, if at one point of time the format has evolved too Andre far, tex2lyx might get an update. Like reLyX that produces a strange file format with a mix of old constructs and new ones... Not necessarily. The backend can be reworked completely if necessary. And I think it would be not too much effort.. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) While you are at it: 4,5cm (with comma) is also valid latex (learned that the other day when I fed some more old tex files to reLyX. Georg
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 09:47:13PM +0100, Georg Baum wrote: Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with 4.5 cm. (Note the space.) While you are at it: 4,5cm (with comma) is also valid latex (learned that the other day when I fed some more old tex files to reLyX. And I believe '4.5 Cm' and '4.5 cM' are valid as well... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
A question about lengths and reLyX
I have a trivial patch to the reLyX minibuffer output: * reLyX/BasicLyX.pm: Wrap minipage width and height output in inverted commas to keep the LyX parser happy with "4.5 cm". (Note the space.) However, I wonder whether I should do this or whether I should strip out the space instead? -- Angus
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: > I have a trivial patch to the reLyX minibuffer output: > > * reLyX/BasicLyX.pm: Wrap minipage width and height output in > inverted commas to keep the LyX parser happy with "4.5 cm". > (Note the space.) > > However, I wonder whether I should do this or whether I should strip out the > space instead? I wonder whether this is not wasted effort. Could you have a look at the tex2lyx I just commited and try to figure out whether it is would be worthwhile to start from there instead of fixing reLyX? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Tuesday 11 February 2003 12:39 pm, Andre Poenitz wrote: > On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: > > I have a trivial patch to the reLyX minibuffer output: > > > > * reLyX/BasicLyX.pm: Wrap minipage width and height output in > > inverted commas to keep the LyX parser happy with "4.5 cm". > > (Note the space.) > > > > However, I wonder whether I should do this or whether I should strip out > > the space instead? > > I wonder whether this is not wasted effort. I wonder too. However, my motivation has been: 1. learn enough perl to feel comfortable when confronted with it. 2. LyX 1.3 will be around for at least 6 months. > Could you have a look at the tex2lyx I just commited and try to figure out > whether it is would be worthwhile to start from there instead of fixing > reLyX? Certainly. But I would note that reLyX isn't very broken. The only _real_ problem is due to the foobarred state of the current LyX table format, about which I've already moaned. Anyway, I'll go look. Angus > > Andre'
Re: A question about lengths and reLyX
Andre Poenitz wrote: > On Tue, Feb 11, 2003 at 11:00:37AM +, Angus Leeming wrote: >> I have a trivial patch to the reLyX minibuffer output: >> >> * reLyX/BasicLyX.pm: Wrap minipage width and height output in >> inverted commas to keep the LyX parser happy with "4.5 cm". >> (Note the space.) >> >> However, I wonder whether I should do this or whether I should strip out >> the space instead? > > I wonder whether this is not wasted effort. > > Could you have a look at the tex2lyx I just commited and try to figure out > whether it is would be worthwhile to start from there instead of fixing > reLyX? > > Andre' > Points so far: s/stared/starred/ As JMarc noted yesterday, this approach: else if (t.cs() == "usepackage") { string const options = getArg('[', ']'); string const name = getArg('{', '}'); if (name == "a4wide") { h_papersize = "a4"; h_paperpackage = "widemarginsa4"; fails for \usepackage{amsmath, natbib}. I see a nice 'split' function. Shall I give you the first external contribution? Interestingly, compilation fails with Makefile:308: .deps/tex2lyx.Po: No such file or directory $ mkdir src/tex2lyx/.deps $ touch src/tex2lyx/.deps/tex2lyx.Po solves the problem. Should it be generated automatically or cvs added? I also needed a few using directives. See attached. -- Angus Index: src/tex2lyx/tex2lyx.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/tex2lyx.C,v retrieving revision 1.1 diff -u -p -r1.1 tex2lyx.C --- src/tex2lyx/tex2lyx.C 11 Feb 2003 12:37:27 - 1.1 +++ src/tex2lyx/tex2lyx.C 11 Feb 2003 13:09:46 - @@ -21,8 +21,13 @@ using std::endl; using std::fill; using std::getline; using std::ios; +using std::ifstream; using std::istream; +using std::istringstream; using std::ostream; +using std::ostringstream; +using std::stack; +using std::string; using std::vector; @@ -150,7 +155,7 @@ mode_type asMode(mode_type oldmode, stri } -bool stared(string const & s) +bool starred(string const & s) { string::size_type const n = s.size(); return n && s[n - 1] == '*';
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 12:51:24PM +, Angus Leeming wrote: > I wonder too. However, my motivation has been: > 1. learn enough perl to feel comfortable when confronted with it. > 2. LyX 1.3 will be around for at least 6 months. Currently there is no dependency on LyX in tex2lyx (quite contrary to what I expected initially) so we would not need to wait six month do release it. > Certainly. But I would note that reLyX isn't very broken. It is sort of ok for standard basic stuff and one or two things it supports. I've never seen it working for "real world examples" (i.e. $U_\epsilon$ of my desk with $\epsilon < 3m$) > Anyway, I'll go look. The tokenizer should be ok unless someone starts changing catcodes ore redefines macros. The "backend" (i.e. writing the proper .lyx constructs) is far from working, let alone complete... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 01:12:33PM +, Angus Leeming wrote: > As JMarc noted yesterday, this approach: > else if (t.cs() == "usepackage") { > string const options = getArg('[', ']'); > string const name = getArg('{', '}'); > if (name == "a4wide") { > h_papersize = "a4"; > h_paperpackage = "widemarginsa4"; > > fails for \usepackage{amsmath, natbib}. I see a nice 'split' function. Shall > I give you the first external contribution? Sure, why not. > $ mkdir src/tex2lyx/.deps > $ touch src/tex2lyx/.deps/tex2lyx.Po > > solves the problem. Should it be generated automatically or cvs added? I don't know. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Andre Poenitz <[EMAIL PROTECTED]> writes: | > $ mkdir src/tex2lyx/.deps | > $ touch src/tex2lyx/.deps/tex2lyx.Po | > | > solves the problem. Should it be generated automatically or cvs added? No! That was something wrong on your end. a autogen, re-configure, make distclean etc would have fixed it. -- Lgb
Re: A question about lengths and reLyX
On Tuesday 11 February 2003 1:21 pm, Lars Gullik Bjønnes wrote: > Andre Poenitz <[EMAIL PROTECTED]> writes: > | > $ mkdir src/tex2lyx/.deps > | > $ touch src/tex2lyx/.deps/tex2lyx.Po > | > > | > solves the problem. Should it be generated automatically or cvs added? > > No! > > That was something wrong on your end. > > a autogen, re-configure, make distclean etc would have fixed it. Thanks for the info
Re: A question about lengths and reLyX
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: Andre> The tokenizer should be ok unless someone starts changing Andre> catcodes ore redefines macros. The "backend" (i.e. writing the Andre> proper .lyx constructs) is far from working, let alone Andre> complete... Are you sure that producing a .lyx file is the way to go? Another way would be to build a lyx document and then write it. This would mean that you do not need to update the program everytime there is a change of interfaces. I presume that you thought about that. So what are your reasons for doing it like you do now? JMarc
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 02:46:48PM +0100, Jean-Marc Lasgouttes wrote: > Andre> The tokenizer should be ok unless someone starts changing > Andre> catcodes ore redefines macros. The "backend" (i.e. writing the > Andre> proper .lyx constructs) is far from working, let alone > Andre> complete... > > Are you sure that producing a .lyx file is the way to go? No. But it has certain benefits: - No dependence on LyX proper. - Small. - No need to access fragile LyX internals. > Another way would be to build a lyx document and then write it. Yes. Actually that's what I intended originally. But it turned out while removing stuff from the math parser, that writing the .lyx is feasible and less effort. And as long as the LyX core is the mess it is I'd rather avoid internal interfaces as these are more likely to change than the comparatively stable external format. > This would mean that you do not need to update the program everytime > there is a change of interfaces. I do not have to. If all tex2lyx does is to produced lyxformat 222 reliably, the burden to create future formats is shifted to lyx2lyx. Of course, if at one point of time the format has evolved too far, tex2lyx might get an update. > I presume that you thought about that. So what are your reasons for doing > it like you do now? See above. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes: Andre> But it has certain benefits: Andre> - No dependence on LyX proper. - Small. - No need to access Andre> fragile LyX internals. Indeed. But at least, when the internals change, you know about it because it does not compile anymore. >> This would mean that you do not need to update the program >> everytime there is a change of interfaces. Andre> I do not have to. If all tex2lyx does is to produced lyxformat Andre> 222 reliably, the burden to create future formats is shifted to Andre> lyx2lyx. Andre> Of course, if at one point of time the format has evolved too Andre> far, tex2lyx might get an update. Like reLyX that produces a strange file format with a mix of old constructs and new ones... JMarc
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 03:02:52PM +0100, Jean-Marc Lasgouttes wrote: > Andre> Of course, if at one point of time the format has evolved too > Andre> far, tex2lyx might get an update. > > Like reLyX that produces a strange file format with a mix of old > constructs and new ones... Not necessarily. The "backend" can be reworked completely if necessary. And I think it would be not too much effort.. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)
Re: A question about lengths and reLyX
Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: > I have a trivial patch to the reLyX minibuffer output: > > * reLyX/BasicLyX.pm: Wrap minipage width and height output in > inverted commas to keep the LyX parser happy with "4.5 cm". > (Note the space.) While you are at it: "4,5cm" (with comma) is also valid latex (learned that the other day when I fed some more old tex files to reLyX. Georg
Re: A question about lengths and reLyX
On Tue, Feb 11, 2003 at 09:47:13PM +0100, Georg Baum wrote: > Am Dienstag, 11. Februar 2003 12:00 schrieb Angus Leeming: > > I have a trivial patch to the reLyX minibuffer output: > > > > * reLyX/BasicLyX.pm: Wrap minipage width and height output in > > inverted commas to keep the LyX parser happy with "4.5 cm". > > (Note the space.) > > While you are at it: "4,5cm" (with comma) is also valid latex (learned that > the other day when I fed some more old tex files to reLyX. And I believe '4.5 Cm' and '4.5 cM' are valid as well... Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)