Hi Simon,

Ok, your description matches what I had in mind.

I looked into patching ox-beamer.el and it seems pretty straightforward.
Attached is the patched version along with a beamer file that exhibits
the patch (the last slide) and the tex file that is generated (you can
see that the BEAMER_FRAME_ENV property is picked-up correctly).

Can you try this patched version with your intended application, please,
and tell me if it works for you?

Pedro, WDYT?

Leo

Attachment: ox-beamer.el
Description: ox-beamer.el

#+startup: beamer
#+LaTeX_CLASS: beamer

* A frame with =orgframe= sample code
#+begin_example
\begin{orgframe}
  Here is a beamer frame.
\end{orgframe}
#+end_example
This is exported in a =frame= environment, although it is marked as fragile.

* A frame with =frame= sample code
#+begin_example
\begin{frame}
  Here is a beamer frame.
\end{frame}
#+end_example
This is exported in an =orgframe= environment, since contains =\begin{frame}= and =\end{frame}=.

* An ordinary frame
\[ z^n = x^n + y^n \]
This is exported in a =frame= environment.

* A =frame= with a customized name
:PROPERTIES:
:BEAMER_FRAME_ENV: ltbframe
:END:
\[ z^n = x^n + y^n \]
This is exported in an =ltbframe= environment.
% Created 2025-09-22 Mon 15:31
% Intended LaTeX compiler: pdflatex
\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\newenvironment<>{orgframe}[1][]{\begin{frame}#2[environment=orgframe,#1]}{\end{frame}}
\usetheme{default}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={},
 pdflang={English}}
\begin{document}

\begin{frame}{Outline}
\tableofcontents
\end{frame}

\begin{frame}[label={sec:org490df19},fragile]{A frame with \texttt{orgframe} sample code}
 \begin{verbatim}
\begin{orgframe}
  Here is a beamer frame.
\end{orgframe}
\end{verbatim}
This is exported in a \texttt{frame} environment, although it is marked as fragile.
\end{frame}
\begin{orgframe}[label={sec:org51206f7},fragile]{A frame with \texttt{frame} sample code}
 \begin{verbatim}
\begin{frame}
  Here is a beamer frame.
\end{frame}
\end{verbatim}
This is exported in an \texttt{orgframe} environment, since contains \texttt{\textbackslash{}begin\{frame\}} and \texttt{\textbackslash{}end\{frame\}}.
\end{orgframe}
\begin{frame}[label={sec:org0792547},fragile]{An ordinary frame}
 \[ z^n = x^n + y^n \]
This is exported in a \texttt{frame} environment.
\end{frame}
\begin{ltbframe}[label={sec:org95b7dfd},fragile]{A \texttt{frame} with a customized name}
 \[ z^n = x^n + y^n \]
This is exported in an \texttt{ltbframe} environment.
\end{ltbframe}
\end{document}


On Mon, Sep 22 2025, "Simon Brown" <[email protected]> wrote:

> Hi Leo,
>
> Apologies for the slow response. 
>
> I am not a Beamer or org-mode wizard, so I may have misunderstood
> something. I'm trying to produce presentations using a corporate style
> file that defines new environments for different slide types and would
> like to use different environments in the same document.
>
> Some of these follow document structure, like the new chapter slide we
> use to delimit sections, but most relate to aesthetics(Picture only
> slide, Any Questions slide or invert theme colours slide). It would be
> useful for me to be able to override the environment so that I can
> specify the slide type I would like.
>
> Simon
>
> On Mon, 1 Sep 2025, at 9:40 PM, Leo Butler wrote:
>> IIRC, we/I considered adding a BEAMER_FRAME_ENV property to select the
>> frame environment. However, that was rejected as either too complicated
>> or unnecessary.
>>
>> IIUC, Simon wants to be able to select different frame environments in
>> the same beamer document. If that is right, then it might be worth
>> revisiting BEAMER_FRAME_ENV.
>>
>> Leo
>>
>> On Sun, Aug 31 2025, Pedro Andres Aranda Gutierrez <[email protected]> wrote:
>>
>>> Can this help?
>>>
>>> org-beamer-frame-environment is a variable defined in 'ox-beamer.el'.
>>>
>>> Its value is "frame"
>>> Original value was "orgframe"
>>>
>>> Name of the alternative beamer frame environment.
>>> In frames marked as fragile, this environment is used in place of
>>> the usual frame environment.
>>>
>>> This permits insertion of a beamer frame inside example blocks,
>>> working around beamer limitations.  See
>>> https://list.orgmode.org/[email protected]/T/#mc7221e93f138bdd56c916b194b9230d3a6c3de09
>>>
>>> This option may need to be changed when "\end{orgframe}" string is
>>> used inside beamer slides.
>>>
>>> It could be a starting point. Look at the code and check if you need a
>>> different behaviour.
>>>
>>> best, /pa
>>>
>>> On Sun, 31 Aug 2025 at 07:48, Simon Brown <[email protected]> wrote:
>>>>
>>>> Hello,
>>>>
>>>> At the second level you can use BEAMER_ENV to choose something other
>>>> than block in order to customise the frame. Is there a similar way
>>>> to override frame at the top level. The beamer theme I'm using has a
>>>> number of environments defined that I'd like to be able to pic from.
>>>>
>>>> Simon
>>>> --
>>>> Simon Brown
>>>>
>>
>> -- 
>> ---
>> Best regards,
>> Dr Butler

-- 
---
Best regards,
Dr Butler

Reply via email to