Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to bypass beamer frame in section slides not just for "notes" slides #8118

Open
tchevri opened this issue Jun 9, 2022 · 6 comments

Comments

@tchevri
Copy link

tchevri commented Jun 9, 2022

I would like to follow up with the resolution provided in #7857 and this issue I raised please: #4317 (comment)

At the time, jgm responded on Aug 23, 2019:

@tchevri I'm sorry about this -- it appears one can't please everyone. Unfortunately your particular use wasn't represented in the discussion. I had assumed that people who didn't want the content to appear on slides could simply hide the content (using a filter or whatever), but your case is different; you don't want to hide the content; you want it to appear in the document outside the slide environment

and concluded with:

But I can't think of a good workaround right now

It's been a couple of years now and a solution was found for another user in a nearly identical situation: here and here.
Basically the src/Text/Pandoc/Writers/LaTeX.hs code was enhanced to include:

              [] -> Div (ident,"section":dclasses,dkvs) xs
              [Div (_,"notes":_,_) _] ->  -- see #7857, don't create frame
                    -- just for speaker notes after section heading

Now any above slide level content starting with ::: notes will not be added onto a slide.
Is it possible to add a couple more lines to entertain my use case as well please? In line with the beamer userguide section 21.3 Details on Modes, the \mode command controls what part of your text belongs to which mode. It is to be specified outside frames. This is a key feature for controlling how beamer behaves.

