Cannot put new counter inset in list preamble

Scott Kostyshak skostysh at lyx.org
Sat May 8 18:02:18 UTC 2021


On Sat, May 08, 2021 at 06:27:47PM +0200, Jürgen Spitzmüller wrote:
> Am Samstag, dem 08.05.2021 um 12:07 -0400 schrieb Scott Kostyshak:
> > I'm fine with whatever you prefer. But just to make sure, I expand on
> > the suggested alternative workflow. Consider the following pseudo LyX
> > code:
> > 
> >   [set counter of enumi to 2]
> >   
> >   [begin enumerate]
> >   [item] User intends for this item to be 3.
> > 
> > Currently, the above does not work as desired because when we set the
> > counter of enumi outside of an enumerate, that does not have any effect
> > (I guess because the counter in LaTeX is reset at the beginning of each
> > enumerate environment?). 
> 
> Yes. It corresponds to
> 
> \setcounter{enumi}{2}
> 
> \begin{enumerate}
> \item See this is still 1!
> \end{enumerate}
> 
> I think it is good that LyX follows LaTeX here.

Fair enough.

> > But the only intent from the user, from what I understand, would be for
> > the above LyX pseudo code to export the following LaTeX pseudo code:
> > 
> >   [begin enumerate]
> >   [set counter of enumi to 2]
> >   [item] User intends for this item to be 3.
> 
> I don't think so. Counter is always local to the list environment.
> Outside, the counter could be stepped for other purposes, such as
> (constructed example)
> 
> \setcounter{enumi}{2}
> Hello \theenumii
> 
> \begin{enumerate}
> \item I expect this to be 1!
> \end{enumerate}

Good point.

> > From a user point of view, at least one who does not know anything
> > about LaTeX (I'm a good proxy for such a user), it's not intuitive
> > that we have to set the counter in the List Preamble. The distinction
> > between setting counters for Theorems, for example, and setting
> > counters for enum items, although clear to LaTeX experts, is too
> > subtle for it to be obvious to many LaTeX beginners. I believe (I
> > would have to double-check with others, perhaps on lyx-users) the
> > alternative workflow suggested above is more intuitive. However, I
> > understand that from a LaTeX perspective it is not intuitive since it
> > does not make sense to set the counter before the environment even
> > begins.
> 
> Well it should be clear that some counters are reset in some cases
> while others are not, and that counters need to be set within this
> scope.
> 
> If you take theorems, and use "by sections", would you expect a counter
> inset positioned just _before_ a section heading to step the theorems
> in the section that follows?
> 
> If we follow your proposal, we'd need to to that as "non-TeXies might
> expect it". And what about "by chapter" theorems?
> 
> Deviating here from what LaTeX does soon leads us into situations that
> are tricky.

Good points. I'm now convinced my proposal was not good. Thank you for
the explanations.

> > As a separate alternative approach, I wonder if users would prefer to
> > simply right-click on the "1" in the enum and select "change counter"
> > and enter "3" in the dialog.
> 
> This is basically a replacement for the current counter inset approach.
> This is definitely more intuitive, but more complex to implement (as
> the same would need to be done for all other counters we have
> (headings, footnotes etc.).

Makes sense.

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210508/2e3adf32/attachment.asc>


More information about the lyx-devel mailing list