emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Charles Turner <chturne@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Orthogonality of blocks
Date: Fri, 30 Dec 2011 14:17:13 +0000	[thread overview]
Message-ID: <87lipuywie.fsf@ucl.ac.uk> (raw)
In-Reply-To: <4EFA208B.6040905@gmail.com> (Charles Turner's message of "Tue, 27 Dec 2011 19:46:19 +0000")

Charles Turner <chturne@gmail.com> 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)

      parent reply	other threads:[~2011-12-30 14:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-27 19:46 Orthogonality of blocks Charles Turner
2011-12-27 20:37 ` Eric Schulte
2011-12-27 21:12   ` Christian Moe
2011-12-27 21:10     ` Eric Schulte
2011-12-27 23:19       ` Christian Moe
2011-12-27 23:30     ` Nick Dokos
2011-12-28  0:14       ` Torsten Wagner
2011-12-28  4:48       ` Jambunathan K
2011-12-28  5:30         ` Jambunathan K
2011-12-28  7:10       ` Sebastien Vauban
2011-12-28 14:51     ` Charles Turner
2011-12-29  5:18       ` Jambunathan K
2011-12-29  5:49         ` Enhancing table cell alignments and commenting columns (was Re: Orthogonality of blocks) Jambunathan K
2011-12-29  6:06           ` Jambunathan K
2011-12-29 16:22           ` Jambunathan K
2011-12-29  6:14       ` Orthogonality of blocks Jambunathan K
2011-12-30 14:17 ` Eric S Fraga [this message]

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=87lipuywie.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=chturne@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
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).