Re: Missing features in Flex insets and style definition question
Le 19/07/2011 03:21, Uwe Stöhr a écrit : This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Looks like a very badly coded macro, then. It might be easier to fix the problem there. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 10:15, schrieb Jean-Marc Lasgouttes: This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Looks like a very badly coded macro, then. No, these cases occur often. They are also not badly coded but standard and valid LaTeX that commands affect the paragraph they are in. As said, we already support such LaTeX commands via InsetLayout, but we need to add for InsetLayout also the support of arguments. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) Will you do this or is this something for Richard? Should I open an enhancement bug report? regards Uwe
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 13:47, Uwe Stöhr a écrit : No, these cases occur often. They are also not badly coded but standard and valid LaTeX that commands affect the paragraph they are in. What typical examples do you have in mind? JMarc
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 13:47, Uwe Stöhr a écrit : Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) Will you do this or is this something for Richard? Should I open an enhancement bug report? I do not think I will have time to do it, unfortunately. JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 14:23, schrieb Jean-Marc Lasgouttes: Le 19/07/2011 13:47, Uwe Stöhr a écrit : No, these cases occur often. They are also not badly coded but standard and valid LaTeX that commands affect the paragraph they are in. What typical examples do you have in mind? Pictures in paragraphs (e.g. via picins, picinpar), wrapped floats, initials, email commands, address formatting commands, various scientific paper titling commands, ... regards Uwe
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 14:28, Uwe Stöhr a écrit : Pictures in paragraphs (e.g. via picins, picinpar), wrapped floats, initials, email commands, address formatting commands, various scientific paper titling commands, ... Most of these are indeed part of a paragraph an thus should be handled by custom insets. There is no point to change normal layouts for them. JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 14:38, schrieb Jean-Marc Lasgouttes: Most of these are indeed part of a paragraph an thus should be handled by custom insets. There is no point to change normal layouts for them. Yes, we already agree here. The only pint is that InsetLayout (a.k.a. flex inset) does not yet support arguments, but we need this for many cases. For example many paper titling commands support optional arguments (for second authors, reviewers, editors), and some of our templates/example files look currently a bit ugly in LyX with some TeX code because of the missing argument support. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 08:25 AM, Jean-Marc Lasgouttes wrote: Le 19/07/2011 13:47, Uwe Stöhr a écrit : Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) Will you do this or is this something for Richard? Should I open an enhancement bug report? I do not think I will have time to do it, unfortunately. I'm still hoping to do some major reworking of how arguments are handled, i.e., get rid of that inset. It should be easy to include this for InsetLayout. Richard
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 15:08, schrieb Richard Heck: I'm still hoping to do some major reworking of how arguments are handled, i.e., get rid of that inset. What do you have in mind instead? I have now a lot of experience with it and find the current implementation acceptable, except of these 2 things: - the menu entry must read optional Argument, not short title (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments - If there is a mandatory argument, the inset should appear directly when using the style and it must not be allowed to delete this inset; this inset should have the label req (for required) and not opt. Should I store thesesuggestions in an enhancement request? regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 09:58 AM, Uwe Stöhr wrote: Am 19.07.2011 15:08, schrieb Richard Heck: I'm still hoping to do some major reworking of how arguments are handled, i.e., get rid of that inset. What do you have in mind instead? I have now a lot of experience with it and find the current implementation acceptable, except of these 2 things: - the menu entry must read optional Argument, not short title (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? - If there is a mandatory argument, the inset should appear directly when using the style and it must not be allowed to delete this inset; this inset should have the label req (for required) and not opt. This is bigger the problem. It's like with Bibitems, which are a mess. You have to make sure no one deletes it, or moves it, or tries to type in front of it. It's just not an inset. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This is easy, except for the fact that we want people to be able to type LyX, not LaTeX, which means using the sort of embedded buffer that's used in the advanced FR dialog. That will take more work. Richard
Re: Missing features in Flex insets and style definition question
Richard Heck wrote: - the menu entry must read optional Argument, not short title (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? And that's why it should not be labelled optional or required argument, but it should be semantically precise. Short title is (for the case the inset was initially developed). Longest label is as well. LyX should tell the user what this argument does, not just that it is an optional argument. This is possible with some extended argument definition in the layout file. Instead of OptionalArgs 2 do something like Argument Type optional Order 1 Label Short title in TOC EndArgument Argument Type optional Order 2 Label Short title in header EndArgument - If there is a mandatory argument, the inset should appear directly when using the style and it must not be allowed to delete this inset; this inset should have the label req (for required) and not opt. This is bigger the problem. It's like with Bibitems, which are a mess. You have to make sure no one deletes it, or moves it, or tries to type in front of it. It's just not an inset. Yes, this is not possible in a sane way with a collapsable inset. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. Also consider that we already have this. Longest label in the paragraph dialog is just another implementation of a specific (required) argument. We just need to extend this concept. This is easy, except for the fact that we want people to be able to type LyX, not LaTeX, which means using the sort of embedded buffer that's used in the advanced FR dialog. That will take more work. Yes, but it's possible. Jürgen
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 16:38, schrieb Richard Heck: - the menu entry must read optional Argument, not short title (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? This is my second suggestion. To sum it up here in better words: - When a style has a mandatory argument and th user use it, its argument appears automatically. This inset can but must not be collapsible. The important thing is that is appears automatically and that the user cannot delete it. As there is no choice to use it or not, we don't need a menu entry or not. When a style has 2 or more mandatory arguments, the defined number of mandatory insets appears. - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. So assuming we have a command \blahblub[alignment]{number of line}{width} we define the style for it as follows in the layout file (in pseudo code): Style LatexNameblahblub Labelstring BlaBlah: RequiredArgs 2 OptionalArgs 1 DefaultReqValue1 1 DefaultReqValue2 1cm DefaultOptValue1 When the style is used in a document you get this: BlaBlah: |1||1cm| where | | represents a required argument inset. It is important that we can define a default value or mandatory arguments because some commands don't like when there is no content in them. We therefore make a proposal to prevent that the user forgets to insert something there. But the user can delete the default content when he like to keep it empty for some reason. I hope this is now clearer to understand what I have in mind. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 12:54 PM, Uwe Stöhr wrote: Am 19.07.2011 16:38, schrieb Richard Heck: - the menu entry must read optional Argument, not short title (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? This is my second suggestion. To sum it up here in better words: - When a style has a mandatory argument and th user use it, its argument appears automatically. This inset can but must not be collapsible. The important thing is that is appears automatically and that the user cannot delete it. As there is no choice to use it or not, we don't need a menu entry or not. When a style has 2 or more mandatory arguments, the defined number of mandatory insets appears. I understand the idea, but it would make the Bibitem mess look neat. - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. There can be more than one optional argument. Think about beamer. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). This is why you use an embedded Buffer, like with FR. Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. As I said, I understand what you want, but it is not practical to do it with insets. Here's another idea I had, though I don't know how hard it would be to implement. The idea would be to have fake insets. They would get drawn like insets, but they would actually be attached to the paragraph and wouldn't correspond to characters. You might think of them as existing in the paragraph's margin. Richard
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 19:33, schrieb Richard Heck: I understand the idea, but it would make the Bibitem mess look neat. What do you mean? - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. There can be more than one optional argument. Think about beamer. Sure and it is no problem of allowing to insert more then one optional argument to a style. We already have the infrastructure. What is missing is the layout code that allows to define more than one optional argument. I would implement this the same way as in my example for 2 mandatory arguments. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). This is why you use an embedded Buffer, like with FR. But why not usig what we already have as optional argument inset. It allwas to insert there everything the LyX way. And it is more intuitive than a dialog. Moreover a dialog would be a restriction you don't see at one sight the different arguments and we need arguments for everything, styles as well as InsetLayouts and LaTeX commands can be used for so many things we can not even imagine. Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. As I said, I understand what you want, but it is not practical to do it with insets. Why not? Here's another idea I had, though I don't know how hard it would be to implement. The idea would be to have fake insets. They would get drawn like insets, but they would actually be attached to the paragraph and wouldn't correspond to characters. It seems we are talking about different things. I want to have an implementation where I can define styles for every sort of LaTeX commands with several optional and mandatory arguments. And no matter if the LaTeX command represents a paragraph or not. I do not need a special hack to attach something to a paragraph. This was a special issue I stumbled over and why I started this thread. I think we already came yet to the conclusion that we only need the same features for InsetLayouts as for styles. In the case which I started the discussion, the problem would already be solved, if InsetLayout supports arguments like styles already do. So my last two posts were about how to further improve the argument support. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 01:49 PM, Uwe Stöhr wrote: Am 19.07.2011 19:33, schrieb Richard Heck: I understand the idea, but it would make the Bibitem mess look neat. What do you mean? The InsetBibitem code is a complete disaster. There are all kinds of bugs associated with it, because we are trying to use an inset to do something an inset shouldn't really be doing. You have all the same problems: Don't delete it; keep it at the beginning; etc, etc. There's all kinds of fragile, special purpose code to deal with this issue. Trying to manage more than one of these things would be a nightmare, and we don't even do it correctly for the optional argument inset we have. Are you aware that these insets can appear anywhere in a paragraph? You can even paste them into paragraphs that don't allow them, and you can paste in extra ones, if you wish. Of course, they won't do anything then but clutter your screen. To deal with this problem, you'd need the same sort of bug-ridden code we have with InsetBibitem. Even independent of the issues you're raising, the optional argument inset should go. - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. There can be more than one optional argument. Think about beamer. Sure and it is no problem of allowing to insert more then one optional argument to a style. We already have the infrastructure. What is missing is the layout code that allows to define more than one optional argument. I would implement this the same way as in my example for 2 mandatory arguments. You can define as many optional arguments as you want now. Of course, they're all called Short Title, which we agree is a problem. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). This is why you use an embedded Buffer, like with FR. But why not usig what we already have as optional argument inset. It allwas to insert there everything the LyX way. And it is more intuitive than a dialog. Moreover a dialog would be a restriction you don't see at one sight the different arguments and we need arguments for everything, styles as well as InsetLayouts and LaTeX commands can be used for so many things we can not even imagine. A dialog keeps everything in one place, and could even allow the use, say, of our length combo when the argument expects a length, and who knows what else. The problem of the arguments not being visible is one that can be addressed. Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. As I said, I understand what you want, but it is not practical to do it with insets. Why not? See above. Here's another idea I had, though I don't know how hard it would be to implement. The idea would be to have fake insets. They would get drawn like insets, but they would actually be attached to the paragraph and wouldn't correspond to characters. It seems we are talking about different things. I want to have an implementation where I can define styles for every sort of LaTeX commands with several optional and mandatory arguments. And no matter if the LaTeX command represents a paragraph or not. Yes, of course. The same sort of thing can be done with other insets. Richard
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 03:21, Uwe Stöhr a écrit : This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Looks like a very badly coded macro, then. It might be easier to fix the problem there. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 10:15, schrieb Jean-Marc Lasgouttes: This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Looks like a very badly coded macro, then. No, these cases occur often. They are also not "badly coded" but standard and valid LaTeX that commands affect the paragraph they are in. As said, we already support such LaTeX commands via InsetLayout, but we need to add for InsetLayout also the support of arguments. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) Will you do this or is this something for Richard? Should I open an enhancement bug report? regards Uwe
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 13:47, Uwe Stöhr a écrit : No, these cases occur often. They are also not "badly coded" but standard and valid LaTeX that commands affect the paragraph they are in. What typical examples do you have in mind? JMarc
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 13:47, Uwe Stöhr a écrit : Yes, it should be done eventually, and it is not very difficult. However, I think it would be better to factor in the two cases, rather then duplicating code (with subtly different bugs :) Will you do this or is this something for Richard? Should I open an enhancement bug report? I do not think I will have time to do it, unfortunately. JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 14:23, schrieb Jean-Marc Lasgouttes: Le 19/07/2011 13:47, Uwe Stöhr a écrit : No, these cases occur often. They are also not "badly coded" but standard and valid LaTeX that commands affect the paragraph they are in. What typical examples do you have in mind? Pictures in paragraphs (e.g. via picins, picinpar), wrapped floats, initials, email commands, address formatting commands, various scientific paper titling commands, ... regards Uwe
Re: Missing features in Flex insets and style definition question
Le 19/07/2011 14:28, Uwe Stöhr a écrit : Pictures in paragraphs (e.g. via picins, picinpar), wrapped floats, initials, email commands, address formatting commands, various scientific paper titling commands, ... Most of these are indeed part of a paragraph an thus should be handled by custom insets. There is no point to change normal layouts for them. JMarc
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 14:38, schrieb Jean-Marc Lasgouttes: Most of these are indeed part of a paragraph an thus should be handled by custom insets. There is no point to change normal layouts for them. Yes, we already agree here. The only pint is that InsetLayout (a.k.a. flex inset) does not yet support arguments, but we need this for many cases. For example many paper titling commands support optional arguments (for second authors, reviewers, editors), and some of our templates/example files look currently a bit ugly in LyX with some TeX code because of the missing argument support. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 08:25 AM, Jean-Marc Lasgouttes wrote: > Le 19/07/2011 13:47, Uwe Stöhr a écrit : >>> Yes, it should be done eventually, and it is not very difficult. >>> However, I think it would be better >>> to factor in the two cases, rather then duplicating code (with subtly >>> different bugs :) >> >> Will you do this or is this something for Richard? Should I open an >> enhancement bug report? > > I do not think I will have time to do it, unfortunately. > I'm still hoping to do some major reworking of how arguments are handled, i.e., get rid of that inset. It should be easy to include this for InsetLayout. Richard
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 15:08, schrieb Richard Heck: I'm still hoping to do some major reworking of how arguments are handled, i.e., get rid of that inset. What do you have in mind instead? I have now a lot of experience with it and find the current implementation acceptable, except of these 2 things: - the menu entry must read "optional Argument, not "short title" (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments - If there is a mandatory argument, the inset should appear directly when using the style and it must not be allowed to delete this inset; this inset should have the label "req" (for required) and not "opt". Should I store thesesuggestions in an enhancement request? regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 09:58 AM, Uwe Stöhr wrote: > Am 19.07.2011 15:08, schrieb Richard Heck: > >> I'm still hoping to do some major reworking of how arguments are >> handled, i.e., get rid of that inset. > > What do you have in mind instead? I have now a lot of experience with > it and find the current implementation acceptable, except of these 2 > things: > > - the menu entry must read "optional Argument, not "short title" (this > is misleading and this appears often at the users list that people are > confused, a short title is only ONE occurrence of optional arguments > It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? > - If there is a mandatory argument, the inset should appear directly > when using the style and it must not be allowed to delete this inset; > this inset should have the label "req" (for required) and not "opt". > This is bigger the problem. It's like with Bibitems, which are a mess. You have to make sure no one deletes it, or moves it, or tries to type in front of it. It's just not an inset. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This is easy, except for the fact that we want people to be able to type LyX, not LaTeX, which means using the sort of embedded buffer that's used in the advanced F dialog. That will take more work. Richard
Re: Missing features in Flex insets and style definition question
Richard Heck wrote: > > - the menu entry must read "optional Argument, not "short title" (this > > is misleading and this appears often at the users list that people are > > confused, a short title is only ONE occurrence of optional arguments > > It's much less clear how you can label different insets differently. > E.g., if there is one required argument and one optional one. Now what? And that's why it should not be labelled "optional" or "required argument", but it should be semantically precise. "Short title" is (for the case the inset was initially developed). "Longest label" is as well. LyX should tell the user what this argument does, not just that it is an optional argument. This is possible with some extended argument definition in the layout file. Instead of OptionalArgs 2 do something like Argument Type optional Order 1 Label "Short title in TOC" EndArgument Argument Type optional Order 2 Label "Short title in header" EndArgument > > - If there is a mandatory argument, the inset should appear directly > > when using the style and it must not be allowed to delete this inset; > > this inset should have the label "req" (for required) and not "opt". > > This is bigger the problem. It's like with Bibitems, which are a mess. > You have to make sure no one deletes it, or moves it, or tries to type > in front of it. It's just not an inset. Yes, this is not possible in a sane way with a collapsable inset. > The idea is to let arguments be typed into some sort of dialog, e.g., in > a new Arguments pane of the paragraph settings dialog. Also consider that we already have this. "Longest label" in the paragraph dialog is just another implementation of a specific (required) argument. We just need to extend this concept. > This is easy, > except for the fact that we want people to be able to type LyX, not > LaTeX, which means using the sort of embedded buffer that's used in the > advanced F dialog. That will take more work. Yes, but it's possible. Jürgen
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 16:38, schrieb Richard Heck: - the menu entry must read "optional Argument, not "short title" (this is misleading and this appears often at the users list that people are confused, a short title is only ONE occurrence of optional arguments It's much less clear how you can label different insets differently. E.g., if there is one required argument and one optional one. Now what? This is my second suggestion. To sum it up here in better words: - When a style has a mandatory argument and th user use it, its argument appears automatically. This inset can but must not be collapsible. The important thing is that is appears automatically and that the user cannot delete it. As there is no choice to use it or not, we don't need a menu entry or not. When a style has 2 or more mandatory arguments, the defined number of mandatory insets appears. - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. So assuming we have a command \blahblub[alignment]{number of line}{width} we define the style for it as follows in the layout file (in pseudo code): Style LatexNameblahblub Labelstring "BlaBlah: " RequiredArgs 2 OptionalArgs 1 DefaultReqValue1 "1" DefaultReqValue2 "1cm" DefaultOptValue1 "" When the style is used in a document you get this: BlaBlah: |1||1cm| where "| |" represents a required argument inset. It is important that we can define a default value or mandatory arguments because some commands don't like when there is no content in them. We therefore make a proposal to prevent that the user forgets to insert something there. But the user can delete the default content when he like to keep it empty for some reason. I hope this is now clearer to understand what I have in mind. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 12:54 PM, Uwe Stöhr wrote: > Am 19.07.2011 16:38, schrieb Richard Heck: > >>> - the menu entry must read "optional Argument, not "short title" (this >>> is misleading and this appears often at the users list that people are >>> confused, a short title is only ONE occurrence of optional arguments >>> >> It's much less clear how you can label different insets differently. >> E.g., if there is one required argument and one optional one. Now what? > > This is my second suggestion. To sum it up here in better words: > > - When a style has a mandatory argument and th user use it, its > argument appears automatically. This inset can but must not be > collapsible. The important thing is that is appears automatically and > that the user cannot delete it. As there is no choice to use it or > not, we don't need a menu entry or not. > When a style has 2 or more mandatory arguments, the defined number of > mandatory insets appears. > I understand the idea, but it would make the Bibitem mess look neat. > - the optional argument can sty as it is, only its menu entry in the > Insert menu must be changed. > There can be more than one optional argument. Think about beamer. >> The idea is to let arguments be typed into some sort of dialog, e.g., in >> a new Arguments pane of the paragraph settings dialog. > > This won't work because one must be able to insert all stuff to > arguments. For example it must be possible to use an equation, a > figure or whatever as argument. There are commend who require this > (for example the package picinpar provides commands whost mandatory > arguments are tables or figures). > This is why you use an embedded Buffer, like with F > Therefore the current implementation of the optional argument is > already perfect (and one use TeX Code with them too). So we only need > a second inset for mandatory arguments with the same possibilities in > inserting stuff to it, but with the additional features I described > above. > As I said, I understand what you want, but it is not practical to do it with insets. Here's another idea I had, though I don't know how hard it would be to implement. The idea would be to have "fake" insets. They would get drawn like insets, but they would actually be attached to the paragraph and wouldn't correspond to characters. You might think of them as existing in the paragraph's margin. Richard
Re: Missing features in Flex insets and style definition question
Am 19.07.2011 19:33, schrieb Richard Heck: I understand the idea, but it would make the Bibitem mess look neat. What do you mean? - the optional argument can sty as it is, only its menu entry in the Insert menu must be changed. There can be more than one optional argument. Think about beamer. Sure and it is no problem of allowing to insert more then one optional argument to a style. We already have the infrastructure. What is missing is the layout code that allows to define more than one optional argument. I would implement this the same way as in my example for 2 mandatory arguments. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. This won't work because one must be able to insert all stuff to arguments. For example it must be possible to use an equation, a figure or whatever as argument. There are commend who require this (for example the package picinpar provides commands whost mandatory arguments are tables or figures). This is why you use an embedded Buffer, like with F But why not usig what we already have as optional argument inset. It allwas to insert there everything the LyX way. And it is more intuitive than a dialog. Moreover a dialog would be a restriction you don't see at one sight the different arguments and we need arguments for everything, styles as well as InsetLayouts and LaTeX commands can be used for so many things we can not even imagine. Therefore the current implementation of the optional argument is already perfect (and one use TeX Code with them too). So we only need a second inset for mandatory arguments with the same possibilities in inserting stuff to it, but with the additional features I described above. As I said, I understand what you want, but it is not practical to do it with insets. Why not? Here's another idea I had, though I don't know how hard it would be to implement. The idea would be to have "fake" insets. They would get drawn like insets, but they would actually be attached to the paragraph and wouldn't correspond to characters. It seems we are talking about different things. I want to have an implementation where I can define styles for every sort of LaTeX commands with several optional and mandatory arguments. And no matter if the LaTeX command represents a paragraph or not. I do not need a special hack to attach something to a paragraph. This was a special issue I stumbled over and why I started this thread. I think we already came yet to the conclusion that we only need the same features for InsetLayouts as for styles. In the case which I started the discussion, the problem would already be solved, if InsetLayout supports arguments like styles already do. So my last two posts were about how to further improve the argument support. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/19/2011 01:49 PM, Uwe Stöhr wrote: > Am 19.07.2011 19:33, schrieb Richard Heck: > >> I understand the idea, but it would make the Bibitem mess look neat. > > What do you mean? > The InsetBibitem code is a complete disaster. There are all kinds of bugs associated with it, because we are trying to use an inset to do something an inset shouldn't really be doing. You have all the same problems: Don't delete it; keep it at the beginning; etc, etc. There's all kinds of fragile, special purpose code to deal with this issue. Trying to manage more than one of these things would be a nightmare, and we don't even do it correctly for the optional argument inset we have. Are you aware that these insets can appear anywhere in a paragraph? You can even paste them into paragraphs that don't allow them, and you can paste in extra ones, if you wish. Of course, they won't do anything then but clutter your screen. To deal with this problem, you'd need the same sort of bug-ridden code we have with InsetBibitem. Even independent of the issues you're raising, the optional argument inset should go. >>> - the optional argument can sty as it is, only its menu entry in the >>> Insert menu must be changed. >>> >> There can be more than one optional argument. Think about beamer. > > Sure and it is no problem of allowing to insert more then one optional > argument to a style. We already have the infrastructure. What is > missing is the layout code that allows to define more than one > optional argument. I would implement this the same way as in my > example for 2 mandatory arguments. > You can define as many optional arguments as you want now. Of course, they're all called "Short Title", which we agree is a problem. The idea is to let arguments be typed into some sort of dialog, e.g., in a new Arguments pane of the paragraph settings dialog. >>> >>> This won't work because one must be able to insert all stuff to >>> arguments. For example it must be possible to use an equation, a >>> figure or whatever as argument. There are commend who require this >>> (for example the package picinpar provides commands whost mandatory >>> arguments are tables or figures). >>> >> This is why you use an embedded Buffer, like with F > > But why not usig what we already have as optional argument inset. It > allwas to insert there everything the LyX way. And it is more > intuitive than a dialog. Moreover a dialog would be a restriction you > don't see at one sight the different arguments and we need arguments > for everything, styles as well as InsetLayouts and LaTeX commands can > be used for so many things we can not even imagine. > A dialog keeps everything in one place, and could even allow the use, say, of our length combo when the argument expects a length, and who knows what else. The problem of the arguments not being visible is one that can be addressed. >>> Therefore the current implementation of the optional argument is >>> already perfect (and one use TeX Code with them too). So we only need >>> a second inset for mandatory arguments with the same possibilities in >>> inserting stuff to it, but with the additional features I described >>> above. >>> >> As I said, I understand what you want, but it is not practical to do it >> with insets. > > Why not? > See above. >> Here's another idea I had, though I don't know how hard it would be to >> implement. The idea would be to have "fake" insets. They would get drawn >> like insets, but they would actually be attached to the paragraph and >> wouldn't correspond to characters. > > It seems we are talking about different things. I want to have an > implementation where I can define styles for every sort of LaTeX > commands with several optional and mandatory arguments. And no matter > if the LaTeX command represents a paragraph or not. > Yes, of course. The same sort of thing can be done with other insets. Richard
Re: Missing features in Flex insets and style definition question
On 07/18/2011 01:46 PM, Uwe Stöhr wrote: I often have the case that I need to define an inset that is internally a LaTeX command. I use for this the Flex inset. But why does it not support optional and required arguments. I mean it represents a LaTeX command, the same way as a normal Style declaration. Using OptionalArgs1 RequiredArgs1 in a style works very well, but I need the same also for InsetLayout Flex:. Can this be implemented or is this already available in another form? I suppose it could be implemented. Of course, you can probably use ERT, but Besides this, is there a way to define a normal style that LyX does not treat as a paragraph. I mean when I use LatexTypecommand LyX nevertheless ends the style in the TeX output with a new line, e.g. \test{bla} This is an example instead of \test{bla}This is an example How can I get the latter? Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. Richard
Re: Missing features in Flex insets and style definition question
Le 18/07/11 22:26, Richard Heck a écrit : Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. It would be possible using parbreakisnewline if this was made to work generally. JMarc
Re: Missing features in Flex insets and style definition question
On Mon, Jul 18, 2011 at 7:46 PM, Uwe Stöhr uwesto...@web.de wrote: I often have the case that I need to define an inset that is internally a LaTeX command. I use for this the Flex inset. But why does it not support optional and required arguments. I mean it represents a LaTeX command, the same way as a normal Style declaration. Using OptionalArgs 1 RequiredArgs 1 in a style works very well, but I need the same also for InsetLayout Flex:. Can this be implemented or is this already available in another form? I guess this is related to #6753 [1]. [1] http://www.lyx.org/trac/ticket/6753 Liviu
Re: Missing features in Flex insets and style definition question
Am 18.07.2011 22:30, schrieb Jean-Marc Lasgouttes: Le 18/07/11 22:26, Richard Heck a écrit : Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. It would be possible using parbreakisnewline if this was made to work generally. This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. regards Uwe
Re: Missing features in Flex insets and style definition question
On 07/18/2011 01:46 PM, Uwe Stöhr wrote: > I often have the case that I need to define an inset that is > internally a LaTeX command. I use for this the Flex inset. But why > does it not support optional and required arguments. I mean it > represents a LaTeX command, the same way as a normal Style declaration. > Using > OptionalArgs1 > RequiredArgs1 > in a style works very well, but I need the same also for InsetLayout > Flex:. > > Can this be implemented or is this already available in another form? > I suppose it could be implemented. Of course, you can probably use ERT, but > Besides this, is there a way to define a normal style that LyX does > not treat as a paragraph. I mean when I use > > LatexTypecommand > > LyX nevertheless ends the style in the TeX output with a new line, e.g. > > \test{bla} > > This is an example > > instead of > > \test{bla}This is an example > > How can I get the latter? > Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. Richard
Re: Missing features in Flex insets and style definition question
Le 18/07/11 22:26, Richard Heck a écrit : Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. It would be possible using parbreakisnewline if this was made to work generally. JMarc
Re: Missing features in Flex insets and style definition question
On Mon, Jul 18, 2011 at 7:46 PM, Uwe Stöhrwrote: > I often have the case that I need to define an inset that is internally a > LaTeX command. I use for this the Flex inset. But why does it not support > optional and required arguments. I mean it represents a LaTeX command, the > same way as a normal Style declaration. > Using > OptionalArgs 1 > RequiredArgs 1 > in a style works very well, but I need the same also for InsetLayout Flex:. > > Can this be implemented or is this already available in another form? > I guess this is related to #6753 [1]. [1] http://www.lyx.org/trac/ticket/6753 Liviu
Re: Missing features in Flex insets and style definition question
Am 18.07.2011 22:30, schrieb Jean-Marc Lasgouttes: Le 18/07/11 22:26, Richard Heck a écrit : Styles in this sense are paragraph-level entities, so I don't think you can do this. Flex insets are what you would want in this case. It would be possible using parbreakisnewline if this was made to work generally. This doesn't help, because in some cases you need the feature that LyX does not add nothing, no par break and also no newline but to continue with the code right after the command. Richard is right that InsetLayout is designed for this, but this is only usable if InsetLayout supports also arguments. It is not yet clear to me why this is not supported. I'm not familiar with the layout code but I assumed that it should not be very hard to implement. Would at least be a very valuable feature for LyX 2.1. regards Uwe