emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: LaTeX-producing code : how to export results to HTML/ODT
@ 2021-07-07 13:57 CHARPENTIER Emmanuel via General discussions about Org-mode.
  2021-07-07 20:04 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: CHARPENTIER Emmanuel via General discussions about Org-mode. @ 2021-07-07 13:57 UTC (permalink / raw)
  To: jkitchin; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 750 bytes --]

> Here is a way way to combine the output with a name/caption.

Slight modification : caption in emacs-lisp (to avoid sh blocks) : see the enclosed archive (necessary to avoid anti-spam blocking by my ISP).

Mixed results (see enclosed archive):

- ODT exports : I get a captioned block containing the equation, correctly referenced.

- HTML : I get the equation (via MathML/Mathjax), no caption and a reference to nothing visible.

- PDF via LaTeX : I get the math and an undefined reference (??).

- Docx from ODT : mangled math, unrelated caption, reference to nothing.

There is a nice idea, but it is still perfectible. I'm afraid that filering by exporter is still necessary...

Thank you again !

--
Emmanuel Charpentier


[-- Attachment #1.2: Type: text/html, Size: 1191 bytes --]

[-- Attachment #2: EqRefMin.zip --]
[-- Type: application/zip, Size: 119542 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LaTeX-producing code : how to export results to HTML/ODT
  2021-07-07 13:57 LaTeX-producing code : how to export results to HTML/ODT CHARPENTIER Emmanuel via General discussions about Org-mode.
@ 2021-07-07 20:04 ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2021-07-07 20:04 UTC (permalink / raw)
  To: CHARPENTIER Emmanuel; +Cc: emacs-orgmode

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

I am not sure you have the best math example, isn't the syntax \[\] for
unnumbered equations in latex? What would it even ref? In the export, you
can see that there is no label in the tex at least.

#+BEGIN_SRC emacs-lisp :exports both :results value drawer :post
caption(name="eq-integral", caption="This is an equation.", data=*this*)
  "\\begin{equation}
\\int_0^2 e^x dx
\\end{equation}"
#+END_SRC

works better for latex. I guess that is always going to be some kind of
limitation.

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 Wed, Jul 7, 2021 at 9:58 AM CHARPENTIER Emmanuel <
emmanuel.charpentier@aphp.fr> wrote:

> > Here is a way way to combine the output with a name/caption.
>
>
> Slight modification : caption in emacs-lisp (to avoid sh blocks) : see the
> enclosed archive (necessary to avoid anti-spam blocking by my ISP).
>
> Mixed results (see enclosed archive):
>
> - ODT exports : I get a captioned block containing the equation, correctly
> referenced.
>
> - HTML : I get the equation (via MathML/Mathjax), no caption and a
> reference to nothing visible.
>
> - PDF via LaTeX : I get the math and an undefined reference (??).
>
> - Docx from ODT : mangled math, unrelated caption, reference to nothing.
>
> There is a nice idea, but it is still perfectible. I'm afraid that
> filering by exporter is still necessary...
>
> Thank you again !
>
> --
> Emmanuel Charpentier
>
>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LaTeX-producing code : how to export results to HTML/ODT
  2021-07-05 17:01 autofrettage
@ 2021-07-06 14:24 ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2021-07-06 14:24 UTC (permalink / raw)
  To: autofrettage; +Cc: emacs-orgmode

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

Here is a way way to combine the output with a name/caption. I adapted this
from the post-processing section in
https://orgmode.org/manual/Results-of-Evaluation.html

#+NAME: caption
#+BEGIN_SRC sh :var data="" :var caption="" name=""  :results output
echo "#+name: $name"
echo "#+caption: $caption"
echo "$data"
#+END_SRC


Here we have a block that outputs a latex string, for example.

#+BEGIN_SRC emacs-lisp :results value drawer :post
caption(name="eq-integral", caption="This is an equation.", data=*this*)
"$\int_0^2 e^x dx$"
#+END_SRC

#+RESULTS:
:results:
#+name: eq-integral
#+caption: This is an equation.
$int_0^2 e^x dx$
:end:
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 Mon, Jul 5, 2021 at 1:04 PM autofrettage <autofrettage@protonmail.ch>
wrote:

> Hi,
>
> I simply cannot ignore this opportunity to expose my utter Org Mode
> ignorance!
>
> Emmanuel > ... and how to use it with captions, labels and
> cross-references.
>
> I have tried using the code-splicing functionality with some success; The
> result from one source code block "foo", can be inserted into another one
> with <<foo()>>.
>
> If you take away the parentheses, then the source code block "foo" instead
> of its results will be inserted.
>
> Emm.> But I still don't "get" drawers, I thonk.
>
> You're not alone.
>
> Rasmus
>
>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LaTeX-producing code : how to export results to HTML/ODT
@ 2021-07-05 17:01 autofrettage
  2021-07-06 14:24 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: autofrettage @ 2021-07-05 17:01 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I simply cannot ignore this opportunity to expose my utter Org Mode ignorance!

Emmanuel > ... and how to use it with captions, labels and cross-references.

I have tried using the code-splicing functionality with some success; The result from one source code block "foo", can be inserted into another one with <<foo()>>.

If you take away the parentheses, then the source code block "foo" instead of its results will be inserted.

Emm.> But I still don't "get" drawers, I thonk.

You're not alone.

Rasmus


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-07 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 13:57 LaTeX-producing code : how to export results to HTML/ODT CHARPENTIER Emmanuel via General discussions about Org-mode.
2021-07-07 20:04 ` John Kitchin
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05 17:01 autofrettage
2021-07-06 14:24 ` John Kitchin

Code repositories for project(s) associated with this 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).