Leo Butler <leo.but...@umanitoba.ca> writes:

>> Apparently, LaTeX has really hard time processing verbatim code inside
>> beamer frames.
>
> I looked again at the solution here:
> https://tex.stackexchange.com/questions/140719/verbatim-in-beamer-showing-error-file-ended-while-scanning-use-of-xverbatim
>
> and it errors out with a recent version of pdflatex:
>
>    This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) 
> (preloaded format=pdflatex)
>
> This is, apparently, a known problem:
>
> https://github.com/josephwright/beamer/issues/360
>
> The end of that issue report includes a work-around that we might apply
> in org. I have attached a patch for your feedback. The example that
> stimulated this discussion compiles with the patch and the testsuite
> shows no errors related to it.

Thanks!
I have concerns about your approach though.

You are replacing all the frame environments with custom environment
unconditionally. However, custom environment has downsides. For example,
\againframe will stop working, as pointed earlier in the linked beamer
thread
https://github.com/josephwright/beamer/issues/360#issuecomment-708705250

Since the problem appears only when the frame contents contains
\end{frame}, it may be sufficient to replace the standard frame
environment with the workaround only in such scenario.

> +;; Needed to set-up Beamer export.
> +(defconst org-beamer--frame-environment
> +  (concat "orgframe" (org-id-uuid))
> +  "Name of the beamer frame environment.
> +This is randomized to prevent collisions.")

Please use constant name. (org-id-uuid) makes export randomized for no
good reason.

>  ;; Install a default set-up for Beamer export.
>  (unless (assoc "beamer" org-latex-classes)
>    (add-to-list 'org-latex-classes
> -            '("beamer"
> -              "\\documentclass[presentation]{beamer}"
> +            `("beamer"
> +              ,(concat "\\documentclass[presentation]{beamer}\n"
> +                          ;; Define an alias for the beamer frame environment
> +                         "\\newenvironment<>{"
> +                         org-beamer--frame-environment
> +                         "}[1][]{\\begin{frame}[environment="
> +                         org-beamer--frame-environment
> +                         ",#1]}{\\end{frame}}")

Please use `org-beamer-template' rather than modifying the class.
Modifying the class may confuse users.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to