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
From 0c03fad85cd099e467db015f98af4b2cf9dd9141 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Thu, 27 Jan 2022 17:11:48 -0500
Subject: [PATCH] beamer.layout: display frame number in LyX display

TODO:
(LyXMessage-ID:<smihaj$11vd$1...@ciao.gmane.io>)
For some reason, if one keeps the TocLevel to 4, the label "Frame ..."
disappears. But, I guess, as long as you don't use Subsubsection in your
presentation, it should be no problem?

TODO:
(LyXMessage-ID:<smqg02$gtt$1...@ciao.gmane.io>)
But instead of an empty LabelString, LyX seems to treat it the same as if it
hadn't been defined and adds just the number in front. Maybe this is a bug?

Motivation: Doug would find it useful, racoon suggested upstream
also:

LyXMessage-ID:<CAOGjeM2UQTvOmkjLKmAnad65irSg=hbxzn+mmuoc6xxjbep...@mail.gmail.com>

Thanks to racoon for the help. I think I would have given up on my
initial try without your help.

TODO (optional): in fragile frame layout, any way to just append "(fragile)",
to avoid having to duplicate "\theframe" ? Also for plain frame.
---
 lib/layouts/beamer.layout | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index d824522c8b..eab352bbdf 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -58,6 +58,9 @@ AddToPreamble
   }
 EndPreamble
 
+Counter frame
+End
+
 
 #
 # STANDARD STYLE
@@ -478,14 +481,16 @@ End
 # FRAMES
 #
 
+
 Style Frame
   Category         Frames
   Margin           First_Dynamic
   LeftMargin       xx
   LatexType        Environment
   LatexName        frame
-  LabelString      "Frame"
-  TocLevel         4
+  LabelString      "Frame \theframe"
+  LabelCounter     frame
+  TocLevel         3
   KeepEmpty        1
   NextNoIndent     1
   Align            Left
@@ -543,7 +548,7 @@ End
 
 Style PlainFrame
   CopyStyle         Frame
-  LabelString       "Frame (plain)"
+  LabelString       "Frame \theframe (plain)"
   Argument 3
     MenuString      "Frame Options"
     LabelString     "Options"
@@ -554,7 +559,7 @@ End
 
 Style FragileFrame
   CopyStyle         Frame
-  LabelString       "Frame (fragile)"
+  LabelString       "Frame \theframe (fragile)"
   Argument 3
     MenuString      "Frame Options"
     LabelString     "Options"
@@ -995,7 +1000,8 @@ Style Title
   BottomSep        1
   ParSep           1
   Align            Center
-  LabelType        No_Label
+  LabelType        Static
+  LabelString      " "
   Argument 1
     LabelString   "Short Title|S"
     Tooltip       "Short title which appears in the sidebar/header"
@@ -1010,6 +1016,7 @@ Style Title
   DocBookTag       title
   DocBookTagType   paragraph
   DocBookInInfo    maybe
+  LabelCounter     frame
 End
 
 Style Title_(Plain_Frame)
-- 
2.32.0

Attachment: example.23.lyx
Description: application/lyx

Attachment: signature.asc
Description: PGP signature

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

Reply via email to