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

?

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.

Best,
Daniel


--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to