Manage counters

Daniel xracoonx at gmx.de
Tue Oct 13 05:43:42 UTC 2020


On 2020-10-13 00:24, Richard Kimberly Heck wrote:
> On 10/12/20 4:58 AM, Daniel wrote:
>> I have just played a bit with Edit > Manage Counter Values. It's a
>> nice feature to have available. However, it was not what I expected at
>> first. It seems to be "just" a counter inset which sets the counter at
>> the place where it is inserted (which becomes clear when looking at
>> the code). I think it would be better placed in the Insert menu under
>> "Counter Manager" or so.
>
> It was originally there. Various people thought it should go on the Edit
> menu, so it got moved.

I see. Maybe the suggestion by others was at a time when the functioning
and limitations were not clear? I am wondering what would happen if the
feature that I suggest below gets implemented. Maybe the counter inset
would be moved back to the Insert menu then.
>> The inset is nothing that directly "Edit"s the current layout but
>> "Insert"s something in addition to it. The UserGuide actually states
>> that this is an "inset" and that it is located in the "Insert" menu
>> (which seems the right place IMO).
>
> I've fixed the docs.

Thanks.

>> Maybe the limitation and functioning could be explained a bit more in
>> that section and an example for it's standard usage be provided?
>
> It says what five things it does. An example would be a bit more
> complicated.
>
>
>> I think it's nice to have the inset available but its use is limited
>> for me. In particular, it seems not a feature to "directly" change the
>> counter of numbered elements. Here is what I mean: Say, I want to
>> change the counter of a Numbered list (enumerate). In the attached
>> document I try to reset a Numbered list counter with the inset but it
>> doesn't work. This is because `\setcounter` comes either too early
>> (outside of the enumerate environment) or too late (after `\item`). I
>> think to work, `\setcounter` should be added '''at the beginning or
>> the line''' where the counter inset is added as in the attached tex
>> document.
>
> Scott pointed out the same issue. To make it work, you have to Insert>
> List Preamble (an optional argument), and then you also have to modify
> the layout for that argument to remove PassThru. (This is on the list a
> couple weeks back.) Otherwise, you can't insert insets but only bare
> text. It's not ideal but it's also not clear what else to do. Generally
> removing PassThru seems wrong, since that's what one will ordinarily
> want, I think.

Somehow I could not get it to work by removing PassThru. But I suspect
that the following two problems will remain:

1. The counter *in the Workarea* is not properly modified since the
counter inset still comes after the list started.
2. Changing the first element in a list works different from changing
other elements in a list. Which is quite counter-intuitive.

>> Also, it would be nice to set the counter of a numbered element more
>> directly in another sense: setting it to a certain value via the
>> context menu of a numbered element sets it to that value (not that
>> value plus one as is currently the case with the "Counter Manager"
>> because the value is increased by one when it is used e.g. in \section).
>>
>> Am I right to assume that the inset is *not* suppose to deliver this
>> feature?
>
> I thought about that, but suppose you set it and then tried to display
> it or otherwise use it? You'd get a surprising result. So, yes, it's a
> bit counter-intuitive. I've added a note about that to the docs, as
> well. (Here, as in some other cases, you need a bit of LaTeX knowledge
> to make the most of LyX.)

Yes, that's also why I thought the inset was not meant to be there for
that task. I think it's a basic feature that is still missing in LyX then.

> The idea of using the context menu, etc, is a good one, but it would
> involve more work.

I guess you mean "more work" as in more work than for the counter inset.
My hopes are not high that I will be able to do it. I'll still try it at
some point little bit. I hope I can learn a lot from the counter inset code.

>> I am also thinking of being able to set not only the value but the
>> format, e.g. "(\roman{enumi})", of the counter, ideally via a nice UI
>> with a couple of preset values.
>
> Here, I think it might be worth just having a module that made other
> formats available. I have one for local use.

It strikes me as a pretty basic feature that should be available
module-less some day.

Daniel


More information about the lyx-devel mailing list