Re: [PATCH] Omit file description when :file-desc has nil value
Matt Huszagh writes: > This patch omits a file description when :file-desc has a nil > value. I've modified the patch to yield the same effect when executing a source block. Matt >From 24d156e421973b5a97f1c797d48f1daa95348898 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Wed, 2 Sep 2020 23:06:10 -0700 Subject: [PATCH] lisp/ob-core.el: Omit file description when :file-desc has nil value * lisp/ob-core.el (org-babel-insert-result): Omit file description when :file-desc value evaluates to nil. (org-babel-execute-src-block): Perform the same functionality when executing a src block. The previous implementation makes it impossible to provide a default :file-desc and in some cases override it to omit the description. --- lisp/ob-core.el | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 578622232..02c0a153c 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -750,7 +750,8 @@ block." (org-babel-result-to-file file (let ((desc (assq :file-desc params))) - (and desc (or (cdr desc) result))) + (and (and desc (cdr desc)) + (cdr desc))) (setq result (org-babel-ref-resolve post)) (when file (setq result-params (remove "file" result-params)) @@ -2257,9 +2258,9 @@ INFO may provide the values of these header arguments (in the (setq result (org-no-properties result)) (when (member "file" result-params) (setq result (org-babel-result-to-file - result (when (assq :file-desc (nth 2 info)) - (or (cdr (assq :file-desc (nth 2 info))) - result)) + result (when (and (assq :file-desc (nth 2 info)) + (cdr (assq :file-desc (nth 2 info + (cdr (assq :file-desc (nth 2 info ((listp result)) (t (setq result (format "%S" result (if (and result-params (member "silent" result-params)) -- 2.28.0
[PATCH] Omit file description when :file-desc has nil value
Hello, This patch omits a file description when :file-desc has a nil value. Previously, the following src block #+BEGIN_SRC asymptote :results value file :file circle.pdf :file-desc :output-dir img/ size(2cm); draw(unitcircle); #+END_SRC would yield #+RESULTS: [[file:img/circle.pdf][circle.pdf]] This makes it impossible (I think) to provide :file-desc with a default value and prevent the description in some cases. This patch would cause the same code block to execute to #+RESULTS: [[file:img/circle.pdf]] I feel I may be missing something in regard to why this previously had the functionality it did. Is there a use case I've missed? To me, the documentation seems to indicate that my patch is the desired behavior: The =file-desc= header argument defines the description (see [[*Link Format]]) for the link. If =file-desc= has no value, the "description" part of the link will be omitted. Full disclaimer: I wrote this section of the documentation as part of this patch: https://lists.gnu.org/archive/html/emacs-orgmode/2020-07/msg00320.html Thanks Matt >From edcfa85add6ac71a1e13b7731779ccf4a8e12868 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Wed, 2 Sep 2020 23:06:10 -0700 Subject: [PATCH] lisp/ob-core.el: Omit file description when :file-desc has nil value * lisp/ob-core.el (org-babel-insert-result): Omit file description when :file-desc value evaluates to nil. The previous implementation makes it impossible to provide a default :file-desc and in some cases override it to omit the description. --- lisp/ob-core.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 578622232..55165ebc5 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2257,9 +2257,9 @@ INFO may provide the values of these header arguments (in the (setq result (org-no-properties result)) (when (member "file" result-params) (setq result (org-babel-result-to-file - result (when (assq :file-desc (nth 2 info)) - (or (cdr (assq :file-desc (nth 2 info))) - result)) + result (when (and (assq :file-desc (nth 2 info)) + (cdr (assq :file-desc (nth 2 info + (cdr (assq :file-desc (nth 2 info ((listp result)) (t (setq result (format "%S" result (if (and result-params (member "silent" result-params)) -- 2.28.0
Bug: No colors in first file opened [9.3.7 (9.3.7-dist @ c:/w/.emacs.d/org-9.3.7/lisp/)]
No colors appear in first file opened. Must use (org-mode-restart) to enable colors after opening first file.
Re: ob-java and ob-haxe
ian martins writes: > I posted patches for ob-java and ob-haxe a couple months ago but there was > no interest. I have been given access to push to contrib. If there's no > objection I'll put them there. > > I'll rename my version ob-java-alt so it doesn't conflict with the official > one. The contrib directory doesn't have a "testing" directory so I'll add > one. I'll document them in worg. My understanding is that there's been a move away from adding new libraries to contrib/, instead preferring an ELPA for cases where core isn't deemed appropriate. Fixes and enhancements to ob-java are obviously appropriate for core. And while it'd be fine to host ob-haxe separately, my impression is that it too would be suitable for core. I'm sorry your patches haven't gotten any reviews or other feedback. I've sat down a couple of times to review the ob-haxe patch but haven't ended up blocking off enough time to get anywhere. I'll revisit it this weekend. Of course, any feedback from those that actually use haxe would be appreciated.
Re: Headline generation as in diary?
Robert Pluim writes: > OK. Thatʼs as far as my org-hacking knowledge goes, so perhaps someone > else here has an idea of the right way to invoke "tell me what heading > Iʼm in, as a string". The situation is actually like this: the empty string issue doesn't happen with time stamps <%%(...)>, this always uses the correct headline. Seems %%() entries are expected to return a string OTOH since the headline seems to be ignored. I guess this is reasonable. Dunno if there is something to change here at all in the code. Ok, the other thing: broken time stamps with line breaks: > You've lost me. Can you show me an example? The difference here is only a line break: This doesn't work: | ** APPT 17:00 Test | SCHEDULED: <%%(and (or (diary-date 03 09 2020) |(diary-date 04 09 2020)))> But this works: | ** APPT 17:00 Test | SCHEDULED: <%%(and (or (diary-date 03 09 2020) (diary-date 04 09 2020)))> Michael.
Re: [PATCH] babel latex headers and image generation commands
Matt Huszagh writes: > I've added a few changes to the patch that additionally allow custom the > begin and end document environments. The purpose here is to allow latex > code within the document environment that is ignored by the body > export. For instance, I can set the page color with > {\color{some-color}...} and this doesn't mess up latex exports. I've fixed a minor bug with the previous patch. >From 1bcd1d28dde6625d0c648c92243260b46433e1eb Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Fri, 28 Aug 2020 22:26:05 -0700 Subject: [PATCH] ob-latex.el: Make latex to svg compilation very customizable * lisp/ob-latex.el (org-babel-latex-preamble): Add latex preamble customization. (org-babel-latex-begin-env): Add latex document environment begin customization. (org-babel-latex-end-env): Add latex document environment end customization. (org-babel-latex-pdf-svg-process): Add customization for converting a pdf to svg. (org-babel-execute:latex): Add specific case for svg generation from latex block. --- lisp/ob-latex.el | 57 ++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index 4b343dd14..991873e2e 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -70,6 +70,45 @@ :group 'org-babel :type 'string) +(defcustom org-babel-latex-preamble + (lambda (_) +"\\documentclass[preview]{standalone} +\\def\\pgfsysdriver{pgfsys-tex4ht.def} +") + "Closure which evaluates at runtime to the latex preamble. It +takes 1 argument which is the parameters of the source block." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-begin-env + (lambda (_) +"\\begin{document}") + "Closure which evaluates at runtime to the begin part of the +document environment. It takes 1 argument which is the +parameters of the source block. This allows adding additional +code that will be ignored when exporting the literal latex +source." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-end-env + (lambda (_) +"\\end{document}") + "Closure which evaluates at runtime to the end part of the +document environment. It takes 1 argument which is the +parameters of the source block. This allows adding additional +code that will be ignored when exporting the literal latex +source." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-pdf-svg-process + "inkscape --pdf-poppler %f -T -l -o %O" + "Command used to convert a PDF file to an SVG file when +executing a latex source block." + :group 'org-babel + :type 'string) + (defcustom org-babel-latex-htlatex-packages '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}") "Packages to use for htlatex export." @@ -114,12 +153,26 @@ This function is called by `org-babel-execute-src-block'." (mapconcat #'identity headers "\n" (org-create-formula-image body out-file org-format-latex-options in-buffer))) + ((string= "svg" extension) + (with-temp-file tex-file + (insert (concat (funcall org-babel-latex-preamble params) + (mapconcat #'identity headers "\n") + (funcall org-babel-latex-begin-env params) + body + (funcall org-babel-latex-end-env params + (let ((tmp-pdf (org-babel-latex-tex-to-pdf tex-file))) + (let* ((log-buf (get-buffer-create "*Org Babel LaTeX Output*")) + (err-msg "org babel latex failed") + (img-out (org-compile-file + tmp-pdf + (list org-babel-latex-pdf-svg-process) + extension err-msg log-buf))) +(shell-command (format "mv %s %s" img-out out-file) ((string-suffix-p ".tikz" out-file) (when (file-exists-p out-file) (delete-file out-file)) (with-temp-file out-file (insert body))) - ((and (or (string= "svg" extension) - (string= "html" extension)) + ((and (string= "html" extension) (executable-find org-babel-latex-htlatex)) ;; TODO: this is a very different way of generating the ;; frame latex document than in the pdf case. Ideally, both -- 2.28.0
Re: [PATCH] babel latex headers and image generation commands
Matt Huszagh writes: > Ok, I've finally gotten around to taking a crack at this. The patch is > attached. Basically, it allows a lot more control when converting a > latex source block into an svg image file. I've added a few changes to the patch that additionally allow custom the begin and end document environments. The purpose here is to allow latex code within the document environment that is ignored by the body export. For instance, I can set the page color with {\color{some-color}...} and this doesn't mess up latex exports. Please comment with any questions/concerns/thoughts. Thanks! >From 6dbd5ae840f02333f83d40a9c27be06968279563 Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Fri, 28 Aug 2020 22:26:05 -0700 Subject: [PATCH] ob-latex.el: Make latex to svg compilation very customizable * lisp/ob-latex.el (org-babel-latex-preamble): Add latex preamble customization. (org-babel-latex-begin-env): Add latex document environment begin customization. (org-babel-latex-end-env): Add latex document environment end customization. (org-babel-latex-pdf-svg-process): Add customization for converting a pdf to svg. (org-babel-execute:latex): Add specific case for svg generation from latex block. --- lisp/ob-latex.el | 57 ++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index 4b343dd14..359179476 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -70,6 +70,45 @@ :group 'org-babel :type 'string) +(defcustom org-babel-latex-preamble + (lambda (_) +"\\documentclass[preview]{standalone} +\\def\\pgfsysdriver{pgfsys-tex4ht.def} +") + "Closure which evaluates at runtime to the latex preamble. It +takes 1 argument which is the parameters of the source block." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-begin-env + (lambda (_) +"\\begin{document}") + "Closure which evaluates at runtime to the begin part of the +document environment. It takes 1 argument which is the +parameters of the source block. This allows adding additional +code that will be ignored when exporting the literal latex +source." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-end-env + (lambda (_) +"\\end{document}") + "Closure which evaluates at runtime to the end part of the +document environment. It takes 1 argument which is the +parameters of the source block. This allows adding additional +code that will be ignored when exporting the literal latex +source." + :group 'org-babel + :type 'function) + +(defcustom org-babel-latex-pdf-svg-process + "inkscape --pdf-poppler %f -T -l -o %O" + "Command used to convert a PDF file to an SVG file when +executing a latex source block." + :group 'org-babel + :type 'string) + (defcustom org-babel-latex-htlatex-packages '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}") "Packages to use for htlatex export." @@ -114,12 +153,26 @@ This function is called by `org-babel-execute-src-block'." (mapconcat #'identity headers "\n" (org-create-formula-image body out-file org-format-latex-options in-buffer))) + ((string= "svg" extension) + (with-temp-file tex-file + (insert (concat (funcall org-babel-latex-preamble params) + (mapconcat #'identity headers "\n") + (funcall org-babel-latex-begin-env) + body + (funcall org-babel-latex-end-env + (let ((tmp-pdf (org-babel-latex-tex-to-pdf tex-file))) + (let* ((log-buf (get-buffer-create "*Org Babel LaTeX Output*")) + (err-msg "org babel latex failed") + (img-out (org-compile-file + tmp-pdf + (list org-babel-latex-pdf-svg-process) + extension err-msg log-buf))) +(shell-command (format "mv %s %s" img-out out-file) ((string-suffix-p ".tikz" out-file) (when (file-exists-p out-file) (delete-file out-file)) (with-temp-file out-file (insert body))) - ((and (or (string= "svg" extension) - (string= "html" extension)) + ((and (string= "html" extension) (executable-find org-babel-latex-htlatex)) ;; TODO: this is a very different way of generating the ;; frame latex document than in the pdf case. Ideally, both -- 2.28.0
Re: babel default header args as functions
Matt Huszagh writes: > I've generated a patch for this. Please let me know your thoughts. I > believe this adds valuable flexibility to default header > arguments. I've added an additional fix that makes this work during export too. >From aec4e905d5d72f9a124adfde877835a783bd637b Mon Sep 17 00:00:00 2001 From: Matt Huszagh Date: Fri, 28 Aug 2020 11:05:59 -0700 Subject: [PATCH] ob-core.el: Add ability to use closures as default header arguments * lisp/ob-core.el (org-babel-default-header-args): Document ability to use functions. (eval-default-headers): New function to generate default header arguments, which adds the ability to evaluate function arguments at runtime. (org-babel-get-src-block-info): Use new header argument evaluate function when retreiving src block info. * lisp/ob-exp.el (org-babel-exp-src-block): Must use new eval-default-headers when exporting as well. The closures are evaluated at runtime. --- lisp/ob-core.el | 32 ++-- lisp/ob-exp.el | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 578622232..4a22f17e7 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -473,7 +473,23 @@ For the format of SAFE-LIST, see `org-babel-safe-header-args'." (defvar org-babel-default-header-args '((:session . "none") (:results . "replace") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) - "Default arguments to use when evaluating a source block.") + "Default arguments to use when evaluating a source block. + +This is a list in which each element is an alist. Each key +corresponds to a header argument, and each value to that header's +value. The value can either be a string or a closure that +evaluates to a string at runtime. For instance, imagine you'd +like to set the file name output of a latex source block to a +sha1 of its contents. We could achieve this with: + +(defun org-src-sha () + (let ((elem (org-element-at-point))) +(concat (sha1 (org-element-property :value elem)) \".svg\"))) + +(setq org-babel-default-header-args:latex + `((:results . \"file link replace\") +(:file . (lambda () (org-src-sha)") + (put 'org-babel-default-header-args 'safe-local-variable (org-babel-header-args-safe-fn org-babel-safe-header-args)) @@ -584,6 +600,18 @@ the outer-most code block.") (defvar *this*) +(defun eval-default-headers (headers) + "Compute default header list set with HEADERS. + + Evaluate all default header arguments set to functions prior to + returning the list of header arguments." + (let ((lst nil)) +(dolist (elem (eval headers t)) + (if (listp (cdr elem)) + (push `(,(car elem) . ,(funcall (cdr elem))) lst) +(push elem lst))) +lst)) + (defun org-babel-get-src-block-info (&optional light datum) "Extract information from a source block or inline source block. @@ -615,7 +643,7 @@ a list with the following pattern: (apply #'org-babel-merge-params (if inline org-babel-default-inline-header-args org-babel-default-header-args) - (and (boundp lang-headers) (eval lang-headers t)) + (and (boundp lang-headers) (eval-default-headers lang-headers)) (append ;; If DATUM is provided, make sure we get node ;; properties applicable to its location within diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 34caf9546..13277f64f 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -103,7 +103,7 @@ Assume point is at block opening line." (apply #'org-babel-merge-params org-babel-default-header-args (and (boundp lang-headers) - (symbol-value lang-headers)) + (eval-default-headers lang-headers)) (append (org-babel-params-from-properties lang) (list raw-params))) (setf hash (org-babel-sha1-hash info :export))) -- 2.28.0
Re: Headline generation as in diary?
> On Wed, 02 Sep 2020 15:45:36 +0200, Michael Heerdegen > said: Michael> Robert Pluim writes: >> How about: >> >> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el >> index 78fe13303..9049b3a42 100644 >> --- a/lisp/org-agenda.el >> +++ b/lisp/org-agenda.el >> @@ -5772,7 +5772,7 @@ displayed in agenda view." >> r (replace-match "" nil nil r))) >> (if (string-match "\\S-" r) >> (setq txt r) >> - (setq txt "SEXP entry returned empty string")) >> + (setq txt (org-no-properties (org-get-heading t t t t >> (setq txt (org-agenda-format-item extra txt level category tags 'time)) >> (org-add-props txt props 'org-marker marker >> 'date date 'todo-state todo-state Michael> Thanks for looking at this. Michael> Ok - That gives me a headline in the agenda, but a wrong one (more or Michael> less, a random headline in the same file, at a seemingly unrelated Michael> location). OK. Thatʼs as far as my org-hacking knowledge goes, so perhaps someone else here has an idea of the right way to invoke "tell me what heading Iʼm in, as a string". >> >> ** Just before midnight on a few days 23:00-24:00 >> >> <%%(org-block 2020 8 31 2020 9 2)> >> >> <%%(org-block 2020 9 10 2020 9 12)> >> Michael> But it seems those time stamps are not allowed to span Michael> multiple lines Michael> (at least I don't get it work). Seems org doesn't Michael> recognize them as Michael> such? >> >> Itʼs working fine for me in org-9.3.6. Note that I have my default >> agenda view set to a fortnight, and those dates span two different >> weeks. Michael> I didn't mean time spans. What doesn't work for me are time _stamps_ Michael> that span multiple text lines. You've lost me. Can you show me an example? Robert
Re: Headline generation as in diary?
Robert Pluim writes: > How about: > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index 78fe13303..9049b3a42 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -5772,7 +5772,7 @@ displayed in agenda view." > r (replace-match "" nil nil r))) > (if (string-match "\\S-" r) > (setq txt r) > - (setq txt "SEXP entry returned empty string")) > + (setq txt (org-no-properties (org-get-heading t t t t > (setq txt (org-agenda-format-item extra txt level category tags > 'time)) > (org-add-props txt props 'org-marker marker > 'date date 'todo-state todo-state Thanks for looking at this. Ok - That gives me a headline in the agenda, but a wrong one (more or less, a random headline in the same file, at a seemingly unrelated location). > (Iʼm guessing yet-another-config-variable is unnecessary) I think so toom yes. > >> You can use them in timestamps as well, which is useful for > >> weird time > >> periods > >> > >> ** Just before midnight on a few days 23:00-24:00 > >> <%%(org-block 2020 8 31 2020 9 2)> > >> <%%(org-block 2020 9 10 2020 9 12)> > > Michael> But it seems those time stamps are not allowed to span > Michael> multiple lines > Michael> (at least I don't get it work). Seems org doesn't > Michael> recognize them as > Michael> such? > > Itʼs working fine for me in org-9.3.6. Note that I have my default > agenda view set to a fortnight, and those dates span two different > weeks. I didn't mean time spans. What doesn't work for me are time _stamps_ that span multiple text lines. Thanks, Michael.
ob-java and ob-haxe
I posted patches for ob-java and ob-haxe a couple months ago but there was no interest. I have been given access to push to contrib. If there's no objection I'll put them there. I'll rename my version ob-java-alt so it doesn't conflict with the official one. The contrib directory doesn't have a "testing" directory so I'll add one. I'll document them in worg. -Ian
[PATCH] prevent mangled output in ob-J by allowing sit-time duration to be customized
Hello! The problem is that we read the contents of the output after 0.1 seconds, which, for expensive computations, results in the mangling of output. Output from expensive computations gets propagated down to subsequent code-blocks' outputs, producing a horrible mess. Joseph From ee08934a649b4a6c14d8b2ee1c24f849621284a9 Mon Sep 17 00:00:00 2001 From: Joseph Novakovich Date: Mon, 31 Aug 2020 10:14:15 -0400 Subject: [PATCH] ob-J.el: Add ability to customize sit duration * lisp/ob-J.el (org-babel-execute:J, org-babel-J-eval-string): Add customizability. (org-babel-execute:J): Lookup optional parameter `:sit' to allow one to wait for a specified amount of time before grabbing the output of the J subprocess. Pass this specified value or the previous default of .1 to `org-babel-J-eval-string'. (org-babel-eval-string): Pass new argument `sit-time' to `sit-for' before grabbing output. The problem is that we read the contents of the output after 0.1 seconds, which, for expensive computations, results in the mangling of output. Output from expensive computations gets propagated down to subsequent code-blocks' outputs, producing a horrible mess. TINYCHANGE --- lisp/ob-J.el | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/ob-J.el b/lisp/ob-J.el index c0145211b..f26e82ed9 100644 --- a/lisp/ob-J.el +++ b/lisp/ob-J.el @@ -76,6 +76,8 @@ This function is called by `org-babel-execute-src-block'." (message "executing J source code block") (let* ((processed-params (org-babel-process-params params)) (sessionp (cdr (assq :session params))) + (sit-time (let ((sit (assq :sit params))) + (if sit (cdr sit) .1))) (full-body (org-babel-expand-body:J body params processed-params)) (tmp-script-file (org-babel-temp-file "J-src"))) @@ -86,9 +88,9 @@ This function is called by `org-babel-execute-src-block'." (with-temp-file tmp-script-file (insert full-body)) (org-babel-eval (format "%s < %s" org-babel-J-command tmp-script-file) "")) - (org-babel-J-eval-string full-body) + (org-babel-J-eval-string full-body sit-time) -(defun org-babel-J-eval-string (str) +(defun org-babel-J-eval-string (str sit-time) "Sends STR to the `j-console-cmd' session and executes it." (let ((session (j-console-ensure-session))) (with-current-buffer (process-buffer session) @@ -96,7 +98,7 @@ This function is called by `org-babel-execute-src-block'." (insert (format "\n%s\n" str)) (let ((beg (point))) (comint-send-input) - (sit-for .1) + (sit-for sit-time) (buffer-substring-no-properties beg (point-max)) -- 2.28.0
Re: latex fragments compilation error when exporting to html
Hi, I can't comment on the rest of the discussion but I think I added this org-html--unlabel-latex-environment line. It was part of a change allowing links to equations in HTML export (https://lists.gnu.org/archive/html/emacs-orgmode/2018-01/msg00120.html). When removing the call to org-html--unlabel-latex-environment, exporting the following org file to html results in double equation labels (one from dvipng, one from org to allow links). , | #+OPTIONS: toc:nil html-postamble:nil tex:dvipng | | #+NAME: eq-test | \begin{align} | 1 + 1 = 0 | \end{align} | | link to equation [[eq-test]] ` (one could play with tex:mathjax and replace align by align* to see the possible modes) If I understand the problem correctly, one solution would be to apply the environment transformation from env to env* only for math environments. Something along the lines of , | (if (eq nil (org-html--math-environment-p latex-environment)) | latex-frag | (org-html--unlabel-latex-environment latex-frag)) ` may work (there may be a better way to do that). I hope this helps. Best, thibault On 2020-09-02T02:12:01-0400, Jeremie Juste wrote: Hello, I have found the culprit in the end. It was the function org-html--unlabel-latex-environment, int he ox-html.el file. I'm not sure this function is useful as I think it is better to give the user control on his environment (labelled or unlabelled) directly in his org file. I'm I missing something else about the use of this function? Anyway it was a good experience at debugging elisp. diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 55d017529..b2a5d6d36 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2891,7 +2891,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ((assq processing-type org-preview-latex-process-alist) (let ((formula-link (org-html-format-latex - (org-html--unlabel-latex-environment latex-frag) + latex-frag processing-type info))) (when (and formula-link (string-match "file:\\([^]]*\\)" formula-link)) (let ((source (org-export-file-uri (match-string 1 formula-link Best regards, Jeremie - GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2020-09-01 - Org mode version 9.3.7 (release_9.3.7-725-g7bc18e @ /home/djj/src/org-mode/lisp/)