Re: [patch] fix bug 3008
Jim Oldfield wrote: In the meantime, it would be useful if this was detected at/before LaTeX compilation and users given a slightly more helpful error message e.g. redirected to a wiki page. Otherwise they will probably go looking for a subscript package, as I did, and end up getting lost. I doubt too many people use text subscripts, but it could certainly be a source of confusion. We discussed the workarounds already: Either subscript.sty should be added to the installer, or a fallback implemented in LyX if subscript.sty is not available. Up to now, some people have voted for the first alternative, while Uwe prefers the second, but nothing has been done so far. Georg
Re: [patch] fix bug 3008
Jim Oldfield wrote: > In the meantime, it would be useful if this was detected at/before LaTeX > compilation and users given a slightly more helpful error message e.g. > redirected to a wiki page. Otherwise they will probably go looking for a > subscript package, as I did, and end up getting lost. I doubt too many > people use text subscripts, but it could certainly be a source of > confusion. We discussed the workarounds already: Either subscript.sty should be added to the installer, or a fallback implemented in LyX if subscript.sty is not available. Up to now, some people have voted for the first alternative, while Uwe prefers the second, but nothing has been done so far. Georg
Re: [patch] fix bug 3008
Here is the bug filed with MiKTeX, for ease of reference: http://sourceforge.net/tracker/index.php?func=detailaid=3114850group_id=10783atid=110783 As I understand, there are two problems with MiKTeX: 1. There is no fragments package that includes the various fragments available, including subscript.sty, in either MiKTeX 2.8 or 2.9 (or before). 2. The fixltx2e package has gone missing in MiKTeX 2.9. Uwe's bug with MiKTeX seems to have been targeted at problem 1. However the MiKTeX developers have realised that fixltx2e provides a textsubscript command and decided to change the bug to 2. I have added a comment to explain that this is not good enough for us. In the meantime, it would be useful if this was detected at/before LaTeX compilation and users given a slightly more helpful error message e.g. redirected to a wiki page. Otherwise they will probably go looking for a subscript package, as I did, and end up getting lost. I doubt too many people use text subscripts, but it could certainly be a source of confusion. Jim - Original Message From: Uwe Stöhr uwesto...@web.de To: LyX-Devel lyx-devel@lists.lyx.org Cc: jri...@physics.utoronto.ca Sent: Mon, 22 November, 2010 4:57:46 Subject: Re: [patch] fix bug 3008 OK, it is here on miktex 2.8 and also according to this page: http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I did not know that it was dropped in 2.9 and don't see a mention of this in the release notes. Thanks for the hint. It seems indeed to be a packaging error in 2.9. I will have a closer later today and report back. thanks and regards Uwe
Re: [patch] fix bug 3008
Here is the bug filed with MiKTeX, for ease of reference: http://sourceforge.net/tracker/index.php?func=detail=3114850_id=10783=110783 As I understand, there are two problems with MiKTeX: 1. There is no "fragments" package that includes the various fragments available, including "subscript.sty", in either MiKTeX 2.8 or 2.9 (or before). 2. The "fixltx2e" package has gone missing in MiKTeX 2.9. Uwe's bug with MiKTeX seems to have been targeted at problem 1. However the MiKTeX developers have realised that fixltx2e provides a textsubscript command and decided to change the bug to 2. I have added a comment to explain that this is not good enough for us. In the meantime, it would be useful if this was detected at/before LaTeX compilation and users given a slightly more helpful error message e.g. redirected to a wiki page. Otherwise they will probably go looking for a subscript package, as I did, and end up getting lost. I doubt too many people use text subscripts, but it could certainly be a source of confusion. Jim - Original Message > From: Uwe Stöhr <uwesto...@web.de> > To: LyX-Devel <lyx-devel@lists.lyx.org> > Cc: jri...@physics.utoronto.ca > Sent: Mon, 22 November, 2010 4:57:46 > Subject: Re: [patch] fix bug 3008 > > > OK, it is here on miktex 2.8 and also according to this page: > > http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html > > > > I did not know that it was dropped in 2.9 and don't see a mention of this > > in >the release notes. > > Thanks for the hint. It seems indeed to be a packaging error in 2.9. I will >have a closer later today and report back. > > thanks and regards > Uwe >
Re: [patch] fix bug 3008
On 2010-11-28, Georg Baum wrote: Jürgen Spitzmüller wrote: Guenter Milde wrote: If LyX policy is to follow LaTeX policy regarding stability, it's a bit more complicated: No it's not. Everybody can put the line in their preamble and make that the document default. I do not see why we should do anything here. It has always been good LyX policy not to do things behinf the user's back if not necessary. Actually it is slightly more complicated: If you put \usepackage{fixltx2e} into the preamble, and use text subscripts, you get a duplicate definition of \textsubscript. Therefore I added a fixltx2e module which can be used instead of the preamble line, and which prevents subscript.sty from being loaded. Instead of directly loading fixltx2e you can use this module in your default document, and always get fixltx2e. If you use custom classes you could even put the line Requires fixltx2e into your layout file to get the same result. I still think, fixltx2e should be used in all new documents by default, i.e. the choice should be an opt-out instead of an opt-in. Günter
Re: [patch] fix bug 3008
On 2010-11-28, Georg Baum wrote: > Jürgen Spitzmüller wrote: >> Guenter Milde wrote: >>> If LyX policy is to follow LaTeX policy regarding stability, it's a bit >>> more complicated: >> No it's not. Everybody can put the line in their preamble and make that >> the document default. I do not see why we should do anything here. It has >> always been good LyX policy not to do things behinf the user's back if not >> necessary. > Actually it is slightly more complicated: If you put \usepackage{fixltx2e} > into the preamble, and use text subscripts, you get a duplicate definition > of \textsubscript. Therefore I added a fixltx2e module which can be used > instead of the preamble line, and which prevents subscript.sty from being > loaded. > Instead of directly loading fixltx2e you can use this module in your default > document, and always get fixltx2e. If you use custom classes you could even > put the line > Requires fixltx2e > into your layout file to get the same result. I still think, fixltx2e should be used in all new documents by default, i.e. the choice should be an opt-out instead of an opt-in. Günter
Re: [patch] fix bug 3008
Guenter Milde wrote: If LyX policy is to follow LaTeX policy regarding stability, it's a bit more complicated: No it's not. Everybody can put the line in their preamble and make that the document default. I do not see why we should do anything here. It has always been good LyX policy not to do things behinf the user's back if not necessary. Jürgen
Re: [patch] fix bug 3008
Georg Baum wrote: Please use the fixltx2e package for \textsubscript: I did not do that on purpose. It has side effects, and the usage of a subscript should not cgange anything else. Actually, I agree with this. Jürgen
Re: [patch] fix bug 3008
Guenter Milde wrote: > If LyX policy is to follow LaTeX policy regarding stability, it's a bit > more complicated: No it's not. Everybody can put the line in their preamble and make that the document default. I do not see why we should do anything here. It has always been good LyX policy not to do things behinf the user's back if not necessary. Jürgen
Re: [patch] fix bug 3008
Georg Baum wrote: > > Please use the fixltx2e package for \textsubscript: > I did not do that on purpose. It has side effects, and the usage of a > subscript should not cgange anything else. Actually, I agree with this. Jürgen
Re: [patch] fix bug 3008
On 2010-11-19, Georg Baum wrote: Hi, after I needed to explain several times lately why one should not use the menu entries for sub/superscript in text and what to do instead, I finally sat down and completed a fix for bug 3008 that I started years ago. It implements a new inset for subscript and superscript in text mode, including correct output for all backends. There are some other ideas discussed in http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one IMO. ... +# these classes provide a \textsubscript command: +# FIXME: Would be nice if we could use the information of the .layout file here +classes = [memoir, scrartcl, scrbook, scrlttr2, scrreprt] +if foundsubscript and find_token_exact(classes, document.textclass, 0) == -1: +add_to_preamble(document, ['\\usepackage{subscript}']) Please use the fixltx2e package for \textsubscript: Provides a command \textsubscript , which is a modified version the command \textsuperscript that's part of LaTeX. The command is also (now) provided by the fixltx2e package distributed with LaTeX itself; if you are running a LaTeX distribution no earlier than 2005/12/01, you will have a more satisfactory means of using the command. -- http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=subscript I argue, that LyX-2 should by default *always* insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The quantum-leap from 1 to 2 would be a good place for this change: Identifierfixltx2e Caption Patches for LaTeX. Description LaTeX policy is that things should not change, between releases, in a way that will cause incompatibility with old documents, or will cause typesetting of an unchanged document to change. Nevertheless, there are problems in LaTeX that it “would be nice” to correct; fixltx2e provides a home for these corrections. Corrections in the current version are: * ensure one-column floats don't get ahead of two-column floats; * correct page headers in twocolumn documents; * stop spaces disappearing in moving arguments; * allowing \fnysmbol to use text symbols; * allow the first word after a float to hyphenate; * \emph can produce caps/small caps text; * bugs in \setlength and flushbottom. -- http://tug.ctan.org/pkg/fixltx2e Günter
Re: [patch] fix bug 3008
Guenter Milde wrote: I argue, that LyX-2 should by default always insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The quantum-leap from 1 to 2 would be a good place for this change: While I agree that fixltx2e is the correct package, we should no always insert it. There's a reason why these fixes have not been integrated into the kernel, and so we should also let the user decide here. Jürgen
Re: [patch] fix bug 3008
On 2010-11-22, Uwe Stöhr wrote: On 21/11/2010 5:20 PM, Uwe Stöhr wrote: That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. How about using \usepackage{fixltx2e} for providing \textsubscript? This one is shipped with miktex. As I said (you even cited this) fixltx2e is not available for MiKTeX, at last not under MiKTeX 2.9. This would be very strange: The package is distributed as part of LaTeX; the extracted package is also available on the archive (location linked here). -- http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I suppose it is not mentioned as extra download/extension because it is already part of every latex base install. Günter
Re: [patch] fix bug 3008
Le 21/11/2010 18:05, Georg Baum a écrit : Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) Could our in-LyX textclass parser be augmented to dump textclasses as python structs, so that lyx2lyx can read them effortlessly? We could run this dump-textclasses lfun from time to time to make sure that lyx2lyx has up-to-date information. JMarc
Re: [patch] fix bug 3008
On 11/22/2010 08:41 AM, Jean-Marc Lasgouttes wrote: Le 21/11/2010 18:05, Georg Baum a écrit : Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) Could our in-LyX textclass parser be augmented to dump textclasses as python structs, so that lyx2lyx can read them effortlessly? We could run this dump-textclasses lfun from time to time to make sure that lyx2lyx has up-to-date information. That's one idea, sure. Let me think about it. Richard
Re: [patch] fix bug 3008
On 2010-11-22, Jürgen Spitzmüller wrote: Guenter Milde wrote: I argue, that LyX-2 should by default always insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The quantum-leap from 1 to 2 would be a good place for this change: While I agree that fixltx2e is the correct package, we should no always insert it. There's a reason why these fixes have not been integrated into the kernel, and so we should also let the user decide here. The reason is bug-for-bug backwards compatibilty: old (originall latex09-) documents should convert without change. I.e. even without improvement if this carries the possibility of larger changes (e.g. different page-breaks): LaTeX policy is that things should not change, between releases, in a way that will cause incompatibility with old documents, or will cause typesetting of an unchanged document to change. I agree that we should provide for customization. If LyX policy is to follow LaTeX policy regarding stability, it's a bit more complicated: a) New documents should use fixltx2e by default. b) Old documents should not change: Use fixltx2e, if \usepackage{fixltx2e} is found in the user-preamble, else don't use it. c) Converting new documents to older LyXformats should place \usepackage{fixltx2e} in the user preable if use_fixltx2e is true. Disabling use fixltx2e would also disable the subscript inset (with a hint: requires fixltx2e ...) or we must ressort to including the literal definition from fixltx2e in this case. Günter
Re: [patch] fix bug 3008
Uwe Stöhr wrote: What is the problem with using that package? That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. That would be a bug in MikTeX. subscript.sty is meant to be used by other packages - How could that be done if it is not avilable? I provide LyX for Windows as one-click instalation. So you start the installer and at the end of the installation process, you have a full-equipped LyX, LaTeX environment and all necessary third-party programs. All LaTeX-packages needed by LyX are automatically installed when LyX is started the first time. This mechanism only works for packages available in MiKTeX. I can ask the MiKTeX maintainer to include subfigure but I can understand if he denies this. Please do that. With your current implementation I'm forced to ship the subfigure.sty with the installer and install it using installer code. This is a lot of extra work and becomes complicated for fresh installation (where MiKTeX is installed together with LyX). That's why I shout. LyX installs other files that should be visible by TeX (e.g. lyxchess.sty). Is adding one additional file really more effort than putting it into the installer archive and adding one line in the install script? In principle yes. As these lines are also used by other packages like KOMA-script and have not been touched at CTAN for 11 years we can assume them being stable to insert them directly via LyX. I would really prefer a packaging fix, because the bug is a packaging bug (of MiKTeX), but if you insist I can implement a fallback (using the package if available, else provide the command). What do others think? Georg
Re: [patch] fix bug 3008
Guenter Milde wrote: Please use the fixltx2e package for \textsubscript: I did not do that on purpose. It has side effects, and the usage of a subscript should not cgange anything else. It is bad enough that the usage of some math symbols of the wasy package has the side effect that e.g. integral signs may change. I argue, that LyX-2 should by default *always* insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The quantum-leap from 1 to 2 would be a good place for this change: I agree too that this package should be used, but that should be independent of subscripts, and it should be possible to switch it off. Furthermore I don't think that this should be done now (in order to get 2.0 out soon). The scripts problem did annoy many people, but you are the first one to mention fixltx2e. Georg
Re: [patch] fix bug 3008
On 11/22/2010 03:58 PM, Georg Baum wrote: Uwe Stöhr wrote: What is the problem with using that package? That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. That would be a bug in MikTeX. subscript.sty is meant to be used by other packages - How could that be done if it is not avilable?. I would really prefer a packaging fix, because the bug is a packaging bug (of MiKTeX), but if you insist I can implement a fallback (using the package if available, else provide the command). What do others think? I'm inclined to agree with you. I do not see why we need to work around this kind of bug at the LyX level. Richard
Re: [patch] fix bug 3008
Guenter Milde wrote: I argue, that LyX-2 should by default *always* insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The quantum-leap from 1 to 2 would be a good place for this change: I agree too that this package should be used, but that should be independent of subscripts, and it should be possible to switch it off. Furthermore I don't think that this should be done now (in order to get 2.0 out soon). The scripts problem did annoy many people, but you are the first one to mention fixltx2e. It's come up in other contexts. I can't remember which right now. But of course you are right, and this can easily be put on the radar for 2.1. Richard
Re: [patch] fix bug 3008
On 2010-11-19, Georg Baum wrote: > Hi, > after I needed to explain several times lately why one should not use the > menu entries for sub/superscript in text and what to do instead, I finally > sat down and completed a fix for bug 3008 that I started years ago. It > implements a new inset for subscript and superscript in text mode, including > correct output for all backends. There are some other ideas discussed in > http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one > IMO. ... > +# these classes provide a \textsubscript command: > +# FIXME: Would be nice if we could use the information of the .layout > file here > +classes = ["memoir", "scrartcl", "scrbook", "scrlttr2", "scrreprt"] > +if foundsubscript and find_token_exact(classes, document.textclass, 0) > == -1: > +add_to_preamble(document, ['\\usepackage{subscript}']) Please use the fixltx2e package for \textsubscript: Provides a command \textsubscript , which is a modified version the command \textsuperscript that's part of LaTeX. The command is also (now) provided by the fixltx2e package distributed with LaTeX itself; if you are running a LaTeX distribution no earlier than 2005/12/01, you will have a more satisfactory means of using the command. -- http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=subscript I argue, that LyX-2 should by default *always* insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The "quantum-leap" from 1 to 2 would be a good place for this change: Identifierfixltx2e Caption Patches for LaTeX. Description LaTeX policy is that things should not change, between releases, in a way that will cause incompatibility with old documents, or will cause typesetting of an unchanged document to change. Nevertheless, there are problems in LaTeX that it “would be nice” to correct; fixltx2e provides a home for these corrections. Corrections in the current version are: * ensure one-column floats don't get ahead of two-column floats; * correct page headers in twocolumn documents; * stop spaces disappearing in moving arguments; * allowing \fnysmbol to use text symbols; * allow the first word after a float to hyphenate; * \emph can produce caps/small caps text; * bugs in \setlength and flushbottom. -- http://tug.ctan.org/pkg/fixltx2e Günter
Re: [patch] fix bug 3008
Guenter Milde wrote: > I argue, that LyX-2 should by default always insert > \usepackage{fixltx2e}. This package collects a range of fixes and > improvements that are not not in the LaTeX core due to backwards > compatibility issues. The "quantum-leap" from 1 to 2 would be a good > place for this change: While I agree that fixltx2e is the correct package, we should no always insert it. There's a reason why these fixes have not been integrated into the kernel, and so we should also let the user decide here. Jürgen
Re: [patch] fix bug 3008
On 2010-11-22, Uwe Stöhr wrote: > > On 21/11/2010 5:20 PM, Uwe Stöhr wrote: > >> > >>That it is not included in MiKTeX, also not via the fragments or > >>fixltx2e package. Therefore all LyX on Windows would be forced to > >>install the file manually which is not acceptable. > > > > How about using > > > > \usepackage{fixltx2e} > > > > for providing \textsubscript? This one is shipped with miktex. > As I said (you even cited this) fixltx2e is not available for MiKTeX, > at last not under MiKTeX 2.9. This would be very strange: The package is distributed as part of LaTeX; the extracted package is also available on the archive (location linked here). -- http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I suppose it is not mentioned as extra download/extension because it is already part of every latex base install. Günter
Re: [patch] fix bug 3008
Le 21/11/2010 18:05, Georg Baum a écrit : Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) Could our in-LyX textclass parser be augmented to dump textclasses as python structs, so that lyx2lyx can read them effortlessly? We could run this "dump-textclasses" lfun from time to time to make sure that lyx2lyx has up-to-date information. JMarc
Re: [patch] fix bug 3008
On 11/22/2010 08:41 AM, Jean-Marc Lasgouttes wrote: Le 21/11/2010 18:05, Georg Baum a écrit : Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) Could our in-LyX textclass parser be augmented to dump textclasses as python structs, so that lyx2lyx can read them effortlessly? We could run this "dump-textclasses" lfun from time to time to make sure that lyx2lyx has up-to-date information. That's one idea, sure. Let me think about it. Richard
Re: [patch] fix bug 3008
On 2010-11-22, Jürgen Spitzmüller wrote: > Guenter Milde wrote: >> I argue, that LyX-2 should by default always insert >> \usepackage{fixltx2e}. This package collects a range of fixes and >> improvements that are not not in the LaTeX core due to backwards >> compatibility issues. The "quantum-leap" from 1 to 2 would be a good >> place for this change: > While I agree that fixltx2e is the correct package, we should no always > insert it. There's a reason why these fixes have not been integrated > into the kernel, and so we should also let the user decide here. The reason is bug-for-bug backwards compatibilty: old (originall latex09-) documents should convert without change. I.e. even without improvement if this carries the possibility of larger changes (e.g. different page-breaks): LaTeX policy is that things should not change, between releases, in a way that will cause incompatibility with old documents, or will cause typesetting of an unchanged document to change. I agree that we should provide for customization. If LyX policy is to follow LaTeX policy regarding stability, it's a bit more complicated: a) New documents should use fixltx2e by default. b) Old documents should not change: Use fixltx2e, if "\usepackage{fixltx2e}" is found in the user-preamble, else don't use it. c) Converting new documents to older LyXformats should place \usepackage{fixltx2e} in the user preable if "use_fixltx2e" is true. Disabling "use fixltx2e" would also disable the "subscript" inset (with a hint: requires fixltx2e ...) or we must ressort to including the literal definition from fixltx2e in this case. Günter
Re: [patch] fix bug 3008
Uwe Stöhr wrote: > > What is the problem with using that package? > > That it is not included in MiKTeX, also not via the fragments or fixltx2e > package. Therefore all LyX on Windows would be forced to install the file > manually which is not acceptable. That would be a bug in MikTeX. subscript.sty is meant to be used by other packages - How could that be done if it is not avilable? > I provide LyX for Windows as one-click instalation. So you start the > installer and at the end of the installation process, you have a > full-equipped LyX, LaTeX environment and all necessary third-party > programs. All LaTeX-packages needed by LyX are automatically installed > when LyX is started the first time. This mechanism only works for packages > available in MiKTeX. I can ask the MiKTeX maintainer to include subfigure > but I can understand if he denies this. Please do that. > With your current implementation I'm forced to ship the subfigure.sty with > the installer and install it using installer code. This is a lot of extra > work and becomes complicated for fresh installation (where MiKTeX is > installed together with LyX). That's why I shout. LyX installs other files that should be visible by TeX (e.g. lyxchess.sty). Is adding one additional file really more effort than putting it into the installer archive and adding one line in the install script? > In principle yes. As these lines are also used by other packages like > KOMA-script and have not been touched at CTAN for 11 years we can assume > them being stable to insert them directly via LyX. I would really prefer a packaging fix, because the bug is a packaging bug (of MiKTeX), but if you insist I can implement a fallback (using the package if available, else provide the command). What do others think? Georg
Re: [patch] fix bug 3008
Guenter Milde wrote: > Please use the fixltx2e package for \textsubscript: I did not do that on purpose. It has side effects, and the usage of a subscript should not cgange anything else. It is bad enough that the usage of some math symbols of the wasy package has the side effect that e.g. integral signs may change. > I argue, that LyX-2 should by default *always* insert > \usepackage{fixltx2e}. This package collects a range of fixes and > improvements that are not not in the LaTeX core due to backwards > compatibility issues. The "quantum-leap" from 1 to 2 would be a good > place for this change: I agree too that this package should be used, but that should be independent of subscripts, and it should be possible to switch it off. Furthermore I don't think that this should be done now (in order to get 2.0 out soon). The scripts problem did annoy many people, but you are the first one to mention fixltx2e. Georg
Re: [patch] fix bug 3008
On 11/22/2010 03:58 PM, Georg Baum wrote: Uwe Stöhr wrote: > What is the problem with using that package? That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. That would be a bug in MikTeX. subscript.sty is meant to be used by other packages - How could that be done if it is not avilable?. I would really prefer a packaging fix, because the bug is a packaging bug (of MiKTeX), but if you insist I can implement a fallback (using the package if available, else provide the command). What do others think? I'm inclined to agree with you. I do not see why we need to work around this kind of bug at the LyX level. Richard
Re: [patch] fix bug 3008
Guenter Milde wrote: I argue, that LyX-2 should by default *always* insert \usepackage{fixltx2e}. This package collects a range of fixes and improvements that are not not in the LaTeX core due to backwards compatibility issues. The "quantum-leap" from 1 to 2 would be a good place for this change: I agree too that this package should be used, but that should be independent of subscripts, and it should be possible to switch it off. Furthermore I don't think that this should be done now (in order to get 2.0 out soon). The scripts problem did annoy many people, but you are the first one to mention fixltx2e. It's come up in other contexts. I can't remember which right now. But of course you are right, and this can easily be put on the radar for 2.1. Richard
Re: [patch] fix bug 3008
Uwe Stöhr wrote: Am 20.11.2010 19:57, schrieb Georg Baum: This is possible (using the insert inset and move selection inside mechanism and inset-dissolve internally), but would be more risk, so I'd like to postpone this. If you want a more visible place you could put the scripts into a toolbar. Removing a script is already very easy with inset- dissolve (pressing backspace at the first position). But we need a method to change existing text to be a superscript text via a dialog. LyX is really the only word processor I know that doesn't provide this. A toolbar might be a workaround but as user I would expect that i can do this in the text style dialog too. As a first step, I committed what I had. This is much better than the previous solution. As I wrote, modifying the font dialog will be more risky, and should not be done now IMHO. Of course one could produce an additional dialog without much risk, but then I don't understand why that would be needed, since it would also be different from the usual office packages. I found another, important issue: you are using \usepackage{subscript} but subscript is not a real LaTeX-package (the author calls it a fragment) and therefore not installable via the package managers of TeXLive and MiKTeX: http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html This is not true. This file is included in the fragments package in TeXLive, and I believe also in MikTeX. Also the file contains the lines % the fragment may be used as a package in its own right, if so % needed. What is the problem with using that package? But the subscript.sty file contains of only 4 lines, the ones I proposed in comment 3 of #3008: \DeclareRobustCommand*\textsubscript[1]{% \...@textsubscript{\selectfont#1}} \d...@textsubscript#1{% {...@th\ensuremath{_{\mbox{\fontsize\sf@siz...@#1} (These lines are also used by Koma-script.) So we must insert these lines instad of using subscript.sty. This is wrong IMO. There is a package for this purpose, so we should use it. The less LaTeX hardcoding in LyX, the better. I added a note about the fragments package to LaTeXConfig.lyx, so that users will find it more easily. Georg
Re: [patch] fix bug 3008
Enrico Forestieri wrote: I wonder why you also disable nested script insets, given that things such as a\textsuperscript{1\textsubscript{2}} seem to work well. I thought it did not work, but it does indeed work. I allowed it now. The font size does not become smaller anymore with a depth of more than 2 (both in LyX and in the output), but that is expected. Georg
Re: [patch] fix bug 3008
Richard Heck wrote: Index: lib/lyx2lyx/lyx_2_0.py === --- lib/lyx2lyx/lyx_2_0.py (revision 36398) +++ lib/lyx2lyx/lyx_2_0.py (working copy) +# FIXME: Would be nice if we could use the information of the .layout file here +classes = [memoir, scrartcl, scrbook, scrlttr2, scrreprt] Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) I take it that this means that these layouts should have a: Provides subscript 1 tag, so that we don't issue \usepackage{subscript} for them? They do have that. It simply means that it would be nicer not to hardcode this knowledge in lyx2lyx. Georg
Re: [patch] fix bug 3008
I found another, important issue: you are using \usepackage{subscript} but subscript is not a real LaTeX-package (the author calls it a fragment) and therefore not installable via the package managers of TeXLive and MiKTeX: http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html This is not true. This file is included in the fragments package in TeXLive, and I believe also in MikTeX. Also the file contains the lines % the fragment may be used as a package in its own right, if so % needed. What is the problem with using that package? That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. I provide LyX for Windows as one-click instalation. So you start the installer and at the end of the installation process, you have a full-equipped LyX, LaTeX environment and all necessary third-party programs. All LaTeX-packages needed by LyX are automatically installed when LyX is started the first time. This mechanism only works for packages available in MiKTeX. I can ask the MiKTeX maintainer to include subfigure but I can understand if he denies this. With your current implementation I'm forced to ship the subfigure.sty with the installer and install it using installer code. This is a lot of extra work and becomes complicated for fresh installation (where MiKTeX is installed together with LyX). That's why I shout. So we must insert these lines instead of using subscript.sty. This is wrong IMO. There is a package for this purpose, so we should use it. The less LaTeX hardcoding in LyX, the better. I added a note about the fragments package to LaTeXConfig.lyx, so that users will find it more easily. In principle yes. As these lines are also used by other packages like KOMA-script and have not been touched at CTAN for 11 years we can assume them being stable to insert them directly via LyX. regards Uwe
Re: [patch] fix bug 3008
On 21/11/2010 5:20 PM, Uwe Stöhr wrote: That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. How about using \usepackage{fixltx2e} for providing \textsubscript? This one is shipped with miktex. -- Julien
Re: [patch] fix bug 3008
Georg Baum wrote: As a first step, I committed what I had. This is much better than the nice, please put some item or picture in http://wiki.lyx.org/LyX/NewInLyX20 pavel
Re: [patch] fix bug 3008
On 21/11/2010 5:20 PM, Uwe Stöhr wrote: That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. How about using \usepackage{fixltx2e} for providing \textsubscript? This one is shipped with miktex. As I said (you even cited this) fixltx2e is not available for MiKTeX, at last not under MiKTeX 2.9. regards Uwe
Re: [patch] fix bug 3008
On 21/11/2010 9:10 PM, Uwe Stöhr wrote: As I said (you even cited this) fixltx2e is not available for MiKTeX, at last not under MiKTeX 2.9. OK, it is here on miktex 2.8 and also according to this page: http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I did not know that it was dropped in 2.9 and don't see a mention of this in the release notes. -- Julien
Re: [patch] fix bug 3008
OK, it is here on miktex 2.8 and also according to this page: http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I did not know that it was dropped in 2.9 and don't see a mention of this in the release notes. Thanks for the hint. It seems indeed to be a packaging error in 2.9. I will have a closer later today and report back. thanks and regards Uwe
Re: [patch] fix bug 3008
Uwe Stöhr wrote: > Am 20.11.2010 19:57, schrieb Georg Baum: >> >> This is possible (using the "insert inset and move selection inside" >> mechanism and inset-dissolve internally), but would be more risk, so I'd >> like to postpone this. If you want a more visible place you could put the >> scripts into a toolbar. Removing a script is already very easy with >> inset- dissolve (pressing backspace at the first position). > > But we need a method to change existing text to be a superscript text via > a dialog. LyX is really the only word processor I know that doesn't > provide this. A toolbar might be a workaround but as user I would expect > that i can do this in the text style dialog too. As a first step, I committed what I had. This is much better than the previous solution. As I wrote, modifying the font dialog will be more risky, and should not be done now IMHO. Of course one could produce an additional dialog without much risk, but then I don't understand why that would be needed, since it would also be different from the usual office packages. > I found another, important issue: > > you are using \usepackage{subscript} but subscript is not a real > LaTeX-package (the author calls it a fragment) and therefore not > installable via the package managers of TeXLive and MiKTeX: > http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html This is not true. This file is included in the "fragments" package in TeXLive, and I believe also in MikTeX. Also the file contains the lines % the fragment may be used as a package in its own right, if so % needed. What is the problem with using that package? > But the subscript.sty file contains of only 4 lines, the ones I proposed > in comment 3 of #3008: > > \DeclareRobustCommand*\textsubscript[1]{% >\...@textsubscript{\selectfont#1}} > \d...@textsubscript#1{% >{...@th\ensuremath{_{\mbox{\fontsize\sf@siz...@#1} > > (These lines are also used by Koma-script.) > So we must insert these lines instad of using subscript.sty. This is wrong IMO. There is a package for this purpose, so we should use it. The less LaTeX hardcoding in LyX, the better. I added a note about the "fragments" package to LaTeXConfig.lyx, so that users will find it more easily. Georg
Re: [patch] fix bug 3008
Enrico Forestieri wrote: > I wonder why you also disable nested script insets, given that things > such as a\textsuperscript{1\textsubscript{2}} seem to work well. I thought it did not work, but it does indeed work. I allowed it now. The font size does not become smaller anymore with a depth of more than 2 (both in LyX and in the output), but that is expected. Georg
Re: [patch] fix bug 3008
Richard Heck wrote: >> Index: lib/lyx2lyx/lyx_2_0.py >> === >> --- lib/lyx2lyx/lyx_2_0.py (revision 36398) >> +++ lib/lyx2lyx/lyx_2_0.py (working copy) >> >> >> +# FIXME: Would be nice if we could use the information of the >> .layout file here >> +classes = ["memoir", "scrartcl", "scrbook", "scrlttr2", "scrreprt"] >> > Yeah. I run into this a lot these days. But then I think: Do I really want > to write a layout parser for lyx2lyx? These were exactly my thoughts. Nevertheless, it would be nice to have one :-) > I take it that this means that these layouts should have a: > Provides subscript 1 > tag, so that we don't issue \usepackage{subscript} for them? They do have that. It simply means that it would be nicer not to hardcode this knowledge in lyx2lyx. Georg
Re: [patch] fix bug 3008
>> I found another, important issue: >> >> you are using \usepackage{subscript} but subscript is not a real >> LaTeX-package (the author calls it a fragment) and therefore not >> installable via the package managers of TeXLive and MiKTeX: >> http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html > > This is not true. This file is included in the "fragments" package in > TeXLive, and I believe also in MikTeX. Also the file contains the lines > % the fragment may be used as a package in its own right, if so > % needed. > > What is the problem with using that package? That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. I provide LyX for Windows as one-click instalation. So you start the installer and at the end of the installation process, you have a full-equipped LyX, LaTeX environment and all necessary third-party programs. All LaTeX-packages needed by LyX are automatically installed when LyX is started the first time. This mechanism only works for packages available in MiKTeX. I can ask the MiKTeX maintainer to include subfigure but I can understand if he denies this. With your current implementation I'm forced to ship the subfigure.sty with the installer and install it using installer code. This is a lot of extra work and becomes complicated for fresh installation (where MiKTeX is installed together with LyX). That's why I shout. >> So we must insert these lines instead of using subscript.sty. > > This is wrong IMO. There is a package for this purpose, so we should use it. > The less LaTeX hardcoding in LyX, the better. I added a note about the > "fragments" package to LaTeXConfig.lyx, so that users will find it more > easily. In principle yes. As these lines are also used by other packages like KOMA-script and have not been touched at CTAN for 11 years we can assume them being stable to insert them directly via LyX. regards Uwe
Re: [patch] fix bug 3008
On 21/11/2010 5:20 PM, Uwe Stöhr wrote: That it is not included in MiKTeX, also not via the fragments or fixltx2e package. Therefore all LyX on Windows would be forced to install the file manually which is not acceptable. How about using \usepackage{fixltx2e} for providing \textsubscript? This one is shipped with miktex. -- Julien
Re: [patch] fix bug 3008
Georg Baum wrote: > As a first step, I committed what I had. This is much better than the nice, please put some item or picture in http://wiki.lyx.org/LyX/NewInLyX20 pavel
Re: [patch] fix bug 3008
> On 21/11/2010 5:20 PM, Uwe Stöhr wrote: >> >>That it is not included in MiKTeX, also not via the fragments or >>fixltx2e package. Therefore all LyX on Windows would be forced to >>install the file manually which is not acceptable. > > How about using > > \usepackage{fixltx2e} > > for providing \textsubscript? This one is shipped with miktex. As I said (you even cited this) fixltx2e is not available for MiKTeX, at last not under MiKTeX 2.9. regards Uwe
Re: [patch] fix bug 3008
On 21/11/2010 9:10 PM, Uwe Stöhr wrote: As I said (you even cited this) fixltx2e is not available for MiKTeX, at last not under MiKTeX 2.9. OK, it is here on miktex 2.8 and also according to this page: http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html I did not know that it was dropped in 2.9 and don't see a mention of this in the release notes. -- Julien
Re: [patch] fix bug 3008
> OK, it is here on miktex 2.8 and also according to this page: > http://www.ctan.org/tex-archive/help/Catalogue/entries/fixltx2e.html > > I did not know that it was dropped in 2.9 and don't see a mention of this in the release notes. Thanks for the hint. It seems indeed to be a packaging error in 2.9. I will have a closer later today and report back. thanks and regards Uwe
Re: [patch] fix bug 3008
On Fri, Nov 19, 2010 at 10:29:53PM +0100, Georg Baum wrote: The attached patch has no known problems (the cursor position problem mentioned in trac is fixed). I see a couple of glitches. - Whenever the cursor moves in the script, the following warning is issued: ../../../../src/frontends/qt4/LayoutBox.cpp(551): Trying to select non existent layout type Standard - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. -- Enrico
Re: [patch] fix bug 3008
Am 20.11.2010 15:30, schrieb Enrico Forestieri: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. The only inset that must be further disabled is the box inset. (minipages within superscripts lead to LaTeX errors) regards Uwe
Re: [patch] fix bug 3008
Am 20.11.2010 17:28, schrieb Uwe Stöhr: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. I was too rash here: - inline math works, also AMS stuff - displayed math lead in every case to LaTeX errors. As having math in sub/superscripts is quite strange, I think we should disable math in general there. regards Uwe
Re: [patch] fix bug 3008
Am 20.11.2010 17:28, schrieb Uwe Stöhr: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. I was too rash here: - inline math works, also AMS stuff - displayed math lead in every case to LaTeX errors. As having math in sub/superscripts is quite strange, I think we should disable math in general there. regards Uwe
Re: [patch] fix bug 3008
On Sat, Nov 20, 2010 at 07:57:30PM +0100, Georg Baum wrote: The other problems mentioned by Enrico and you are fixed by the attached patch. I prevented the insertion of some more insets (I hope I got all that are needed). I wonder why you also disable nested script insets, given that things such as a\textsuperscript{1\textsubscript{2}} seem to work well. -- Enrico
Re: [patch] fix bug 3008
Looks great, Georg, and thanks for paying attention to the xhtml output. Index: src/insets/InsetScript.cpp === --- src/insets/InsetScript.cpp (revision 0) +++ src/insets/InsetScript.cpp (revision 0) @@ -0,0 +1,464 @@ +/** + * \file InsetScript.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Uwe Stöhr + * As someone mentioned, CP error. And in .h. Index: lib/lyx2lyx/lyx_2_0.py === --- lib/lyx2lyx/lyx_2_0.py (revision 36398) +++ lib/lyx2lyx/lyx_2_0.py (working copy) +# FIXME: Would be nice if we could use the information of the .layout file here +classes = [memoir, scrartcl, scrbook, scrlttr2, scrreprt] Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? I take it that this means that these layouts should have a: Provides subscript 1 tag, so that we don't issue \usepackage{subscript} for them? Richard
Re: [patch] fix bug 3008
Am 20.11.2010 19:57, schrieb Georg Baum: The repeated script is not nice, but this is the way how inset parameters work in general (the first is the inset type, the second is the parameter type). It can't be changed easily and certainly not at this time. Therefore, the images need this ugly name. Shall I introduce a specialized LFUN script- insert? This would look nicer, but I thought it was not needed, since inset- insert works perfectly. OK, then leave it. - Changing text from/to subscript should also be possible via the text style dialog. Users expect this because Word/OpenOffice and Co. also provide this. This is possible (using the insert inset and move selection inside mechanism and inset-dissolve internally), but would be more risk, so I'd like to postpone this. If you want a more visible place you could put the scripts into a toolbar. Removing a script is already very easy with inset- dissolve (pressing backspace at the first position). But we need a method to change existing text to be a superscript text via a dialog. LyX is really the only word processor I know that doesn't provide this. A toolbar might be a workaround but as user I would expect that i can do this in the text style dialog too. If somebody discovers a problem I'll certainly try to fix it as quickly as possible. I found another, important issue: you are using \usepackage{subscript} but subscript is not a real LaTeX-package (the author calls it a fragment) and therefore not installable via the package managers of TeXLive and MiKTeX: http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html But the subscript.sty file contains of only 4 lines, the ones I proposed in comment 3 of #3008: \DeclareRobustCommand*\textsubscript[1]{% \...@textsubscript{\selectfont#1}} \d...@textsubscript#1{% {...@th\ensuremath{_{\mbox{\fontsize\sf@siz...@#1} (These lines are also used by Koma-script.) So we must insert these lines instad of using subscript.sty. regards Uwe
Re: [patch] fix bug 3008
On Fri, Nov 19, 2010 at 10:29:53PM +0100, Georg Baum wrote: > The attached patch has no known problems (the cursor position problem > mentioned in trac is fixed). I see a couple of glitches. - Whenever the cursor moves in the script, the following warning is issued: ../../../../src/frontends/qt4/LayoutBox.cpp(551): Trying to select non existent layout type Standard - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. -- Enrico
Re: [patch] fix bug 3008
Am 20.11.2010 15:30, schrieb Enrico Forestieri: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. The only inset that must be further disabled is the box inset. (minipages within superscripts lead to LaTeX errors) regards Uwe
Re: [patch] fix bug 3008
Am 20.11.2010 17:28, schrieb Uwe Stöhr: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. I was too rash here: - inline math works, also AMS stuff - displayed math lead in every case to LaTeX errors. As having math in sub/superscripts is quite strange, I think we should disable math in general there. regards Uwe
Re: [patch] fix bug 3008
Am 20.11.2010 17:28, schrieb Uwe Stöhr: - It is possible to insert in the script inset things that cause latex errors. For example, one can insert a math display inset. I tested this and inserting math is valid and works. I was too rash here: - inline math works, also AMS stuff - displayed math lead in every case to LaTeX errors. As having math in sub/superscripts is quite strange, I think we should disable math in general there. regards Uwe
Re: [patch] fix bug 3008
On Sat, Nov 20, 2010 at 07:57:30PM +0100, Georg Baum wrote: > The other problems mentioned by Enrico and you are fixed by the attached > patch. I prevented the insertion of some more insets (I hope I got all that > are needed). I wonder why you also disable nested script insets, given that things such as a\textsuperscript{1\textsubscript{2}} seem to work well. -- Enrico
Re: [patch] fix bug 3008
Looks great, Georg, and thanks for paying attention to the xhtml output. Index: src/insets/InsetScript.cpp === --- src/insets/InsetScript.cpp (revision 0) +++ src/insets/InsetScript.cpp (revision 0) @@ -0,0 +1,464 @@ +/** + * \file InsetScript.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Uwe Stöhr + * As someone mentioned, C error. And in .h. Index: lib/lyx2lyx/lyx_2_0.py === --- lib/lyx2lyx/lyx_2_0.py (revision 36398) +++ lib/lyx2lyx/lyx_2_0.py (working copy) +# FIXME: Would be nice if we could use the information of the .layout file here +classes = ["memoir", "scrartcl", "scrbook", "scrlttr2", "scrreprt"] Yeah. I run into this a lot these days. But then I think: Do I really want to write a layout parser for lyx2lyx? I take it that this means that these layouts should have a: Provides subscript 1 tag, so that we don't issue \usepackage{subscript} for them? Richard
Re: [patch] fix bug 3008
Am 20.11.2010 19:57, schrieb Georg Baum: The repeated "script" is not nice, but this is the way how inset parameters work in general (the first is the inset type, the second is the parameter type). It can't be changed easily and certainly not at this time. Therefore, the images need this ugly name. Shall I introduce a specialized LFUN script- insert? This would look nicer, but I thought it was not needed, since inset- insert works perfectly. OK, then leave it. - Changing text from/to subscript should also be possible via the text style dialog. Users expect this because Word/OpenOffice and Co. also provide this. This is possible (using the "insert inset and move selection inside" mechanism and inset-dissolve internally), but would be more risk, so I'd like to postpone this. If you want a more visible place you could put the scripts into a toolbar. Removing a script is already very easy with inset- dissolve (pressing backspace at the first position). But we need a method to change existing text to be a superscript text via a dialog. LyX is really the only word processor I know that doesn't provide this. A toolbar might be a workaround but as user I would expect that i can do this in the text style dialog too. If somebody discovers a problem I'll certainly try to fix it as quickly as possible. I found another, important issue: you are using \usepackage{subscript} but subscript is not a real LaTeX-package (the author calls it a fragment) and therefore not installable via the package managers of TeXLive and MiKTeX: http://www.ctan.org/tex-archive/help/Catalogue/entries/subscript.html But the subscript.sty file contains of only 4 lines, the ones I proposed in comment 3 of #3008: \DeclareRobustCommand*\textsubscript[1]{% \...@textsubscript{\selectfont#1}} \d...@textsubscript#1{% {...@th\ensuremath{_{\mbox{\fontsize\sf@siz...@#1} (These lines are also used by Koma-script.) So we must insert these lines instad of using subscript.sty. regards Uwe
[patch] fix bug 3008
Hi, after I needed to explain several times lately why one should not use the menu entries for sub/superscript in text and what to do instead, I finally sat down and completed a fix for bug 3008 that I started years ago. It implements a new inset for subscript and superscript in text mode, including correct output for all backends. There are some other ideas discussed in http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one IMO. The attached patch has no known problems (the cursor position problem mentioned in trac is fixed). May the patch go in at this stage (I don't know how the current policy is)? The risk of breakage is close to zero. The only code that is touched besides the new inset is the cursor positioning in Text::dispatch() after inserting a new inset: If the inset is a text inset, the inset is entered instead of positioning it behind the inset, since this is consistent with ERT insets etc. GeorgIndex: development/scons/scons_manifest.py === --- development/scons/scons_manifest.py (revision 36398) +++ development/scons/scons_manifest.py (working copy) @@ -1057,6 +1057,7 @@ src_insets_header_files = Split(''' InsetPreview.h InsetQuotes.h InsetRef.h +InsetScript.h InsetSpace.h InsetSpecialChar.h InsetTOC.h @@ -1113,6 +1114,7 @@ src_insets_files = Split(''' InsetPreview.cpp InsetQuotes.cpp InsetRef.cpp +InsetScript.cpp InsetSpace.cpp InsetSpecialChar.cpp InsetTOC.cpp @@ -1499,6 +1501,8 @@ lib_images_files = Split(''' href-insert.png hidetab.png index-insert.png +inset-insert_script_script_subscript.png +inset-insert_script_script_superscript.png info-insert_buffer_vcs-revision.png label-insert.png layout-document.png Index: development/qmake/lyx.pro === --- development/qmake/lyx.pro (revision 36398) +++ development/qmake/lyx.pro (working copy) @@ -189,6 +189,7 @@ SOURCES += \ ../../src/insets/InsetPhantom.cpp \ ../../src/insets/InsetQuotes.cpp \ ../../src/insets/InsetRef.cpp \ +../../src/insets/InsetScript.cpp \ ../../src/insets/InsetSpace.cpp \ ../../src/insets/InsetSpecialChar.cpp \ ../../src/insets/InsetTabular.cpp \ @@ -531,6 +532,7 @@ HEADERS += \ ../../src/insets/InsetQuotes.h \ ../../src/insets/InsetPhantom.h \ ../../src/insets/InsetRef.h \ +../../src/insets/InsetScript.h \ ../../src/insets/InsetSpace.h \ ../../src/insets/InsetSpecialChar.h \ ../../src/insets/InsetTOC.h \ Index: src/LyXAction.cpp === --- src/LyXAction.cpp (revision 36398) +++ src/LyXAction.cpp (working copy) @@ -1594,7 +1594,7 @@ void LyXAction::init() { LFUN_MATH_SUBSCRIPT, math-subscript, Noop, Math }, /*! * \var lyx::FuncCode lyx::LFUN_MATH_SUPERSCRIPT - * \li Action: Enters subscript expression in math expression. + * \li Action: Enters superscript expression in math expression. * \li Syntax: math-superscript * \li Origin: vermeer, 12 Dec 2001 * \endvar @@ -2297,7 +2297,7 @@ void LyXAction::init() * \li Action: Insert new inset (type given by the parameters). * \li Syntax: inset-insert INSET ARGS * \li Params: INSET: bibitem|bibtex|cite|ert|listings|external|graphics|tabular| - hyperlink|include|index|label|line|nomencl|vspace|ref|toc\n + hyperlink|include|index|label|line|nomencl|vspace|ref|toc|script\n ARGS: depends on the given inset. Use lyx -dbg action to explore. * \li Sample: inset-insert ref LatexCommand Format reference label name\end_inset \n where label name is the name of the referenced label and Index: src/insets/InsetScript.h === --- src/insets/InsetScript.h (revision 0) +++ src/insets/InsetScript.h (revision 0) @@ -0,0 +1,127 @@ +// -*- C++ -*- +/** + * \file InsetScript.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Uwe Stöhr + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef INSET_SCRIPT_H +#define INSET_SCRIPT_H + +#include InsetText.h + + +namespace lyx { + +class InsetScriptParams +{ +public: + enum Type { + Subscript, + Superscript + }; + /// \c type defaults to Subscript + InsetScriptParams(); + /// + void write(std::ostream os) const; + /// + void read(Lexer lex); + /// + int shift(FontInfo const font) const; + /// + Type type; +}; + + +/ +// +// InsetScript +// +/ + +/// The subscript and superscript inset +class InsetScript : public InsetText +{ +public: + /// + InsetScript(Buffer *, InsetScriptParams const = InsetScriptParams()); + ///
Re: [patch] fix bug 3008
Georg Baum wrote: May the patch go in at this stage (I don't know how the current policy is)? The risk of breakage is close to zero. the current stage is stop for refactoring and enhacenments, with the remark that small things which do not touch sensitive or large area of code can be allowed if we agree on it. since i trust your guess about breakage probability i'm open to let this in -- if you intend to roam around and fix potential issues - otherwise it needs to wait for 2.1, people have already lot of problems with their own bugs to be polished for 2.0... for the patch itself people might have some other remarks (currently i see you forgot Uwe's name in headers). pavel ps: you still have commit access iirc, right?
Re: [patch] fix bug 3008
Am 19.11.2010 22:29, schrieb Georg Baum: It implements a new inset for subscript and superscript in text mode, including correct output for all backends. There are some other ideas discussed in http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one IMO. Almost perfect! I stress-tested your patch and it works very in all situations that came into my mind. However, some minor annotations: - I would rename the images from inset-insert_script_script_***script.png to inset-insert_script_***script.png - The images are not yet used. Where do you plan to use them? - Changing text from/to subscript should also be possible via the text style dialog. Users expect this because Word/OpenOffice and Co. also provide this. May the patch go in at this stage (I don't know how the current policy is)? The risk of breakage is close to zero. The only code that is touched besides the new inset is the cursor positioning in Text::dispatch() after inserting a new inset: If the inset is a text inset, the inset is entered instead of positioning it behind the inset, since this is consistent with ERT insets etc. I fully support you here. Sub/superscript is an essential feature for a word processor and we only provide a hack. I know that this feature is a bit late since beta1 is out, but it is indeed very low risk applying it. I also assume that you will fix probable bugs in this feature quickly as Pavel requested. So I vote to include it. Jürgen also voted for it in the bug report. best regards Uwe p.s. I hope you will return at least from time to time to LyX. We really need your strong knowledge and exact working style. I remember your patches as always well tested with clean and well understandable! code.
[patch] fix bug 3008
Hi, after I needed to explain several times lately why one should not use the menu entries for sub/superscript in text and what to do instead, I finally sat down and completed a fix for bug 3008 that I started years ago. It implements a new inset for subscript and superscript in text mode, including correct output for all backends. There are some other ideas discussed in http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one IMO. The attached patch has no known problems (the cursor position problem mentioned in trac is fixed). May the patch go in at this stage (I don't know how the current policy is)? The risk of breakage is close to zero. The only code that is touched besides the new inset is the cursor positioning in Text::dispatch() after inserting a new inset: If the inset is a text inset, the inset is entered instead of positioning it behind the inset, since this is consistent with ERT insets etc. GeorgIndex: development/scons/scons_manifest.py === --- development/scons/scons_manifest.py (revision 36398) +++ development/scons/scons_manifest.py (working copy) @@ -1057,6 +1057,7 @@ src_insets_header_files = Split(''' InsetPreview.h InsetQuotes.h InsetRef.h +InsetScript.h InsetSpace.h InsetSpecialChar.h InsetTOC.h @@ -1113,6 +1114,7 @@ src_insets_files = Split(''' InsetPreview.cpp InsetQuotes.cpp InsetRef.cpp +InsetScript.cpp InsetSpace.cpp InsetSpecialChar.cpp InsetTOC.cpp @@ -1499,6 +1501,8 @@ lib_images_files = Split(''' href-insert.png hidetab.png index-insert.png +inset-insert_script_script_subscript.png +inset-insert_script_script_superscript.png info-insert_buffer_vcs-revision.png label-insert.png layout-document.png Index: development/qmake/lyx.pro === --- development/qmake/lyx.pro (revision 36398) +++ development/qmake/lyx.pro (working copy) @@ -189,6 +189,7 @@ SOURCES += \ ../../src/insets/InsetPhantom.cpp \ ../../src/insets/InsetQuotes.cpp \ ../../src/insets/InsetRef.cpp \ +../../src/insets/InsetScript.cpp \ ../../src/insets/InsetSpace.cpp \ ../../src/insets/InsetSpecialChar.cpp \ ../../src/insets/InsetTabular.cpp \ @@ -531,6 +532,7 @@ HEADERS += \ ../../src/insets/InsetQuotes.h \ ../../src/insets/InsetPhantom.h \ ../../src/insets/InsetRef.h \ +../../src/insets/InsetScript.h \ ../../src/insets/InsetSpace.h \ ../../src/insets/InsetSpecialChar.h \ ../../src/insets/InsetTOC.h \ Index: src/LyXAction.cpp === --- src/LyXAction.cpp (revision 36398) +++ src/LyXAction.cpp (working copy) @@ -1594,7 +1594,7 @@ void LyXAction::init() { LFUN_MATH_SUBSCRIPT, "math-subscript", Noop, Math }, /*! * \var lyx::FuncCode lyx::LFUN_MATH_SUPERSCRIPT - * \li Action: Enters subscript expression in math expression. + * \li Action: Enters superscript expression in math expression. * \li Syntax: math-superscript * \li Origin: vermeer, 12 Dec 2001 * \endvar @@ -2297,7 +2297,7 @@ void LyXAction::init() * \li Action: Insert new inset (type given by the parameters). * \li Syntax: inset-insert * \li Params: :\n + hyperlink|include|index|label|line|nomencl|vspace|ref|toc|script>\n : depends on the given inset. Use "lyx -dbg action" to explore. * \li Sample: inset-insert ref LatexCommand reference ""\end_inset \n where is the name of the referenced label and Index: src/insets/InsetScript.h === --- src/insets/InsetScript.h (revision 0) +++ src/insets/InsetScript.h (revision 0) @@ -0,0 +1,127 @@ +// -*- C++ -*- +/** + * \file InsetScript.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Uwe Stöhr + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef INSET_SCRIPT_H +#define INSET_SCRIPT_H + +#include "InsetText.h" + + +namespace lyx { + +class InsetScriptParams +{ +public: + enum Type { + Subscript, + Superscript + }; + /// \c type defaults to Subscript + InsetScriptParams(); + /// + void write(std::ostream & os) const; + /// + void read(Lexer & lex); + /// + int shift(FontInfo const & font) const; + /// + Type type; +}; + + +/ +// +// InsetScript +// +/ + +/// The subscript and superscript inset +class InsetScript : public InsetText +{ +public: + /// + InsetScript(Buffer *, InsetScriptParams const & = InsetScriptParams()); + /// + InsetScript(Buffer *,
Re: [patch] fix bug 3008
Georg Baum wrote: > May the patch go in at this stage (I don't know > how the current policy is)? The risk of breakage is close to zero. the current stage is stop for refactoring and enhacenments, with the remark that small things which do not touch sensitive or large area of code can be allowed if we agree on it. since i trust your guess about breakage probability i'm open to let this in -- if you intend to roam around and fix potential issues - otherwise it needs to wait for 2.1, people have already lot of problems with their own bugs to be polished for 2.0... for the patch itself people might have some other remarks (currently i see you forgot Uwe's name in headers). pavel ps: you still have commit access iirc, right?
Re: [patch] fix bug 3008
Am 19.11.2010 22:29, schrieb Georg Baum: It implements a new inset for subscript and superscript in text mode, including correct output for all backends. There are some other ideas discussed in http://www.lyx.org/trac/ticket/3008, but the inset approach is the best one IMO. Almost perfect! I stress-tested your patch and it works very in all situations that came into my mind. However, some minor annotations: - I would rename the images from inset-insert_script_script_***script.png to inset-insert_script_***script.png - The images are not yet used. Where do you plan to use them? - Changing text from/to subscript should also be possible via the text style dialog. Users expect this because Word/OpenOffice and Co. also provide this. May the patch go in at this stage (I don't know how the current policy is)? The risk of breakage is close to zero. The only code that is touched besides the new inset is the cursor positioning in Text::dispatch() after inserting a new inset: If the inset is a text inset, the inset is entered instead of positioning it behind the inset, since this is consistent with ERT insets etc. I fully support you here. Sub/superscript is an essential feature for a word processor and we only provide a hack. I know that this feature is a bit late since beta1 is out, but it is indeed very low risk applying it. I also assume that you will fix probable bugs in this feature quickly as Pavel requested. So I vote to include it. Jürgen also voted for it in the bug report. best regards Uwe p.s. I hope you will return at least from time to time to LyX. We really need your strong knowledge and exact working style. I remember your patches as always well tested with clean and well understandable! code.