[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: Tue, 24 Nov 2015 09:07:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)

Hi Rasmus,

On 2015-11-23 18:54, Rasmus <address@hidden> writes:

> Hi Alan,
> Alan Schmitt <address@hidden> writes:
>> 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:
> I think a format-string is fine, though I don’t oppose allowing a function
> as well.  I don’t foresee a great necessity of the latter, though.
> I'd use format-spec.  E.g. here’s how hyperref is filled
>     (let ((template (plist-get info :latex-hyperref-template)))
>            (and (stringp template)
>                 (format-spec template (org-latex--format-spec info))))

I did not know about `format-spec', it's really nice!

> Then the cdr of an element in org-latex-custom-lang-environments can be
> something like:
>    \begin{%e}[label=%l, myfunkyoption=val]
>     %c
>     \end{%e}

What would "%e" be bound to? Since this is a customization for a given
source block, it should be fixed, so I think we only need "%l" and "%c".

> The only downside is that you’d have to somehow discriminate between the
> "old" case where the cdr is a single word denoting an environment.
> Something like this might work:
>           (string-match-p "\\`\\w+\\'" "hest1")

This was the main reason why I did not want to go that route. This said,
after understanding this regexp, I see how I can explain how the two
cases are distinguished in the docstring.

>> 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.
> Well, functions would be user written.  In general I’d favor info and
> src-block, but I don’t think it’s very user-friendly, as it requires quite
> some knowledge about how ox works.  Also, when using such functions, the
> user would have to write a lot of boilerplate to get e.g . the label.

Yes. I'll give the template string a try and will report back.



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]