Org-mode mailing list
 help / color / mirror / Atom feed
From: Timothy <tecosaur@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] Babel: remove LaTeX environment -type #+results
Date: Sun, 25 Apr 2021 17:06:50 +0800
Message-ID: <87sg3eravp.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Hi All,

I think there's potential for some really nice experiences leveraging
Org's latex rendering in combination with some languages' symbolic maths
ability.

This is /very nearly/ already supported, `org-babel-result-end' just
needs to be tweaked to also remove LaTeX environment -type #+results.

This is what I'd like to make possible:


[-- Attachment #2: julia-org-inline-maths.png --]
[-- Type: image/png, Size: 22821 bytes --]

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-ob-core-Remove-LaTeX-environment-results-type.patch --]
[-- Type: text/x-patch, Size: 1618 bytes --]

From e7e7eb698883348eeb404c0bc58ed7aed52344c4 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Apr 2021 16:51:15 +0800
Subject: [PATCH] ob-core: Remove LaTeX environment #+results type

* lisp/ob-core.el (org-babel-result-end): By adding latex-enviroment to
the possible results types, a much richer experience is possible for
backends that can produce LaTeX-formatted maths as their results (for
example: Calc, Julia with Latexify, Python with SymPy, Octave with
symbolic). This is superior to a LaTeX export block as LaTeX
environments can be (1) rendered inline, and (2) better used in
non-LaTeX export formats (e.g. HTML with MathJax).  Without this,
backends can output a LaTeX environment, but new results will be added
in front instead of replacing the environment.
---
 lisp/ob-core.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2e78ac3e6..12f67a8e2 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2559,8 +2559,9 @@ (defun org-babel-result-end ()
 	 (let ((element (org-element-at-point)))
 	   (if (memq (org-element-type element)
 		     ;; Possible results types.
-		     '(drawer example-block export-block fixed-width item
-			      plain-list special-block src-block table))
+                     '(drawer example-block export-block fixed-width
+                              special-block src-block item plain-list table
+                              latex-environment))
 	       (save-excursion
 		 (goto-char (min (point-max) ;for narrowed buffers
 				 (org-element-property :end element)))
-- 
2.31.1


             reply	other threads:[~2021-04-25  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25  9:06 Timothy [this message]
2021-04-25 13:44 ` Greg Minshall
2021-04-25 18:09   ` Timothy
2021-04-26 11:25     ` Greg Minshall
2021-05-01 11:03 ` Bastien
2021-05-01 11:44   ` Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg3eravp.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git