Hi,

I have updated the attached patch to use `mapconcat' as requested. `org-format-latex-header' is already declared earlier in ob-latex.el.

I am not sure what kind of test you have in mind, since this feature isn't completely internal to org-mode. For example, the preview compiles but the produced PDF is incorrect before this fix, and I believe the org preview machinery ignores errors from the latex compiler.

Best,

YL

On Thu, May 7, 2020 at 1:37 PM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello,

Yuri Lensky <ydl@ydl.cm> writes:

> Subject: [PATCH] lisp/ob-latex.el: Stop ignoring headers argument

Thank you.

> During default "png" export, the "headers" argument is no longer
> explicitly ignored.

According to the TODO in that function, this is not the first time it
happens. Would you mind writing a test for it?

> +          (let ((org-format-latex-header
> +              (concat org-format-latex-header "\n"
> +                      (string-join headers "\n"))))
> +        (org-create-formula-image
> +            body out-file org-format-latex-options in-buffer)))

This looks hackish but I don't know how to do it otherwise. However
could you use `mapconcat' instead of `string-join'?

Also, you need to declare `org-format-latex-header' in order to silence
byte-compiler.

Regards,

--
Nicolas Goaziou