wyleyr / ox-linguistics

Support for linguistics-style examples in Org mode
GNU General Public License v3.0
10 stars 3 forks source link

beamer #2

Open tmalsburg opened 1 year ago

tmalsburg commented 1 year ago

Wonderful idea, thanks for making and sharing this package. One question: I'd love to be able to use this on Beamer slides in my courses. However, Beamer requires a dedicated exporter itself, so I can either make Beamer slides or your exporter. How can this be resolved?

wyleyr commented 1 year ago

Yes, this is unfortunately a limitation of the way I designed the code. In retrospect, it would have been better to make the translation functions hook into an existing exporter, rather than defining a derived exporter.

A simple workaround would be to create a new backend derived from beamer, adding another definition along the lines of (untested)

(org-export-define-derived-backend
 'linguistics-beamer
 'beamer
 :menu-entry
 '(?B "Export to Linguistics Beamer"
      ((?L "As LaTeX buffer" org-linguistics-export-as-latex)
       (?l "As LaTeX file" org-linguistics-export-to-latex)
       (?p "As PDF file" org-linguistics-export-to-pdf)
       (?o "As PDF file and open"
       (lambda (a s v b)
         (if a (org-latex-export-to-pdf t s v b)
           (org-open-file (org-latex-export-to-pdf nil s v b)))))))
  :translate-alist '((plain-list . org-linguistics-plain-list)
             (item . org-linguistics-item)
             (paragraph . org-linguistics-paragraph)))

But the right thing to do would be figure out how to conditionally trigger the translation functions from another exporter in the context of a list with an ATTR_LINGUISTICS property. (This would also be the first step to supporting other output formats like HTML or ODT.) I don't need this myself right now but if you get something like that working, patches/PRs are welcome!

tmalsburg commented 1 year ago

Thank you for the response and input. I'd love to work on this, but my own open source projects are suffering from bit rot and I'm afraid I need to focus my limited time on those. But I'll keep it in mind and will perhaps look into it when I feel I need to procrastinate really hard ;)