* how can I create a new literal block for latex export?
@ 2015-06-23 8:47 Alan Schmitt
2015-06-23 9:32 ` Rasmus
0 siblings, 1 reply; 5+ messages in thread
From: Alan Schmitt @ 2015-06-23 8:47 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]
Hello,
I would like to create a block used to typeset the results of evaluation
of code when exporting to latex. This is what I currently tried:
#+latex_header: \usepackage{fancyvrb}
#+latex_header: \DefineVerbatimEnvironment{myres}{Verbatim}{fontsize=\scriptsize,frame=\topline}
then I have this property set
:PROPERTIES:
:header-args:js: :wrap "myres" :results output :exports both
:END:
Now every js source block is correctly evaluated to the correct
environment:
#+name: with_example
#+begin_src js
var x = 1
var f = function(o){ with(o){ return x } }
var o2 = { x : 2 }
var o3 = { x : 3 }
console.log("f({}) = " + f({}) +
", f(o2) = " + f(o2) +
", f(o3) = " + f(o3))
#+end_src
#+results: with_example
#+BEGIN_myres
f({}) = 1, f(o2) = 2, f(o3) = 3
#+END_myres
Unfortunately something happens during the export to latex: the contents
of myres are parsed. Here is the generated latex code:
\begin{minted}[frame=leftline,fontsize=\scriptsize]{js}
var x = 1
var f = function(o){ with(o){ return x } }
var o2 = { x : 2 }
var o3 = { x : 3 }
console.log("f({}) = " + f({}) +
", f(o2) = " + f(o2) +
", f(o3) = " + f(o3))
\end{minted}
\begin{myres}
f(\{\}) = 1, f(o2) = 2, f(o3) = 3
\end{myres}
Is there a way to tell org to leave the contents of myres blocks as-is?
Can I declare myres as a literal block?
Thanks,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Weekly CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how can I create a new literal block for latex export?
2015-06-23 8:47 how can I create a new literal block for latex export? Alan Schmitt
@ 2015-06-23 9:32 ` Rasmus
2015-06-23 13:03 ` Nicolas Goaziou
2015-06-23 14:15 ` Alan Schmitt
0 siblings, 2 replies; 5+ messages in thread
From: Rasmus @ 2015-06-23 9:32 UTC (permalink / raw)
To: emacs-orgmode
Alan Schmitt <alan.schmitt@polytechnique.org> writes:
> Is there a way to tell org to leave the contents of myres blocks as-is?
> Can I declare myres as a literal block?
I think your issue here is similar to Jacob's a couple of weeks back. I
don't remember the outcome anymore, but check
http://thread.gmane.org/gmane.emacs.orgmode/97798
--
The second rule of Fight Club is: You do not talk about Fight Club
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how can I create a new literal block for latex export?
2015-06-23 9:32 ` Rasmus
@ 2015-06-23 13:03 ` Nicolas Goaziou
2015-06-23 20:20 ` Alan Schmitt
2015-06-23 14:15 ` Alan Schmitt
1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2015-06-23 13:03 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Is there a way to tell org to leave the contents of myres blocks as-is?
>> Can I declare myres as a literal block?
>
> I think your issue here is similar to Jacob's a couple of weeks back. I
> don't remember the outcome anymore, but check
>
> http://thread.gmane.org/gmane.emacs.orgmode/97798
See also commit 8ff31bd0cf9179d7952d933d4638b658b3c9b3ba.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how can I create a new literal block for latex export?
2015-06-23 9:32 ` Rasmus
2015-06-23 13:03 ` Nicolas Goaziou
@ 2015-06-23 14:15 ` Alan Schmitt
1 sibling, 0 replies; 5+ messages in thread
From: Alan Schmitt @ 2015-06-23 14:15 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
Hi Rasmus,
On 2015-06-23 11:32, Rasmus <rasmus@gmx.us> writes:
> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Is there a way to tell org to leave the contents of myres blocks as-is?
>> Can I declare myres as a literal block?
>
> I think your issue here is similar to Jacob's a couple of weeks back. I
> don't remember the outcome anymore, but check
>
> http://thread.gmane.org/gmane.emacs.orgmode/97798
Thanks a lot for the link, I ended up using the solution from Charles
Berry:
have these header arguments
:PROPERTIES:
:header-args:js: :wrap latex :results output :exports both :post postenv("myres")
:END:
and use this postenv wrapper
#+NAME: postenv
#+BEGIN_SRC emacs-lisp :var env="myres" :exports none
(format "$\\Rightarrow$ \\begin{%s}\n%s\\end{%s}" env *this* env)
#+END_SRC
The resulting latex is exactly what I want.
Thanks again,
Alan
--
OpenPGP Key ID : 040D0A3B4ED2E5C7
Weekly CO₂ average (2015-05-30, Mauna Loa Observatory): 403.41 ppm
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-23 20:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 8:47 how can I create a new literal block for latex export? Alan Schmitt
2015-06-23 9:32 ` Rasmus
2015-06-23 13:03 ` Nicolas Goaziou
2015-06-23 20:20 ` Alan Schmitt
2015-06-23 14:15 ` Alan Schmitt
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).