emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Orthogonality of blocks


From: Eric S Fraga
Subject: Re: [O] Orthogonality of blocks
Date: Fri, 30 Dec 2011 14:17:13 +0000
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (gnu/linux)

Charles Turner <address@hidden> writes:

> Problem: I have two code blocks (#+BEGIN_SRC .. #+END) and I want to
> display them side by side on the page, perhaps within an org table.
>
> Is this possible? It doesn't seem to be. I think it would be nice to
> shove collapsed blocks into org table cells and have them rendered in
> the usual fashion with the different exporters. "First-class blocks"
> :-)
>
> Thanks,
>       Charles.

I know you have received answers for both HTML and ODT.  This is also
possible with latex.  One possible solution is as follows:

#+begin_src org
* Source code blocks arranged horizontally

  #+latex: \newsavebox{\blockone}\begin{lrbox}{\blockone}
#+begin_src octave :exports code :results silent
function f(x)
  y = 2*x;
end
#+end_src
  #+latex: \end{lrbox}

  #+latex: \newsavebox{\blocktwo}\begin{lrbox}{\blocktwo}
#+begin_src octave :exports code :results silent
a = 10;
b = f(a);
disp(b)
#+end_src
  #+latex: \end{lrbox}

  | Function definition | Function use       |
  |---------------------+--------------------|
  | \usebox{\blockone}  | \usebox{\blocktwo} |
  |---------------------+--------------------|

#+end_src

I hope this makes sense but basically you save the output of the
formatting of the blocks into latex boxes which you later place wherever
you want.  The side benefit is you can use these blocks more than one...

HTH,
eric
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1
: using Org-mode version 7.8.02 (release_7.8.02.55.g1870)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]