Created
January 5, 2022 15:56
-
-
Save patrl/91596a846fc6c52d831681665b26bc73 to your computer and use it in GitHub Desktop.
Hack to make org special blocks work with gb4e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun patrl/org-latex-special-block (special-block contents info) | |
"Transcode a SPECIAL-BLOCK element from Org to LaTeX. | |
CONTENTS holds the contents of the block. INFO is a plist | |
holding contextual information." | |
(let ((type (org-element-property :type special-block)) | |
(opt (org-export-read-attribute :attr_latex special-block :options)) | |
(caption (org-latex--caption/label-string special-block info)) | |
(caption-above-p (org-latex--caption-above-p special-block info))) | |
(if | |
(equal (format "%s" type) "exe") | |
(concat (format "\\begin{%s}%s\n" type (or opt "")) | |
(and caption-above-p caption) | |
"\\ex " contents | |
(and (not caption-above-p) caption) | |
(format "\\end{%s}" type)) | |
(concat (format "\\begin{%s}%s\n" type (or opt "")) | |
(and caption-above-p caption) | |
contents | |
(and (not caption-above-p) caption) | |
(format "\\end{%s}" type))))) | |
(org-export-define-derived-backend 'patrl/latex 'latex | |
:translate-alist '((special-block . patrl/org-latex-special-block))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment