GithubHelp home page GithubHelp logo

Comments (6)

matze avatar matze commented on May 14, 2024

If the \plain{[title]}{body} command for dark frames matched Beamer frame syntax, it would allow Beamer exporters like emacs org-mode to reference it using existing templates.

Sounds like a good idea!

I've never done it before.

Me neither. So do you want to continue or should I investigate at some point?

from mtheme.

 avatar commented on May 14, 2024

I can at least provide some extra information after the presentation I'm using the theme for is done :)

from mtheme.

rchurchley avatar rchurchley commented on May 14, 2024

What is meant by "Beamer frame syntax"? If you just want

\begin{plainframe}{...title...}
    ...
\end{plainframe}

we should be able to accomplish this using \newenvironment instead of \newcommand. Or am I missing something?

from mtheme.

rchurchley avatar rchurchley commented on May 14, 2024

I've finally done some research into this long-standing issue. I believe I originally misunderstood @talexand's request; by "matching frame syntax", he means implementing the standout plain slides as an optional argument to frame.

\begin{frame}[standout]
  Questions?
\end{frame}

(Obviously, we couldn't use plain as the argument, as this already exists in Beamer. I've called the option standout for now since I couldn't think of anything better, but I'd welcome other ideas for what to call it.)

As I understand it, doing this would allow users of emacs org-mode to generate the above frame using something like the following input. (Note: I have not actually tested it.)

* A standout slide                    :B_ignoreheading:
:PROPERTIES:
:BEAMER_opt: standout
:END:
    Questions?

Advantages

Moving to an optional frame argument offers a couple mild advantages in addition to emacs org-mode compatibility.

  • The syntax is more consistent with other frames.
  • It could make it very slightly easier to adapt a presentation to or from ᴍᴇᴛʀᴏᴘᴏʟɪs.
  • We could implement the new option in the inner theme, making it possible to use independently of the font and color themes. (For some reason, I feel more comfortable defining a new frame option in the inner theme than a new command.)

Disadvantages

The main disadvantage of this proposal is that I don't see a way of implementing the allsmallcaps and allcaps options of titleformat plain. This can be mitigated by keeping \plain{...} as a shortcut for \begin{frame}[standout]{#1}\metropolis@plaintitleformat{#2}\end{frame}

Implementation

To implement the optional argument, we just have to move all the code from \plain to a block that is executed when the standout option is called. (See the keyval package for details.) Most of it is straightforward; we begin a group, change the colors and fonts, and set a \centering alignment.

(This code is all executed before the frame is fully set up, so adding a \MakeLowercase here for titleformat plain=allsmallcaps would break the frame rather than applying to its contents.)

\providebool{metropolis@standout}
\define@key{beamerframe}{standout}[true]{%
  \booltrue{metropolis@standout}
  \begingroup
    \setkeys{beamerframe}{c}
    \setkeys{beamerframe}{noframenumbering}
    \ifbeamercolorempty[bg]{palette primary}{
      \setbeamercolor{background canvas}{
        use=palette primary,
        bg=-palette primary.fg
      }
    }{
      \setbeamercolor{background canvas}{
        use=palette primary,
        bg=palette primary.bg
      }
    }
  \centering
  \usebeamercolor[fg]{palette primary}
  \usebeamerfont{plain title}
}

Then, we just need to end the group after the standout slide is finished in order to restore the colours and fonts for the rest of the presentation. Unfortunately, the obvious solution — \AfterEndEnvironment{frame}{...}doesn't work. I've therefore chosen to add the \endgroup to \beamer@reseteecodes, which I believe is run exactly once at the end of each slide. I'm not 100% confident of this, though, so if we choose to go this route we'll need to test extensively to make sure there are no unintended consequences.

\apptocmd{\beamer@reseteecodes}{%
  \ifbool{metropolis@standout}{
    \endgroup
    \boolfalse{metropolis@standout}}{}
}

Discussion

The primary question we should answer here is do we want to implement plain slides as an optional argument to frame? (Presumably we will still support the \plain syntax as well.) If the answer is "no" we can just close this issue; if it's "yes", I will pull request the above implementation and we can discuss there if it works or can be improved.

from mtheme.

 avatar commented on May 14, 2024

Thanks for looking into this further. I haven't been able to get to this but I still think it would be a good feature.

from mtheme.

matze avatar matze commented on May 14, 2024

The primary question we should answer here is do we want to implement plain slides as an optional argument to frame?

Tough call. However, for the sake of the listed advantages I'd support your proposal for the standout option. In the long run (i.e. for 2.0), I'd deprecate the \plain command though.

from mtheme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.