emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Emmanuel Charpentier <emm.charpentier@free.fr>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: LaTeX-producing code : how to export results to HTML/ODT ?
Date: Sun, 4 Jul 2021 15:04:01 -0400	[thread overview]
Message-ID: <CAJ51ETog8DE0arRQtePbaHy9qmQtW_3HuBEkJhbmcBUSde4nUQ@mail.gmail.com> (raw)
In-Reply-To: <c9783c8eda3559a4a0f96ecbac3d5d490cc197e4.camel@free.fr>

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

This incantation worked for me:

#+name: foo
#+begin_src emacs-lisp :exports both :results drawer
  "Pseudo-function returning a LaTeX pseudo-result."
  "\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]"
#+end_src

#+RESULTS: foo
:results:
\[\displaystyle{\sin\left(\frac{a}{b}\right)}\]
:end:

the key is the drawer I think.
John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Sun, Jul 4, 2021 at 2:51 PM Emmanuel Charpentier <emm.charpentier@free.fr>
wrote:

> I tried this :
>
> #+property: header-args:sage :session
>
> #+options: tex:t toc:nil author:nil
>
> #+begin_src emacs-lisp :exports none
>
>   ;; (customize-set-variable
>
>   ;;  'org-latex-to-mathml-convert-command
>
>   ;;  "latexmlmath \"%i\" --presentationmathml=%o")
>
>   (custom-set-variables
>
>    '(org-latex-to-mathml-convert-command
>
>       "java -jar %j -unicode -force -df %o %I")
>
>    '(org-latex-to-mathml-jar-file
>
>       "/usr/local/bin/mathtoweb.jar"))
>
> #+end_src
>
>
> A "normal" function call with org result...
>
>
> #+name: foo
>
> #+begin_src emacs-lisp :exports both :results org
>
>   "Pseudo-function returning a LaTeX pseudo-result."
>
>   "\\[\\displaystyle{\\sin\\left(\\frac{a}{b}\\right)}\\]"
>
> #+end_src
>
>
> #+RESULTS: foo
>
> #+begin_src org
>
> \[\displaystyle{\sin\left(\frac{a}{b}\right)}\]
>
> #+end_src
>
>
> Which exports the LaTeX *source* (uncompiled) in PDF, HTML and ODT.
>
> I'm currently lookin into a =:post= workaround. But an option to export
> =latex= blocks to selected exporters (ODT, HTML, possibly Morkdown via
> pandoc).
>
> I'll keep you posted.
>
> Le dimanche 04 juillet 2021 à 14:10 -0400, John Kitchin a écrit :
> Can you declare the output as org so they will just be latex snippets?
>
> On Sun, Jul 4, 2021 at 3:46 AM Emmanuel Charpentier <
> emm.charpentier@free.fr> wrote:
>
> Dear list,
>
> Org-mode offers the ability to create functions returning LaTeX results :
> such occurrences are frequent with Sagemath, Maxima, Mathematica, R, and
> even emacs's Calc...
>
> Such functions can be declared has having LaTeX output, and the resulting
>  =#+begin_export latex ...  #+end_export latex= block is exported as LaTeX
> and end up in the PDF versin.
>
> But such blocks seem to export **only** to LaTeX/PDF ; more specically,
> they do not export to HTML nor ODT. In order to insert those results at
> export, one **has** to print them **raw**. See the attached examples, and
> compare PDF, HTML and ODT outputs of the enclosed zip archive (necessary to
> avoid the wrath of the spam filter of my provider ;-)...)..
>
> Unless I am mistaken, this is the *only* way to export LaTeX exports to
> HTML/ODT ; I am not aware of any option allowing to force such exports. So
> a couple questions :
>
>    - Am I mistaken ?
>    - Are there more steamlined ways to get LaTeX in
>    HTML/ODF/whatever-but-not-LaTeX ?
>    - Wouldn't an option to allow these exports be a welcome addition to
>    the export structure (or possibly to the various exporters) ?
>
>
> Thanks in advance,
>
>
>

[-- Attachment #2: Type: text/html, Size: 4784 bytes --]

  reply	other threads:[~2021-07-04 19:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04  7:45 LaTeX-producing code : how to export results to HTML/ODT ? Emmanuel Charpentier
2021-07-04 18:10 ` John Kitchin
2021-07-04 18:51   ` Emmanuel Charpentier
2021-07-04 19:04     ` John Kitchin [this message]
2021-07-04 21:13       ` Emmanuel Charpentier
2021-07-14  6:41       ` Timothy
2021-07-14  8:16         ` Emmanuel Charpentier
2021-07-04 21:11   ` Emmanuel Charpentier

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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=CAJ51ETog8DE0arRQtePbaHy9qmQtW_3HuBEkJhbmcBUSde4nUQ@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=emm.charpentier@free.fr \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).