[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) |
Hello,
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.
(custom-env
(let ((caption-str (org-latex--caption/label-string src-block info))
(formatted-src (org-export-format-code-default src-block info)))
(cond
((stringp custom-env) (format "\\begin{%s}\n%s\\end{%s}\n"
custom-env
(concat (and caption-above-p caption-str)
formatted-src
(and (not caption-above-p)
caption-str))
custom-env))
((functionp custom-env) (funcall custom-env
formatted-src
(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)))))
#+end_src
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.
WDYT?
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Athmospheric CO₂ (Updated November 22, 2015, Mauna Loa Obs.): 400.35 ppm
signature.asc
Description: PGP signature
- [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/16
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/20
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/20
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/20
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex,
Alan Schmitt <=
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/23
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/24
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/24
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/25
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/25
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/27
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/27
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Alan Schmitt, 2015/11/30
- Re: [O] interaction between org-latex-custom-lang-environments and name when exporting to latex, Rasmus, 2015/11/30