LyX display of align counters
Scott Kostyshak
skostysh at lyx.org
Fri Feb 18 21:15:49 UTC 2022
On Fri, Feb 18, 2022 at 09:53:32PM +0100, Daniel via lyx-users wrote:
> On 2022-02-18 17:03, Scott Kostyshak via lyx-users wrote:
> > On Fri, Feb 18, 2022 at 02:52:35PM +0100, Daniel via lyx-users wrote:
> > > On 17/02/2022 14:06, Scott Kostyshak via lyx-users wrote:
> > > > I like to renumber my align numbers within frame. e.g., Instead of "equation
> > > > 3", I essentially use them as "3rd line of equation on this frame" which makes
> > > > it easy for students to ask questions and refer to the line number.
> > > >
> > > > I do this with the following LaTeX code in the preamble:
> > > >
> > > > \AtBeginEnvironment{align}{\setcounter{equation}{0}}
> > > >
> > > > I'm greedy and would like to adapt the LyX layout to show the same.
> > > >
> > > > Specifying "Within" frame seems to almost do what I want:
> > > >
> > > > Counter equation
> > > > Within frame
> > > > End
> > > >
> > > > However, if I'm on Frame 10, it will show 10.1, 10.2, etc..., where I would
> > > > prefer just 1, 2, ...
> > > >
> > > > If the above can't be tweaked to work, perhaps a different approach to using
> > > > "Within" would be to have the Frame layout reset the equation counter to 0?
> > > >
> > > > Scott
> > >
> > > Maybe you could provide a minimal example of the frame setup you have? I
> > > guess you are working with some "frame" counter definition.
> >
> > Ah indeed there is some interaction with another local patch I have
> > applied. I don't think the patch is necessary to reproduce the issue in
> > this thread (without it, it seems LyX marks them as #.1, #.2, #.3, #.4;
> > but for completeness I attach it (it is against current master).
> >
> > I also attach an example .lyx file. I saved it as 2.3.x format just for
> > simplicity, but I am testing on current master. Note that the LyX file
> > has a preamble (that resets the counter to 0 in LaTeX) as well as a
> > local layout (that specifies the Within).
> >
> > I also attach a screenshot, which has Frame number patch applied.
> > Instead of the equation labels "1.1, 1.2, 2.1, 2.2", I would prefer
> > "1, 2, 1, 2" in the LyX display.
> >
> > Thanks,
> > Scott
>
> Like so:
>
> Counter equation
> Within frame
> LabelString \arabic{equation}
> End
>
> ?
Perfect! Thanks.
> By the way, why do you use
>
> \AtBeginEnvironment{align}{\setcounter{equation}{0}}
>
> rather than
>
> \AtBeginEnvironment{frame}{\setcounter{equation}{0}}
>
> ?
>
> If you use the latter, you can use different equation environments without
> getting ambiguous numbers within a frame.
That's a good idea. I might change to that. The reason why I initially
chose "align" was so that if I do two (small) aligns on one frame, both
would restart to (1). But that's a very rare situation anyway.
I guess I might want to do both of the above LaTeX commands, in theory.
Almost all the time though, it's just one align on one frame so it won't
make a big difference.
Thank you!
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-users/attachments/20220218/02945b0c/attachment.asc>
More information about the lyx-users
mailing list