[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] interaction between org-latex-custom-lang-environments and name

From: Alan Schmitt
Subject: Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex
Date: Mon, 23 Nov 2015 12:13:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)


On 2015-11-20 11:41, Rasmus <address@hidden> writes:

> Alan Schmitt <address@hidden> writes:
>> I was wondering if someone had been able to reproduce this, and if so
>> should I file it as a bug?
> Sure.  It's how org-latex-src-block handles custom environments (see "Case
> 2.").  At the moment this is hardcoded.

I've started to look into this, and I would like some advice regarding
the design of the solution.

What I propose is to have either a string or a function in
`org-latex-custom-lang-environments'. A string would be used as it is
currently, whereas a function would be applied. Here is what it could
look like:

#+begin_src emacs-lisp
;; Case 2.  Custom environment.
(let ((caption-str (org-latex--caption/label-string src-block info))
       (formatted-src (org-export-format-code-default src-block info)))
    ((stringp custom-env) (format "\\begin{%s}\n%s\\end{%s}\n"
                                  (concat (and caption-above-p caption-str)
                                          (and (not caption-above-p) 
    ((functionp custom-env) (funcall custom-env
                                     (org-latex--label src-block info)))
    (t (user-error "`org-latex-custom-lang-environments' should map %s to 
either a string or a function" lang)))))

My main design question is what the arguments to the function should be.
I thought the formatted source code and label would work, but I'm
wondering if it may be better to simply give the `src-block' and `info'
arguments directly.



OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 22, 2015, Mauna Loa Obs.): 400.35 ppm

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]