Beamer buttons are used to reference one slide from another so that
you can jump around your presentation (useful if a viewer asks a
question about details, for example).

These buttons are pretty popular. For example, one of the beamer
examples has three of the goto buttons:

To use one, you insert a label in a Beamer frame, and then when you
want to link to it, you use
\hyperlink{labelToRef}{\beamergotobutton{Text on Button}}

Buttons can be distracting to the audience (it's like showing someone
a box -- of course they want to know what's inside) so many presenters
use text hyperlinks. The text looks like other text so it does not
stand out but it can be clicked on just like a button and just like
one can click on a cross-reference in an article class.

I would like to add support to LyX for these buttons and would like
some advice. Below are a few implementation ideas:

a. This could be an option from the cross-reference menu (as part of
the Format combo box). One could select an existing label, select
button or text, and then enter what they would like to be displayed
(common strings are "Details", "Proof", "Click here", or "Back").

b. These could be custom insets defined in beamer.layout. Attached is
a patch that does this. The disadvantage of this approach is that the
user has to do more steps: click on insert > custom insets > Goto
Button; then insert the display text; then they have to remember to go
to Insert > Target; and then they have to remember the name of the
label they want to reference.

c. There are a couple of hybrids of (a) and (b) that could be done.
For example, an option could be added to the Format combo box that
just inserts the label in a PassThru sense (that is, not embedded in
\ref{}). This would make the selection of the label easy and would not
require the hardcoding that a pure (a) solution would.

d. Another hybrid would be to allow a layout argument to be of type
"cross-reference". This would give the user a dialog of the defined
labels to select from (similar to the cross-reference menu but more
simple because no options would need to be selected). It probably
doesn't make sense to implement this just for the insets I'm
proposing, and I struggle to think of other examples so this might not
be a good idea.

Any thoughts?

diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index 6e0be1b..2d4607e 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -1528,6 +1528,36 @@ InsetLayout Flex:PresentationMode
    MultiPar        true
+InsetLayout Flex:Goto_Button
+  LabelString      "Button"
+  LatexType        none
+  LyXType          Custom
+  LeftDelim        {\beamergotobutton{
+  RightDelim       }}
+  Decoration       Classic
+  MultiPar         false
+  ForcePlain       1
+  PassThru         0
+  Spellcheck       1
+  ContentAsLabel   1
+  Argument 1
+    Mandatory      1
+    LabelString    "Target"
+    Tooltip        "Insert the label of the slide to reference"
+    LeftDelim      \hyperlink{
+    RightDelim     }
+  EndArgument
+InsetLayout Flex:Goto_Text
+  CopyStyle        Flex:Goto_Button
+  LabelString      "Goto Text"
+  LeftDelim        {
+  RightDelim       }
+  Font
+    Family         sans
+  EndFont

Reply via email to