Is there an easy way to split one beamer slide into several? And merge several into one?

It confuses me a little that a slide and a page are distinctive concepts in the beamer mode of TeXmacs. As a result, I always write too long a slide until I realize that I should start a new one. At this time, it’s pretty unintuitive that I cannot just add a title to the current page to separate the giant slide. Copy-and-paste is rather inefficient and unstable for this purpose, especially when there are huge diagrams in the slides. I wonder if there is an easier way to achieve it. Thanks.

I was confused at the beginning, too. A related issue is that panorama mode only works on pages but not slides: http://forum.texmacs.cn/t/panorama-mode-never-works-for-the-slides-of-beamer-style/893?u=jade

I hope someone can explain how the “slide” structure works in texmacs, it may be some kind of fold structure as I find it in the fold-edit.scm in the dynamic module.

1 Like

In the documentation “Traversal of a presentation” I found this:

The entire presentation itself usually consists of a screens switch, where the pieces are the successive “slides” of the presentation.

So the entire collection of slides is contained in a switch called screens. Now we need to understand what is switch and how it works. I guess the reason for choosing switch rather than normal page is for using overlays.

In LaTeX the situation is very different. The PDF generated by beamer package consists of normal pages, and the overlays are achieved by simply copying pages.

2 Likes

screens is an element that contains a number of hidden elements and one shown element. This is an example in scheme tree format:

(screens
    (hidden (document "first slide"))
    (shown (document "second slide"))

Here is some toy code to transform a beamer document into a “normal” document and open it in a new buffer:

(begin
  (define test-stree1
    '(document (screens
                (hidden (document "first slide"))
                (shown (document "second slide")))))
  (define (slide->body s) (cadadr s))
  (define (beamer-stree->doc-tree s) (stree->tree (cons 'document (map slide->body (cdadr s)))))
  (buffer-set-body (new-buffer) (beamer-stree->doc-tree test-stree1))) 

Helpful tools to inspect TeXmacs trees are Debug->Status->Tree (appears on the console) or the experimental Context side tool.

Note that there are in fact two formats for beamer documents: one is the screens element, which is used in “Beamer” display mode, the other is the slideshow, which is used in “Paper” display mode. In “Paper” mode there is no need to hide slides, so the hidden and shown elements are removed there.

When merging you would need to consider what to do with slides that have different titles. I guess the bodies you could just append to each other.

When splitting, how would the interface look like? I guess you could create a split based on the current selection, i.e. you select the content you would like to split off and then either press a keyboard shortcut or a menu item saying something like “New slide from selection”.

2 Likes

Thanks a lot for your reply.

Your suggestion on the interface sounds pretty nice, but I imagine something simpler. Usually, when splitting, I don’t need to reorganize the contents of the current slide. I want only a keyboard shortcut or a menu item that separates the content from the current cursor position to the end of the current slide.

This could work, but you’d need to consider what to do if the cursor is inside an element that cannot be easily split, for example a figure or an equation. Do you report an error?

I guess you could split based on the ancestor element of the cursor position that is a direct descendant of the shown or slide element. Do you split before or after this? Perhaps duplicate the element on both slides?

1 Like

Please consider that a document is a tree, not a linear structure, so editing operations should have a well defined meaning in this context. Personally I never need to split slides in this way. What I sometimes imagined useful is a visual marked that the slide is taking more vertical space than the default.

1 Like

Thanks.

Only recently, I started using TeXmacs to write slides. Unfortunately, the situation I encountered might be just because of my confusion about the functions. I might need to develop a better habit.

The visual mark for extra vertical space sounds lovely. It would serve as a little reminder for me to start a new slide.