Therefore, my hope is to be able to escape a command such as \mode<presentation> (just like ::: notes) and not have it forced onto a slide please. To achieve this, would the code need to be wrapped in a ```{=beamer} command or would it be possible to escape it directly please?

Many thanks in advance. thomas

@jgm
Copy link
Owner

jgm commented Jun 9, 2022

Perhaps we could implement

::: noslide
if this content is encountered after a section heading above slide-level, include it in the document but don't start a frame yet.
:::

It's a bit clunky, though, because it is hard to know what to do with this if someone puts it under a slide-level heading, in the middle of other content.

@tchevri
Copy link
Author

tchevri commented Jun 10, 2022

Thank you so much for such prompt follow up despite the current heavy flow on the list and the many other tasks you will be busy with.

If I am not mistaken, may I kindly suggest that ::: note was used in lieu of \note<⟨overlay specification⟩>[⟨options⟩]{⟨note text⟩}, therefore, ideally it'd be nice to have a ::: mode command in lieu of \mode<⟨mode specification⟩>{⟨text⟩} if this is convenient / makes sense?

The beamer userguide section 21.3 Details on Modes suggests 3 modes:

  • \mode<⟨mode specification⟩>{⟨text⟩}
  • \mode<⟨mode specification⟩>
  • \mode*

It would be absolutely awesome to be able to access all 3.

Note that the beamer userguide section 19.1 Specifying Note Contents highlihgted that "the \note command can be used both inside and outside frames, but using the \note command inside frames is usually preferably over using them outside".

many thanks
thomas

@jgm
Copy link
Owner

jgm commented Jun 10, 2022

Perhaps the most straightforward syntax would be

::: {mode="presentation"}
...put commands here...
:::

Pandoc could then translate that to

\mode<presentation>{...commands...}

or maybe to

\mode<presentation>
...commands...
\mode<originalmode>

if we could figure out originalmode. (Is there a macro that returns the current mode?)

We'd also have to ensure that this doesn't go into a slide.

@tchevri
Copy link
Author

tchevri commented Jun 11, 2022

This would seem good, unfortunately, the beamer mode command does not work like this, as far as I understand. As I mentioned the beamer userguide section 21.3 Details on Modes, please kindly allow me to copy from there the relevant content for your kind perusal (first few lines below = background information, next lines = details of the command). Hopefully this is helpful, I tried to keep only the relevant useful content. I think i know how to use mode, but i definitely have zero idea how to amend 52b78b1, so sorry about that. I tried and failed miserably.

"...

During a presentation it is very much desirable that the audience has a handout or even lecture notes available to it. A handout allows everyone in the audience to individually go back to things he or she has not understood. The beamer package offers two different ways of creating special versions of your talk. The first, easy, way is to create a handout version by adding the handout option, which will cause the document to be typeset in handout mode. The second, more complicated and more powerful way is to create an independent “article” version of your presentation.

When beamer typesets your text, it is always in one of the following five modes:

  • beamer is the default mode.
  • second is the mode used when a slide for an optional second screen is being typeset.
  • handout is the mode for creating handouts.
  • trans is the mode for creating transparencies.
  • article is the mode when control has been transferred to another class, like article.cls. Note that the mode is also article if control is transferred to, say, book.cls.

In addition to these modes, beamer recognizes the following names for modes sets:

  • all refers to all modes.
  • presentation refers to the first four modes, that is, to all modes except for the article mode.

You can use the \mode command to control what part of your text belongs to which mode. The command \mode actually comes in three “flavors,” which only slightly differ in syntax. The first, and simplest, is the version that takes one argument. It behaves essentially the same way as \only:

  1. \mode<⟨mode specification⟩>{⟨text⟩}
    This mode is active for the duration of the {}. The ⟨text⟩ should not do anything fancy that involves mode switches or including other files.
  2. \mode<⟨mode specification⟩>
    The second flavor of the \mode command takes no argument. “No argument” means that it is not followed by an opening brace, but any other symbol. In the specified mode, this command actually has no effect. The interesting part is the effect in the non-specified modes: In these modes, the command causes TEX to enter a kind of “gobbling” state. It will now ignore all following lines until the next line that has a sole occurrence of one of the following commands: \mode, \mode*, \begin{document}, \end{document}. Note: When a TEX file ends, TEX must not be in the gobbling state. Switch this state off using \mode on one line and <all> on the next.
  3. \mode*
    The effect of this mode is to ignore all text outside frames in the presentation modes. In article mode it has no effect. This mode should only be entered outside of frames. Once entered, if the current mode is a presentation mode, TEX will enter a gobbling state similar to the gobbling state of the second “flavor” of the \mode command. The difference is that the text is now read token-wise, not line-wise. The text is gobbled token by token until one of the following tokens is found: \mode, \frame, \againframe, \part, \section, \subsection, \appendix, \note, \begin{frame}, and \end{document} (the last two are not really tokens, but they are recognized anyway). Once one of these commands is encountered, the gobbling stops and the command is executed. However, all of these commands restore the mode that was in effect when they started. Thus, once the command is finished, TEX returns to its gobbling. Note the class option ignorenonframetext will switch on \mode* at the beginning of the document.

Recall that a ⟨mode specification⟩ is just an overlay specification in which no slides are mentioned.

..."

many thanks, really appreciate the effort to enhance this part of the already awesome pandoc thomas

@jgm
Copy link
Owner

jgm commented Jun 11, 2022

Oh yes, I read that already. So, what part of my proposal doesn't fit with this?

@tchevri
Copy link
Author

tchevri commented Jun 11, 2022

Sorry, I am really the wrong person to ask...
you're the expert, I am not.
Just looking forward to the implementation.
thank you so much, really appreciated.

tchevri added a commit to tchevri/pandoc that referenced this issue Aug 4, 2023
Before Pandoc 2.7, choosing slide_level: 3 meant that ### was needed to create a slide. This commit jgm@5990f14 caused this desired behavior to no longer be true and content above slide level is automatically included onto a slide, to accommodate compatibility with reveal.js format. At JGM's request, who could not think of a quick fix at the time, I posted a request on https://groups.google.com/g/pandoc-discuss/c/joqekZQRpq8, but no resolution was suggested.

This suggested simple 1 extra line change fixes these issues jgm#8118 and jgm#4317. Thank you in advance for entertaining this suggestion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants